Implemented all Lexer errors
This commit is contained in:
@@ -40,8 +40,8 @@ namespace LXC::Lexer
|
||||
{
|
||||
static const char* reasons[] =
|
||||
{
|
||||
"Invalid character found in source: ",
|
||||
"Unterminated string literal in source starting at: "
|
||||
"Invalid character found in source",
|
||||
"Unterminated string literal in source"
|
||||
};
|
||||
|
||||
return reasons[reason];
|
||||
|
||||
@@ -104,14 +104,16 @@ namespace LXC::Lexer
|
||||
|
||||
// If an if-statement has not been triggered the character must be invalid //
|
||||
else
|
||||
{
|
||||
return Util::FunctionFail<LexerError>(LexerError::InvalidCharacter, -1);
|
||||
}
|
||||
return Util::FunctionFail<LexerError>(LexerError::InvalidCharacter, ctx.index);
|
||||
|
||||
// Iterates to the next index //
|
||||
ctx.column++;
|
||||
ctx.index++;
|
||||
}
|
||||
}
|
||||
|
||||
// Checks for an unterminated string literal //
|
||||
if (trackers.inStrLiteral)
|
||||
return Util::FunctionFail<LexerError>(LexerError::UnterminatedStringLiteral, trackers.sectionStart);
|
||||
|
||||
return ctx.out;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user