]> git.saurik.com Git - cycript.git/blobdiff - Console.cpp
Remove AssignmentExpression_: merge to parent.
[cycript.git] / Console.cpp
index 89cd62ef635192ee0730650f57f1bd60949640d2..c6e13cb6f4504abca48615cb5f4110557b545bed 100644 (file)
@@ -211,7 +211,7 @@ static CYExpression *ParseExpression(CYUTF8String code) {
     Setup(driver, parser);
 
     if (parser.parse() != 0 || !driver.errors_.empty())
-        _assert(false);
+        return NULL;
 
     CYExpress *express(dynamic_cast<CYExpress *>(driver.program_->statements_));
     _assert(express != NULL);
@@ -264,7 +264,7 @@ static char **Complete(const char *word, int start, int end) {
 
         case CYDriver::AutoMessage: {
             CYDriver::Context &thing(driver.contexts_.back());
-            expression = $M($M($ CYIndirect(thing.context_), $S("isa")), $S("messages"));
+            expression = $M($C1($V("object_getClass"), thing.context_), $S("messages"));
             for (CYDriver::Context::Words::const_iterator part(thing.words_.begin()); part != thing.words_.end(); ++part)
                 prefix << (*part)->word_ << ':';
         } break;
@@ -297,6 +297,9 @@ static char **Complete(const char *word, int start, int end) {
     CYUTF8String json(Run(pool, client_, code));
 
     CYExpression *result(ParseExpression(json));
+    if (result == NULL)
+        return NULL;
+
     CYArray *array(dynamic_cast<CYArray *>(result));
 
     if (array == NULL) {
@@ -482,7 +485,7 @@ static void Console(CYOptions &options) {
             if (parser.parse() != 0 || !driver.errors_.empty()) {
                 for (CYDriver::Errors::const_iterator error(driver.errors_.begin()); error != driver.errors_.end(); ++error) {
                     cy::position begin(error->location_.begin);
-                    if (begin.line != lines.size() || begin.column - 1 != lines.back().size() || error->warning_) {
+                    if (begin.line != lines.size() || begin.column < lines.back().size() || error->warning_) {
                         cy::position end(error->location_.end);
 
                         if (begin.line != lines.size()) {
@@ -491,7 +494,7 @@ static void Console(CYOptions &options) {
                         }
 
                         std::cerr << "....";
-                        for (size_t i(0); i != begin.column - 1; ++i)
+                        for (size_t i(0); i != begin.column; ++i)
                             std::cerr << '.';
                         if (begin.line != end.line || begin.column == end.column)
                             std::cerr << '^';
@@ -573,7 +576,7 @@ int Main(int argc, char const * const argv[], char const * const envp[]) {
     bool compile(false);
     CYOptions options;
 
-    append_history$ = reinterpret_cast<int (*)(int, const char *)>(dlsym(RTLD_DEFAULT, "append_history"));
+    append_history$ = (int (*)(int, const char *)) (dlsym(RTLD_DEFAULT, "append_history"));
 
 #ifdef CY_ATTACH
     pid_t pid(_not(pid_t));