Cleaned up

if_statement_parsing
Tristan B. V. Kildaire 2021-03-20 18:31:03 +02:00
parent 1121f2d84e
commit 2873a6ab4e
2 changed files with 13 additions and 15 deletions

View File

@ -166,25 +166,15 @@ public final class Parser
/* Check for opening curly (just an "else" statement) */
else if (getSymbolType(getCurrentToken()) == SymbolType.OCURLY)
{
/* TODO: Implement me */
import std.stdio;
writeln("EYO ELSE");
/* Opening { */
writeln("Bruh"~to!(string)(getCurrentToken()));
// nextToken();
/* Parse the if' statement's body AND expect a closing curly */
/* Parse the if' statement's body (starting with `{` AND expect a closing curly */
parseBody();
expect(SymbolType.CCURLY, getCurrentToken());
nextToken();
writeln("EYO ELSE (END):");
writeln("Bruh"~to!(string)(getCurrentToken()));
/* Don't allow anything to follow after this */
reachedElse = true;
//break;
}
/* Error out for unexpected symbol or invalid reachedElse */
else

View File

@ -27,7 +27,15 @@ class clazz_2_1
print("Hello");
}
else
{
}
else
{
}
if(1)
{