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

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
1 changed files with 3 additions and 1 deletions

View File

@ -432,6 +432,7 @@ namespace MalachScript::Parser {
return Create<IntegerLiteral>(TextSpan(start, _position), value);
}
StringLiteral* Lexer::LexString(char8_t opening, bool heredoc) {
auto openingPos = _position;
Progress();
if (heredoc) {
Progress(2);
@ -461,7 +462,8 @@ namespace MalachScript::Parser {
if (heredoc) {
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() {