1
0

Fix fix assign

This commit is contained in:
otya128
2016-12-08 22:06:10 +09:00
parent 972b075b0f
commit 0a4fea51f5

View File

@@ -90,6 +90,21 @@ class Lexical
this.code = input; this.code = input;
line = 1; line = 1;
} }
this(Lexical lex)
{
this.code = lex.code;
this.reserved = lex.reserved;
this.table = lex.table;
this.pos = lex.pos;
this.token = lex.token;
this.isEmpty = lex.isEmpty;
this.index = lex.index;
this.line = lex.line;
}
Lexical save()
{
return new Lexical(this);
}
bool empty() bool empty()
{ {
return index >= code.length; return index >= code.length;
@@ -867,15 +882,24 @@ class Parser
} }
if (token.type != TokenType.Call) if (token.type != TokenType.Call)
{ {
auto old = lex.save;
auto expr = expression; auto expr = expression;
if (expr.type == NodeType.Variable) token = lex.front;
if (token.type == TokenType.Assign)
{ {
auto variable = cast(Variable)expr; if (expr.type == NodeType.Variable)
node = assign(variable.name); {
auto variable = cast(Variable)expr;
node = assign(variable.name);
return node;
}
node = assign(expr);
return node; return node;
} }
node = assign(expr); else
return node; {
lex = old;
}
} }
lex.popFront(); lex.popFront();
//命令呼び出し //命令呼び出し