Expect now throws an exception
parent
5330ee95f1
commit
9763a85478
|
@ -6,6 +6,12 @@ import std.string : isNumeric, cmp;
|
||||||
import compiler.symbols;
|
import compiler.symbols;
|
||||||
import compiler.lexer : Token;
|
import compiler.lexer : Token;
|
||||||
import core.stdc.stdlib;
|
import core.stdc.stdlib;
|
||||||
|
import misc.exceptions : TError;
|
||||||
|
|
||||||
|
// public final class ParserError : TError
|
||||||
|
// {
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
public final class Parser
|
public final class Parser
|
||||||
{
|
{
|
||||||
|
@ -39,8 +45,9 @@ public final class Parser
|
||||||
*/
|
*/
|
||||||
public static void expect(string message)
|
public static void expect(string message)
|
||||||
{
|
{
|
||||||
gprintln(message, DebugType.ERROR);
|
throw new TError(message);
|
||||||
exit(0); /* TODO: Exit code */ /* TODO: Version that returns or asserts for unit tests */
|
//gprintln(message, DebugType.ERROR);
|
||||||
|
//exit(0); /* TODO: Exit code */ /* TODO: Version that returns or asserts for unit tests */
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
module misc.exceptions;
|
||||||
|
|
||||||
|
import gogga : generateMessage;
|
||||||
|
|
||||||
|
public class TError : Exception
|
||||||
|
{
|
||||||
|
this(string message)
|
||||||
|
{
|
||||||
|
/* Generate eerror message using gogga */
|
||||||
|
byte[] messageBytes = generateMessage(message, DebugType.ERROR);
|
||||||
|
/* TODO: Check the vnode for path of fd 0, dont vt100 is not tty device */
|
||||||
|
|
||||||
|
super(messageBytes);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue