When an integer starts with a 0, and is followed by a non numerical symbol just lex it as a 0 literal, followed by another token.
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
This commit is contained in:
parent
807fe63828
commit
cf8d6ce18b
|
@ -302,12 +302,7 @@ namespace MalachScript::Parser {
|
||||||
case 'O': numericalSystem = 8; break;
|
case 'O': numericalSystem = 8; break;
|
||||||
case 'b':
|
case 'b':
|
||||||
case 'B': numericalSystem = 2; break;
|
case 'B': numericalSystem = 2; break;
|
||||||
default:
|
default: return Create<IntegerLiteral>(TextSpan(_position - 1, _position), 0);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -403,7 +398,7 @@ namespace MalachScript::Parser {
|
||||||
value <<= 4;
|
value <<= 4;
|
||||||
value += v;
|
value += v;
|
||||||
}
|
}
|
||||||
return Create<IntegerLiteral>(TextSpan(start, _position), value);
|
return Create<IntegerLiteral>(TextSpan(start - 1, _position), value);
|
||||||
}
|
}
|
||||||
IntegerLiteral* Lexer::LexOctal() {
|
IntegerLiteral* Lexer::LexOctal() {
|
||||||
auto start = _position;
|
auto start = _position;
|
||||||
|
@ -417,7 +412,7 @@ namespace MalachScript::Parser {
|
||||||
value <<= 3;
|
value <<= 3;
|
||||||
value += v;
|
value += v;
|
||||||
}
|
}
|
||||||
return Create<IntegerLiteral>(TextSpan(start, _position), value);
|
return Create<IntegerLiteral>(TextSpan(start - 1, _position), value);
|
||||||
}
|
}
|
||||||
IntegerLiteral* Lexer::LexBinary() {
|
IntegerLiteral* Lexer::LexBinary() {
|
||||||
auto start = _position;
|
auto start = _position;
|
||||||
|
@ -431,7 +426,7 @@ namespace MalachScript::Parser {
|
||||||
value <<= 1;
|
value <<= 1;
|
||||||
value += v;
|
value += v;
|
||||||
}
|
}
|
||||||
return Create<IntegerLiteral>(TextSpan(start, _position), value);
|
return Create<IntegerLiteral>(TextSpan(start - 1, _position), value);
|
||||||
}
|
}
|
||||||
StringLiteral* Lexer::LexString(char8_t opening, bool heredoc) {
|
StringLiteral* Lexer::LexString(char8_t opening, bool heredoc) {
|
||||||
auto openingPos = _position;
|
auto openingPos = _position;
|
||||||
|
|
Loading…
Reference in New Issue