From 28fa7321dff937d2d985c80fdf5b1f31ad79f998 Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Tue, 6 Feb 2024 23:08:25 -0500 Subject: [PATCH] Lexer now records the width of tokens --- lexer/lexer.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lexer/lexer.go b/lexer/lexer.go index 41446f6..e14172b 100644 --- a/lexer/lexer.go +++ b/lexer/lexer.go @@ -181,6 +181,12 @@ func (this *fsplLexer) nextInternal () (token Token, err error) { } } + defer func () { + newPos := this.pos() + newPos.End -- // TODO figure out why tf we have to do this + token.Position = token.Position.Union(newPos) + } () + switch { // Ident case unicode.IsLower(this.rune):