Jelajahi Sumber

Fix end of statement without ';' when trying to recognise C++ namespace prefix, also fix spelling mistake

mingodad 7 tahun lalu
induk
melakukan
fb6007db78
1 mengubah file dengan 8 tambahan dan 6 penghapusan
  1. 8 6
      SquiLu/squirrel/sqcompiler.cpp

+ 8 - 6
SquiLu/squirrel/sqcompiler.cpp

@@ -1530,6 +1530,8 @@ start_again:
             switch(_token)
             switch(_token)
             {
             {
             case TK_DOUBLE_COLON: //C++ style namespace
             case TK_DOUBLE_COLON: //C++ style namespace
+                if(IsEndOfStatement()) return;
+                //else fall trough
             case _SC('.'):
             case _SC('.'):
                 pos = -1;
                 pos = -1;
                 Lex();
                 Lex();
@@ -1654,7 +1656,7 @@ start_again:
     SQInteger Factor()
     SQInteger Factor()
     {
     {
         _es.etype = EXPR;
         _es.etype = EXPR;
-        bool compileTimeCheckedContant = false;
+        bool compileTimeCheckedConstant = false;
         switch(_token)
         switch(_token)
         {
         {
         case TK_STRING_LITERAL:
         case TK_STRING_LITERAL:
@@ -1692,7 +1694,7 @@ start_again:
         case _SC('$'): //compile time checked constant
         case _SC('$'): //compile time checked constant
             Lex();
             Lex();
             ErrorIfNotToken(TK_IDENTIFIER);
             ErrorIfNotToken(TK_IDENTIFIER);
-            compileTimeCheckedContant = true;
+            compileTimeCheckedConstant = true;
             //fallthrough to TK_IDENTIFIER
             //fallthrough to TK_IDENTIFIER
         case TK_IDENTIFIER:
         case TK_IDENTIFIER:
         case TK_CONSTRUCTOR:
         case TK_CONSTRUCTOR:
@@ -1706,7 +1708,7 @@ start_again:
             {
             {
             case TK_IDENTIFIER:
             case TK_IDENTIFIER:
                 id = _fs->CreateString(_lex.data->svalue);
                 id = _fs->CreateString(_lex.data->svalue);
-                if(compileTimeCheckedContant)
+                if(compileTimeCheckedConstant)
                 {
                 {
                     SQObjectPtr val;
                     SQObjectPtr val;
                     CompileTimeCheckConstsGet(id, val);
                     CompileTimeCheckConstsGet(id, val);
@@ -2111,7 +2113,7 @@ start_again:
             bool cppDestructor = false;
             bool cppDestructor = false;
             //bool isvirtual = false;
             //bool isvirtual = false;
             //bool isprivate = false;
             //bool isprivate = false;
-            bool compileTimeCheckedContant = false;
+            bool compileTimeCheckedConstant = false;
             const SQChar *membertypename = 0;
             const SQChar *membertypename = 0;
             SQInteger member_type_token = 0;
             SQInteger member_type_token = 0;
             //check if is an attribute
             //check if is an attribute
@@ -2195,7 +2197,7 @@ function_params_decl:
             case _SC('$'): //compile time checked constant
             case _SC('$'): //compile time checked constant
                 Lex();
                 Lex();
                 ErrorIfNotToken(TK_IDENTIFIER);
                 ErrorIfNotToken(TK_IDENTIFIER);
-                compileTimeCheckedContant = true;
+                compileTimeCheckedConstant = true;
                 //fallthrough to TK_IDENTIFIER
                 //fallthrough to TK_IDENTIFIER
             case TK_STRING_LITERAL: //JSON
             case TK_STRING_LITERAL: //JSON
                 if(isClass)
                 if(isClass)
@@ -2205,7 +2207,7 @@ function_params_decl:
             case TK_IDENTIFIER:  //JSON
             case TK_IDENTIFIER:  //JSON
             {
             {
                 obj_id = GetTokenObject(_token);
                 obj_id = GetTokenObject(_token);
-                if(compileTimeCheckedContant)
+                if(compileTimeCheckedConstant)
                 {
                 {
                     SQObjectPtr val;
                     SQObjectPtr val;
                     CompileTimeCheckConstsGet(obj_id, val);
                     CompileTimeCheckConstsGet(obj_id, val);