module volta.token.error

Code Map

module volta.token.error;


enum LexStatus
{
	NotPresent,
	Succeeded,
	Failed,
}

alias NotPresent = LexStatus.NotPresent;
alias Succeeded = LexStatus.Succeeded;
alias Failed = LexStatus.Failed;

//! Describes a lexer failure.
class LexerError
{
public:
	enum Kind
	{
		//! No error.
		Ok,
		//! Tried to lex something, but it failed.
		LexFailed,
		//! Expected something that wasn't there.
		Expected,
		//! Didn't expect something that we got.
		Unexpected,
		//! Tried to use an unsupported feature.
		Unsupported,
		//! Display the given string.
		String,
		//! Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaah! (Compiler Error)
		Panic,
	}


public:
	kind: Kind;
	loc: Location;
	currentChar: dchar;


public:
	this(kind: Kind, loc: Location, currentChar: dchar) { }
	fn errorMessage() string;
}

//! An error with a string.
class LexerStringError : LexerError
{
public:
	str: string;


public:
	this(kind: Kind, loc: Location, currentChar: dchar, str: string) { }
	fn errorMessage() string { }
}
class LexerError

Describes a lexer failure.

class LexerStringError : LexerError

An error with a string.