]> git.saurik.com Git - cycript.git/blobdiff - Complete.cpp
Use Object.defineProperty as ES6 class visibility.
[cycript.git] / Complete.cpp
index 13590bba7a2cbeafd8bc73714b4e004b4a12ed33..c81f90eb15cde39166ce5967b61ead5298679c5e 100644 (file)
@@ -22,7 +22,6 @@
 #include "cycript.hpp"
 
 #include "Driver.hpp"
 #include "cycript.hpp"
 
 #include "Driver.hpp"
-#include "Cycript.tab.hh"
 #include "Replace.hpp"
 #include "String.hpp"
 
 #include "Replace.hpp"
 #include "String.hpp"
 
@@ -30,9 +29,7 @@ static CYExpression *ParseExpression(CYPool &pool, CYUTF8String code) {
     std::stringstream stream;
     stream << '(' << code << ')';
     CYDriver driver(pool, stream);
     std::stringstream stream;
     stream << '(' << code << ')';
     CYDriver driver(pool, stream);
-
-    cy::parser parser(driver);
-    if (parser.parse() != 0 || !driver.errors_.empty())
+    if (driver.Parse() || !driver.errors_.empty())
         return NULL;
 
     CYOptions options;
         return NULL;
 
     CYOptions options;
@@ -59,8 +56,7 @@ _visible char **CYComplete(const char *word, const std::string &line, CYUTF8Stri
 
     driver.auto_ = true;
 
 
     driver.auto_ = true;
 
-    cy::parser parser(driver);
-    if (parser.parse() != 0 || !driver.errors_.empty())
+    if (driver.Parse() || !driver.errors_.empty())
         return NULL;
 
     if (driver.mode_ == CYDriver::AutoNone)
         return NULL;
 
     if (driver.mode_ == CYDriver::AutoNone)
@@ -137,8 +133,12 @@ _visible char **CYComplete(const char *word, const std::string &line, CYUTF8Stri
     std::string common;
     bool rest(false);
 
     std::string common;
     bool rest(false);
 
-    CYForEach (element, array->elements_) {
-        CYString *string(dynamic_cast<CYString *>(element->value_));
+    for (CYElement *element(array->elements_); element != NULL; ) {
+        CYElementValue *value(dynamic_cast<CYElementValue *>(element));
+        _assert(value != NULL);
+        element = value->next_;
+
+        CYString *string(dynamic_cast<CYString *>(value->value_));
         _assert(string != NULL);
 
         std::string completion;
         _assert(string != NULL);
 
         std::string completion;