From c84c4c6e4c1e838a4779c22599ee6da097247c4f Mon Sep 17 00:00:00 2001 From: luisgustavom1 Date: Tue, 4 Jul 2023 22:24:46 -0300 Subject: [PATCH] fix: move tokenLineNumber increment to inside the EOF if --- lex.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lex.go b/lex.go index bd622db..89fa414 100644 --- a/lex.go +++ b/lex.go @@ -44,7 +44,6 @@ func (t token) debug(description string) { for i < len(t.lc.source) { r := t.lc.source[i] - tokenLineNumber++ if i < t.location { tokenColumn++ } @@ -52,6 +51,7 @@ func (t token) debug(description string) { tokenLine = append(tokenLine, r) if r == '\n' { + tokenLineNumber++ // Got to the end of the line that the token is in. if inTokenLine { // Now outside the loop, `tokenLine`