Added symbols/operators to lexer
This commit is contained in:
@@ -27,12 +27,13 @@ namespace LXC::Lexer
|
||||
enum Reason
|
||||
{
|
||||
InvalidCharacter,
|
||||
UnterminatedStringLiteral
|
||||
UnterminatedStringLiteral,
|
||||
UnknownSymbolOrOperand
|
||||
};
|
||||
|
||||
// Constructor to pass arguments through to the struct //
|
||||
LexerError(Reason _reason, __int32 errorIndex)
|
||||
: reason(_reason), index(errorIndex)
|
||||
LexerError(Reason _reason, __int32 errorIndex, std::string _info = "")
|
||||
: reason(_reason), index(errorIndex), info(_info)
|
||||
{}
|
||||
|
||||
// Turns the error into a c-string //
|
||||
@@ -41,7 +42,8 @@ namespace LXC::Lexer
|
||||
static const char* reasons[] =
|
||||
{
|
||||
"Invalid character found in source",
|
||||
"Unterminated string literal in source"
|
||||
"Unterminated string literal in source",
|
||||
"Unknown symbol or operand in source"
|
||||
};
|
||||
|
||||
return reasons[reason];
|
||||
@@ -50,6 +52,7 @@ namespace LXC::Lexer
|
||||
// Error information //
|
||||
const Reason reason;
|
||||
const __int32 index;
|
||||
const std::string info;
|
||||
};
|
||||
|
||||
// Turns a file into a vector of tokens //
|
||||
|
||||
Reference in New Issue
Block a user