Added new `expect(string)` method for custom messages for panic
Also made `expect(SymbolType, Token)` use said new methodexpression_parsing.sync-conflict-20210316-090018-O3W7KWN
parent
88a5c0e482
commit
4ed0b385cf
|
@ -25,14 +25,17 @@ public final class Parser
|
|||
/* TODO: Crash program if not */
|
||||
if (!isFine)
|
||||
{
|
||||
gprintln("Expected symbol of type " ~ to!(string)(symbol) ~ " but got " ~ to!(
|
||||
string)(actualType) ~ " with " ~ token.toString(), DebugType.ERROR);
|
||||
import core.stdc.stdlib;
|
||||
|
||||
exit(0);
|
||||
expect("Expected symbol of type " ~ to!(string)(symbol) ~ " but got " ~ to!(
|
||||
string)(actualType) ~ " with " ~ token.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public static void expect(string message)
|
||||
{
|
||||
gprintln(message, DebugType.ERROR);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
this(Token[] tokens)
|
||||
{
|
||||
this.tokens = tokens;
|
||||
|
|
Loading…
Reference in New Issue