moved scanner sources to package 'scan'

This commit is contained in:
2026-05-03 14:19:17 +02:00
parent f63ff5953e
commit 7f34ccf955
66 changed files with 1793 additions and 1726 deletions
+12 -11
View File
@@ -8,24 +8,25 @@ import (
"fmt"
"git.portale-stac.it/go-pkg/expr/kern"
"git.portale-stac.it/go-pkg/expr/scan"
)
// -------- variable term
func newVarTerm(tk *Token) *term {
t := &term{
tk: *tk,
parent: nil,
children: nil,
position: posLeaf,
priority: priValue,
evalFunc: evalVar,
func newVarTerm(tk *scan.Token) *scan.Term {
t := &scan.Term{
Tk: *tk,
Parent: nil,
Children: nil,
Position: scan.PosLeaf,
Priority: scan.PriValue,
EvalFunc: evalVar,
}
t.tk.Sym = SymVariable
t.Tk.Sym = scan.SymVariable
return t
}
// -------- eval func
func evalVar(ctx kern.ExprContext, opTerm *term) (v any, err error) {
func evalVar(ctx kern.ExprContext, opTerm *scan.Term) (v any, err error) {
var exists bool
name := opTerm.Source()
if v, exists = ctx.GetVar(name); !exists {
@@ -40,5 +41,5 @@ func evalVar(ctx kern.ExprContext, opTerm *term) (v any, err error) {
// init
func init() {
registerTermConstructor(SymIdentifier, newVarTerm)
scan.RegisterTermConstructor(scan.SymIdentifier, newVarTerm)
}