Fix IF parsing
This commit is contained in:
@@ -1583,7 +1583,10 @@ class Parser
|
|||||||
then = ifStatements();
|
then = ifStatements();
|
||||||
}
|
}
|
||||||
token = lex.front();
|
token = lex.front();
|
||||||
|
if (multiline || token.type != TokenType.NewLine)
|
||||||
|
{
|
||||||
lex.popFront();
|
lex.popFront();
|
||||||
|
}
|
||||||
import std.typecons;
|
import std.typecons;
|
||||||
Tuple!(Statements, Expression)[] elseif = new Tuple!(Statements, Expression)[0];
|
Tuple!(Statements, Expression)[] elseif = new Tuple!(Statements, Expression)[0];
|
||||||
while(token.type == TokenType.Elseif)
|
while(token.type == TokenType.Elseif)
|
||||||
@@ -1643,8 +1646,11 @@ class Parser
|
|||||||
{
|
{
|
||||||
else_ = ifStatements();
|
else_ = ifStatements();
|
||||||
}
|
}
|
||||||
|
if (multiline || lex.front.type != TokenType.NewLine)
|
||||||
|
{
|
||||||
lex.popFront();
|
lex.popFront();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
auto if_ = new If(expr, then, else_, elseif, lex.location);
|
auto if_ = new If(expr, then, else_, elseif, lex.location);
|
||||||
return if_;
|
return if_;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user