If statement parsing completed
Also on unknown symbol in `parseBody` remember to error out and exit
This commit is contained in:
parent
70bdeed89b
commit
35132be9d6
|
@ -169,23 +169,9 @@ public final class Parser
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
/* Error out if an else was simply placed */
|
/* If we get anything else, then we are done with if statement */
|
||||||
else if(getSymbolType(getCurrentToken()) == SymbolType.ELSE && !hasIf)
|
|
||||||
{
|
|
||||||
expect("Else placed without previous if");
|
|
||||||
}
|
|
||||||
// /* If we get another `if` but already had one then exit, it's a new one to process */
|
|
||||||
// else if (getSymbolType(getCurrentToken()) == SymbolType.IF && hasIf)
|
|
||||||
// {
|
|
||||||
// /* Leave this parseIf, it will be called again by caller (`parseBody()`) */
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
/* If we get an unknown, not an `if` or `else` */
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* TODO: Add error */
|
|
||||||
import std.stdio;
|
|
||||||
writeln("Bruh"~to!(string)(getCurrentToken()));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -282,8 +268,8 @@ public final class Parser
|
||||||
/* Error out */
|
/* Error out */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gprintln("parseBody(): Unknown symbol: " ~ getCurrentToken()
|
expect("parseBody(): Unknown symbol: " ~ getCurrentToken()
|
||||||
.getToken(), DebugType.ERROR);
|
.getToken());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue