summaryrefslogtreecommitdiff
path: root/parser/decl.go
diff options
context:
space:
mode:
authorMarc Vertes <mvertes@free.fr>2026-01-22 11:33:32 +0100
committerMarc Vertes <mvertes@free.fr>2026-01-22 11:33:32 +0100
commit9bf668e7114bb92a0b072db5d4e092c0b8f964c4 (patch)
tree0d35e544715a3f902550af2cb4d249e8fb1e33af /parser/decl.go
parentc922c797204069f42a7abf88500c5708f68a8e43 (diff)
chore: refactor token types to avoid mutate scanner tokens
Mutating scanner tokens or reusing scanner token attributes to store other metadata is a hack. Introduce a new parser token type with arbitrary args. The next step will be to use the arg field instead of scanner token fields.
Diffstat (limited to 'parser/decl.go')
-rw-r--r--parser/decl.go5
1 files changed, 2 insertions, 3 deletions
diff --git a/parser/decl.go b/parser/decl.go
index 8833580..807fd72 100644
--- a/parser/decl.go
+++ b/parser/decl.go
@@ -9,7 +9,6 @@ import (
"strings"
"github.com/mvertes/parscan/lang"
- "github.com/mvertes/parscan/scanner"
"github.com/mvertes/parscan/symbol"
"github.com/mvertes/parscan/vm"
)
@@ -357,9 +356,9 @@ func (p *Parser) parseVarLine(in Tokens) (out Tokens, err error) {
if v, err = p.parseExpr(v, ""); err != nil {
return out, err
}
- out = append(out, scanner.Token{Tok: lang.Ident, Str: vars[i]})
+ out = append(out, newIdent(vars[i], 0))
out = append(out, v...)
- out = append(out, scanner.Token{Tok: lang.Assign})
+ out = append(out, newToken(lang.Assign, 0))
}
return out, err
}