moved a subset of source file to the kern package
This commit is contained in:
+9
-5
@@ -4,11 +4,15 @@
|
||||
// operand-expr.go
|
||||
package expr
|
||||
|
||||
import "fmt"
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"git.portale-stac.it/go-pkg/expr/kern"
|
||||
)
|
||||
|
||||
// -------- expr term
|
||||
func newExprTerm(root *term) *term {
|
||||
tk := NewValueToken(root.tk.row, root.tk.col, SymExpression, root.source(), root)
|
||||
tk := NewValueToken(root.tk.row, root.tk.col, SymExpression, root.Source(), root)
|
||||
return &term{
|
||||
tk: *tk,
|
||||
parent: nil,
|
||||
@@ -20,9 +24,9 @@ func newExprTerm(root *term) *term {
|
||||
}
|
||||
|
||||
// -------- eval expr
|
||||
func evalExpr(ctx ExprContext, opTerm *term) (v any, err error) {
|
||||
if expr, ok := opTerm.value().(*term); ok {
|
||||
v, err = expr.compute(ctx)
|
||||
func evalExpr(ctx kern.ExprContext, opTerm *term) (v any, err error) {
|
||||
if ast, ok := opTerm.value().(*term); ok {
|
||||
v, err = ast.Compute(ctx)
|
||||
} else {
|
||||
err = fmt.Errorf("expression expected, got %T", opTerm.value())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user