WIP: If statement parsing seems to work and pick up some errors

This commit is contained in:
Tristan B. Velloza Kildaire 2021-03-20 18:38:16 +02:00
parent bbe52bb287
commit 70bdeed89b
2 changed files with 18 additions and 2 deletions

View File

@ -127,7 +127,7 @@ public final class Parser
nextToken();
/* Check if we have an `if` after the `{` (so an "else if" statement) */
if (getSymbolType(getCurrentToken()) == SymbolType.IF && !reachedElse)
if (getSymbolType(getCurrentToken()) == SymbolType.IF)
{
/* Pop off the `if` */
nextToken();

View File

@ -26,7 +26,23 @@ class clazz_2_1
{
print("Hello");
}
else if(1)
{
print("Bruh");
}
else
{
print("Bhjkfd");
}
if(1)
{
print("Hello");
}
else if(1)
{
print("Bruh");
}
else
{
print("Bhjkfd");