Fixes issue where string lex token position start would be off by one.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Deukhoofd 2021-01-06 00:08:47 +01:00
parent d907a58f64
commit 2327134e36
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F

View File

@ -432,6 +432,7 @@ namespace MalachScript::Parser {
return Create<IntegerLiteral>(TextSpan(start, _position), value); return Create<IntegerLiteral>(TextSpan(start, _position), value);
} }
StringLiteral* Lexer::LexString(char8_t opening, bool heredoc) { StringLiteral* Lexer::LexString(char8_t opening, bool heredoc) {
auto openingPos = _position;
Progress(); Progress();
if (heredoc) { if (heredoc) {
Progress(2); Progress(2);
@ -461,7 +462,8 @@ namespace MalachScript::Parser {
if (heredoc) { if (heredoc) {
Progress(2); Progress(2);
} }
return Create<StringLiteral>(TextSpan(start, start + _position), ParseString(_script.substr(start, offset))); return Create<StringLiteral>(TextSpan(openingPos, openingPos + _position),
ParseString(_script.substr(start, offset)));
} }
LexToken* Lexer::LexKeywordOrIdentifier() { LexToken* Lexer::LexKeywordOrIdentifier() {