Made token movement for `parseIf` and `parseWhile` self-contained

This commit is contained in:
Tristan B. Velloza Kildaire 2021-03-05 11:40:06 +02:00
parent 847f76d7d2
commit 94f15af031
1 changed files with 6 additions and 2 deletions

View File

@ -63,6 +63,9 @@ public final class Parser
private void parseIf()
{
/* Pop off the `if` */
nextToken();
/* Expect an opening brace `(` */
expect(SymbolType.LBRACE, getCurrentToken());
nextToken();
@ -85,6 +88,9 @@ public final class Parser
private void parseWhile()
{
/* Pop off the `while` */
nextToken();
/* Expect an opening brace `(` */
expect(SymbolType.LBRACE, getCurrentToken());
nextToken();
@ -141,13 +147,11 @@ public final class Parser
/* If it is a branch */
else if(symbol == SymbolType.IF)
{
nextToken();
parseIf();
}
/* If it is a while loop */
else if(symbol == SymbolType.WHILE)
{
nextToken();
parseWhile();
}
/* If it is a function call */