moved a subset of source file to the kern package

This commit is contained in:
2026-04-27 19:43:37 +02:00
parent f100adead3
commit 4d910dd069
107 changed files with 2080 additions and 1380 deletions
+11 -7
View File
@@ -4,7 +4,11 @@
// operator-builtin.go
package expr
import "io"
import (
"io"
"git.portale-stac.it/go-pkg/expr/kern"
)
//-------- builtin term
@@ -18,7 +22,7 @@ func newBuiltinTerm(tk *Token) (inst *term) {
}
}
func evalBuiltin(ctx ExprContext, opTerm *term) (v any, err error) {
func evalBuiltin(ctx kern.ExprContext, opTerm *term) (v any, err error) {
var childValue any
if childValue, err = opTerm.evalPrefix(ctx); err != nil {
@@ -26,25 +30,25 @@ func evalBuiltin(ctx ExprContext, opTerm *term) (v any, err error) {
}
count := 0
if IsString(childValue) {
if kern.IsString(childValue) {
module, _ := childValue.(string)
count, err = ImportInContextByGlobPattern(module)
count, err = ImportInContextByGlobPattern(ctx, module)
} else {
var moduleSpec any
var it Iterator
var it kern.Iterator
if it, err = NewIterator(childValue); err != nil {
return
}
for moduleSpec, err = it.Next(); err == nil; moduleSpec, err = it.Next() {
if module, ok := moduleSpec.(string); ok {
if ImportInContext(module) {
if ImportInContext(ctx, module) {
count++
} else {
err = opTerm.Errorf("unknown builtin module %q", module)
break
}
} else {
err = opTerm.Errorf("expected string at item nr %d, got %s", it.Index()+1, TypeName(moduleSpec))
err = opTerm.Errorf("expected string at item nr %d, got %s", it.Index()+1, kern.TypeName(moduleSpec))
break
}
}