Made token movement for `parseIf` and `parseWhile` self-contained
parent
847f76d7d2
commit
94f15af031
|
@ -63,6 +63,9 @@ public final class Parser
|
||||||
|
|
||||||
private void parseIf()
|
private void parseIf()
|
||||||
{
|
{
|
||||||
|
/* Pop off the `if` */
|
||||||
|
nextToken();
|
||||||
|
|
||||||
/* Expect an opening brace `(` */
|
/* Expect an opening brace `(` */
|
||||||
expect(SymbolType.LBRACE, getCurrentToken());
|
expect(SymbolType.LBRACE, getCurrentToken());
|
||||||
nextToken();
|
nextToken();
|
||||||
|
@ -85,6 +88,9 @@ public final class Parser
|
||||||
|
|
||||||
private void parseWhile()
|
private void parseWhile()
|
||||||
{
|
{
|
||||||
|
/* Pop off the `while` */
|
||||||
|
nextToken();
|
||||||
|
|
||||||
/* Expect an opening brace `(` */
|
/* Expect an opening brace `(` */
|
||||||
expect(SymbolType.LBRACE, getCurrentToken());
|
expect(SymbolType.LBRACE, getCurrentToken());
|
||||||
nextToken();
|
nextToken();
|
||||||
|
@ -141,13 +147,11 @@ public final class Parser
|
||||||
/* If it is a branch */
|
/* If it is a branch */
|
||||||
else if(symbol == SymbolType.IF)
|
else if(symbol == SymbolType.IF)
|
||||||
{
|
{
|
||||||
nextToken();
|
|
||||||
parseIf();
|
parseIf();
|
||||||
}
|
}
|
||||||
/* If it is a while loop */
|
/* If it is a while loop */
|
||||||
else if(symbol == SymbolType.WHILE)
|
else if(symbol == SymbolType.WHILE)
|
||||||
{
|
{
|
||||||
nextToken();
|
|
||||||
parseWhile();
|
parseWhile();
|
||||||
}
|
}
|
||||||
/* If it is a function call */
|
/* If it is a function call */
|
||||||
|
|
Loading…
Reference in New Issue