Fix if expecting a 'then' as else starter

This commit is contained in:
0x4261756D 2024-02-21 15:08:16 +01:00
parent fcaf1c1570
commit 6193441621

View File

@ -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}");
}
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;
ret.else_ = ParseBlock(tokens);