1
0

Support VAR() parsing

This commit is contained in:
otya128
2016-12-08 21:07:45 +09:00
parent 737e4e55f0
commit cc05576862
2 changed files with 4 additions and 1 deletions

View File

@@ -59,7 +59,7 @@ class Lexical
reserved["BREAK"] = TokenType.Break; reserved["BREAK"] = TokenType.Break;
reserved["CONTINUE"] = TokenType.Continue; reserved["CONTINUE"] = TokenType.Continue;
reserved["VAR"] = TokenType.Var; reserved["VAR"] = TokenType.Var;
reserved["DIM"] = TokenType.Var; reserved["DIM"] = TokenType.Dim;
reserved["DEF"] = TokenType.Def; reserved["DEF"] = TokenType.Def;
reserved["OUT"] = TokenType.Out; reserved["OUT"] = TokenType.Out;
reserved["out"] = TokenType.Out;//ekkitou reserved["out"] = TokenType.Out;//ekkitou
@@ -993,6 +993,7 @@ class Parser
case TokenType.Continue: case TokenType.Continue:
node = new Continue(lex.location); node = new Continue(lex.location);
break; break;
case TokenType.Dim:
case TokenType.Var: case TokenType.Var:
lex.popFront(); lex.popFront();
node = var(); node = var();
@@ -1744,6 +1745,7 @@ class Parser
version(none)stdout.flush(); version(none)stdout.flush();
node = new Constant(token.value, lex.location); node = new Constant(token.value, lex.location);
break; break;
case TokenType.Var:
case TokenType.Call: case TokenType.Call:
case TokenType.Iden: case TokenType.Iden:
if(!lex.empty()) if(!lex.empty())

View File

@@ -73,6 +73,7 @@ enum TokenType
Repeat, Repeat,
Until, Until,
Swap, Swap,
Dim,
} }
struct Token struct Token