浏览代码

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

mingodad 7 年之前
父节点
当前提交
9374ec39f1
共有 1 个文件被更改,包括 12 次插入0 次删除
  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);