Fix fix assign
This commit is contained in:
@@ -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,7 +882,11 @@ class Parser
|
|||||||
}
|
}
|
||||||
if (token.type != TokenType.Call)
|
if (token.type != TokenType.Call)
|
||||||
{
|
{
|
||||||
|
auto old = lex.save;
|
||||||
auto expr = expression;
|
auto expr = expression;
|
||||||
|
token = lex.front;
|
||||||
|
if (token.type == TokenType.Assign)
|
||||||
|
{
|
||||||
if (expr.type == NodeType.Variable)
|
if (expr.type == NodeType.Variable)
|
||||||
{
|
{
|
||||||
auto variable = cast(Variable)expr;
|
auto variable = cast(Variable)expr;
|
||||||
@@ -877,6 +896,11 @@ class Parser
|
|||||||
node = assign(expr);
|
node = assign(expr);
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lex = old;
|
||||||
|
}
|
||||||
|
}
|
||||||
lex.popFront();
|
lex.popFront();
|
||||||
//命令呼び出し
|
//命令呼び出し
|
||||||
auto func = new CallFunctionStatement(name, lex.location);
|
auto func = new CallFunctionStatement(name, lex.location);
|
||||||
|
|||||||
Reference in New Issue
Block a user