Correct parser end_pos for multiline strings

This commit is contained in:
Brad Lewis
2025-10-17 21:25:17 -04:00
parent 2a8d9ee3f7
commit 44f823afce

View File

@@ -99,10 +99,8 @@ end_pos :: proc(tok: tokenizer.Token) -> tokenizer.Pos {
pos := tok.pos
pos.offset += len(tok.text)
if tok.kind == .Comment {
if tok.text[:2] != "/*" {
pos.column += len(tok.text)
} else {
if tok.kind == .Comment || tok.kind == .String {
if tok.text[:2] == "/*" || tok.text[:1] == "`" {
for i := 0; i < len(tok.text); i += 1 {
c := tok.text[i]
if c == '\n' {
@@ -112,6 +110,8 @@ end_pos :: proc(tok: tokenizer.Token) -> tokenizer.Pos {
pos.column += 1
}
}
} else {
pos.column += len(tok.text)
}
} else {
pos.column += len(tok.text)