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
+9 -5
View File
@@ -4,6 +4,10 @@
// operator-include.go
package expr
import (
"git.portale-stac.it/go-pkg/expr/kern"
)
//-------- include term
func newIncludeTerm(tk *Token) (inst *term) {
@@ -16,7 +20,7 @@ func newIncludeTerm(tk *Token) (inst *term) {
}
}
func evalInclude(ctx ExprContext, opTerm *term) (v any, err error) {
func evalInclude(ctx kern.ExprContext, opTerm *term) (v any, err error) {
var childValue any
if childValue, err = opTerm.evalPrefix(ctx); err != nil {
@@ -24,8 +28,8 @@ func evalInclude(ctx ExprContext, opTerm *term) (v any, err error) {
}
count := 0
if IsList(childValue) {
list, _ := childValue.(*ListType)
if kern.IsList(childValue) {
list, _ := childValue.(*kern.ListType)
for i, filePathSpec := range *list {
if filePath, ok := filePathSpec.(string); ok {
if v, err = EvalFile(ctx, filePath); err == nil {
@@ -39,13 +43,13 @@ func evalInclude(ctx ExprContext, opTerm *term) (v any, err error) {
break
}
}
} else if IsString(childValue) {
} else if kern.IsString(childValue) {
filePath, _ := childValue.(string)
if v, err = EvalFile(ctx, filePath); err == nil {
count++
}
} else {
err = opTerm.errIncompatibleType(childValue)
err = opTerm.errIncompatiblePrefixPostfixType(childValue)
}
if err != nil {
//v = count