Fix if expecting a 'then' as else starter
This commit is contained in:
parent
fcaf1c1570
commit
6193441621
@ -605,7 +605,7 @@ class Parser
|
|||||||
throw new Exception($"Index {index} out of bounds of {tokens.Length}, expected `end` after else-ifs of if starting at {startRegion}");
|
throw new Exception($"Index {index} out of bounds of {tokens.Length}, expected `end` after else-ifs of if starting at {startRegion}");
|
||||||
}
|
}
|
||||||
IfNode ret = new(condition: condition, body: body, elseifs: elseifs, startRegion: startRegion, endRegion: tokens[index - 1].region);
|
IfNode ret = new(condition: condition, body: body, elseifs: elseifs, startRegion: startRegion, endRegion: tokens[index - 1].region);
|
||||||
if(tokens[index].type == TokenType.Then)
|
if(tokens[index].type == TokenType.Else)
|
||||||
{
|
{
|
||||||
index += 1;
|
index += 1;
|
||||||
ret.else_ = ParseBlock(tokens);
|
ret.else_ = ParseBlock(tokens);
|
||||||
|
Reference in New Issue
Block a user