Lexer
- Added new exception type `LexerException` - Added `LexerError` enum to support various error types of the `LexerException` exception type
This commit is contained in:
parent
31adeb4223
commit
5fd1bef2a4
|
@ -5,6 +5,26 @@ import gogga;
|
||||||
import std.conv : to;
|
import std.conv : to;
|
||||||
import std.string : cmp;
|
import std.string : cmp;
|
||||||
import std.ascii : isDigit;
|
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) */
|
/* TODO: Add Token type (which matches column and position too) */
|
||||||
public final class Token
|
public final class Token
|
||||||
|
|
Loading…
Reference in New Issue