- Added new exception type `LexerException`
- Added `LexerError` enum to support various error types of the `LexerException` exception type
This commit is contained in:
Tristan B. Velloza Kildaire 2023-01-22 14:45:25 +02:00
parent 31adeb4223
commit 5fd1bef2a4
1 changed files with 20 additions and 0 deletions

View File

@ -5,6 +5,26 @@ import gogga;
import std.conv : to;
import std.string : cmp;
import std.ascii : isDigit;
import misc.exceptions : TError;
public enum LexerError
{
EXHAUSTED_CHARACTERS,
OTHER
}
public final class LexerException : TError
{
public const Lexer offendingInstance;
public const LexerError errType;
this(Lexer offendingInstance, LexerError errType = LexerError.OTHER, string msg = "")
{
super(to!(string)(errType)~(msg.length ? ": "~msg : ""));
this.offendingInstance = offendingInstance;
this.errType = errType;
}
}
/* TODO: Add Token type (which matches column and position too) */
public final class Token