Browse Source

Add experimental shortcut for string constant 'const :somestr; == const somestr = "somestr";'

mingodad 7 years ago
parent
commit
9374ec39f1
1 changed files with 12 additions and 0 deletions
  1. 12 0
      SquiLu/squirrel/sqcompiler.cpp

+ 12 - 0
SquiLu/squirrel/sqcompiler.cpp

@@ -892,6 +892,18 @@ start_again:
         case TK_CONST:
         {
             Lex();
+            if(_token == _SC(':'))
+            {
+                //string const
+                Lex();
+		id = Expect(TK_IDENTIFIER);
+		SQObjectPtr strongid = id;
+		CheckLocalNameScope(id, _scope.nested);
+		//CheckConstsExists(strongid);
+		OptionalSemicolon();
+		ConstsNewSlot(strongid,SQObjectPtr(id));
+		break;
+            }
             if(_token == TK_IDENTIFIER)
             {
                 id = _fs->CreateString(_lex.data->svalue);