module volta.parser.errors
Code Map
module volta.parser.errors;
//! Describes a parse failure.
class ParserError
{
public:
enum Kind
{
//! No error.
Ok,
//! The parser has made an error.
Panic,
//! A token wasn't where we expected it to be.
UnexpectedToken,
//! Wrong token was found.
WrongToken,
//! A parse failed. That failure will be i-1 on parseErrors.
ParseFailed,
//! A feature was used that is unsupported.
UnsupportedFeature,
//! An invalid integer literal was supplied.
InvalidIntegerLiteral,
//! We expected something and didn't get it.
Expected,
//! All arguments must be labelled.
AllArgumentsMustBeLabelled,
//! Doc comment applies to multiple nodes.
DocCommentMultiple,
//! Start doc comment in token stream.
StrayDocComment,
//! new "string without component"
BadComposableString,
//! Only bind imports can use multibind.
BadMultiBind,
}
public:
//! Every error type uses at least these three. type: The type of error
//! that occurred. location: Where the error occurred. nodeType: The node
//! that was being parsed when the error occured.
kind: Kind;
//! Every error type uses at least these three. type: The type of error
//! that occurred. location: Where the error occurred. nodeType: The node
//! that was being parsed when the error occured.
loc: Location;
//! Every error type uses at least these three. type: The type of error
//! that occurred. location: Where the error occurred. nodeType: The node
//! that was being parsed when the error occured.
nodeType: NodeType;
//! Keeps track of where the error was raised. For internal debug.
raiseFile: string;
//! Keeps track of where the error was raised. For internal debug.
raiseLine: i32;
public:
this(kind: Kind, loc: Location, nodeType: NodeType, file: string, line: const(i32)) { }
fn errorMessage() string;
}
class ParserPanic : ParserError
{
public:
//! The panic error message.
message: string;
public:
this(loc: const(Location), nodeType: NodeType, message: string, file: string, line: const(i32)) { }
fn errorMessage() string { }
}
class ParserUnexpectedToken : ParserError
{
public:
found: string;
public:
this(loc: const(Location), nodeType: NodeType, found: string, file: string, line: const(i32)) { }
fn errorMessage() string { }
}
class ParserWrongToken : ParserError
{
public:
found: TokenType;
expected: TokenType;
public:
this(loc: const(Location), nodeType: NodeType, found: TokenType, expected: TokenType, file: string, line: const(i32)) { }
fn errorMessage() string { }
}
class ParserParseFailed : ParserError
{
public:
otherNodeType: NodeType;
public:
this(loc: const(Location), nodeType: NodeType, otherNodeType: NodeType, file: string, line: const(i32)) { }
fn errorMessage() string { }
}
class ParserUnsupportedFeature : ParserError
{
public:
description: string;
public:
this(loc: const(Location), nodeType: NodeType, description: string, file: string, line: const(i32)) { }
fn errorMessage() string { }
}
class ParserInvalidIntegerLiteral : ParserError
{
public:
this(loc: const(Location), nodeType: NodeType, file: string, line: const(i32)) { }
fn errorMessage() string { }
}
class ParserAllArgumentsMustBeLabelled : ParserError
{
public:
this(loc: const(Location), file: string, line: const(i32)) { }
fn errorMessage() string { }
}
class ParserExpected : ParserError
{
public:
//! What was expected.
message: string;
public:
this(loc: const(Location), nodeType: NodeType, message: string, file: string, line: const(i32)) { }
fn errorMessage() string { }
}
class ParserDocMultiple : ParserError
{
public:
this(loc: const(Location), file: string, line: const(i32)) { }
fn errorMessage() string { }
}
class ParserStrayDocComment : ParserError
{
public:
this(loc: const(Location), file: string, line: const(i32)) { }
fn errorMessage() string { }
}
class ParserNotAComposableString : ParserError
{
public:
this(loc: const(Location), file: string, line: const(i32)) { }
fn errorMessage() string { }
}
class ParserBadMultiBind : ParserError
{
public:
this(loc: const(Location), file: string, line: const(i32)) { }
fn errorMessage() string { }
}
class ParserError
Describes a parse failure.
kind: Kind
Every error type uses at least these three. type: The type of error that occurred. location: Where the error occurred. nodeType: The node that was being parsed when the error occured.
loc: Location
Every error type uses at least these three. type: The type of error that occurred. location: Where the error occurred. nodeType: The node that was being parsed when the error occured.
nodeType: NodeType
Every error type uses at least these three. type: The type of error that occurred. location: Where the error occurred. nodeType: The node that was being parsed when the error occured.
raiseFile: string
Keeps track of where the error was raised. For internal debug.
raiseLine: i32
Keeps track of where the error was raised. For internal debug.