diff --git a/src/Parser/Lexer/Lexer.cpp b/src/Parser/Lexer/Lexer.cpp index 6365010..0cbc19e 100644 --- a/src/Parser/Lexer/Lexer.cpp +++ b/src/Parser/Lexer/Lexer.cpp @@ -302,12 +302,7 @@ namespace MalachScript::Parser { case 'O': numericalSystem = 8; break; case 'b': case 'B': numericalSystem = 2; break; - default: - LogError(Diagnostics::DiagnosticType::InvalidNumericalBase, - TextSpan(_position - 1, _position + 1), {std::string(1, secondChar)}); - // Set to the largest numerical system, so we can prevent errors down the line. - numericalSystem = 16; - break; + default: return Create(TextSpan(_position - 1, _position), 0); } } } @@ -403,7 +398,7 @@ namespace MalachScript::Parser { value <<= 4; value += v; } - return Create(TextSpan(start, _position), value); + return Create(TextSpan(start - 1, _position), value); } IntegerLiteral* Lexer::LexOctal() { auto start = _position; @@ -417,7 +412,7 @@ namespace MalachScript::Parser { value <<= 3; value += v; } - return Create(TextSpan(start, _position), value); + return Create(TextSpan(start - 1, _position), value); } IntegerLiteral* Lexer::LexBinary() { auto start = _position; @@ -431,7 +426,7 @@ namespace MalachScript::Parser { value <<= 1; value += v; } - return Create(TextSpan(start, _position), value); + return Create(TextSpan(start - 1, _position), value); } StringLiteral* Lexer::LexString(char8_t opening, bool heredoc) { auto openingPos = _position;