1
0

VAR name=exprを実装

This commit is contained in:
otya128
2016-08-31 17:04:50 +09:00
parent e9c94f5bbd
commit 9b0d7c0a8c
2 changed files with 4 additions and 1 deletions

View File

@@ -656,6 +656,8 @@ class Compiler
{ {
DefineVariable var = cast(DefineVariable)v; DefineVariable var = cast(DefineVariable)v;
defineVarIndex(var.name, sc); defineVarIndex(var.name, sc);
compileExpression(var.expression, sc);
genCodePopVar(var.name, sc);
continue; continue;
} }
if(v.type == NodeType.DefineArray) if(v.type == NodeType.DefineArray)

View File

@@ -202,6 +202,7 @@ class Lexical
if(c == '"' || c == '\r' || c == '\n')//"を閉じない文も許容 if(c == '"' || c == '\r' || c == '\n')//"を閉じない文も許容
{ {
i++; i++;
if (c == '\r' || c == '\n') i--;
break; break;
} }
str ~= c; str ~= c;
@@ -1272,7 +1273,7 @@ class Parser
else else
{ {
//VAR iden=expr //VAR iden=expr
if(token.type == TokenType.Equal) if(token.type == TokenType.Assign)
{ {
lex.popFront(); lex.popFront();
expr = expression(); expr = expression();