class and kind types removed
This commit is contained in:
parent
9ac88bf446
commit
4d94a7ad59
@ -7,9 +7,9 @@ package expr
|
|||||||
// -------- bool const term
|
// -------- bool const term
|
||||||
func newBoolTerm(tk *Token) *term {
|
func newBoolTerm(tk *Token) *term {
|
||||||
return &term{
|
return &term{
|
||||||
tk: *tk,
|
tk: *tk,
|
||||||
class: classConst,
|
// class: classConst,
|
||||||
kind: kindBool,
|
// kind: kindBool,
|
||||||
parent: nil,
|
parent: nil,
|
||||||
children: nil,
|
children: nil,
|
||||||
position: posLeaf,
|
position: posLeaf,
|
||||||
@ -22,8 +22,6 @@ func newBoolTerm(tk *Token) *term {
|
|||||||
func newIntegerTerm(tk *Token) *term {
|
func newIntegerTerm(tk *Token) *term {
|
||||||
return &term{
|
return &term{
|
||||||
tk: *tk,
|
tk: *tk,
|
||||||
class: classConst,
|
|
||||||
kind: kindInteger,
|
|
||||||
parent: nil,
|
parent: nil,
|
||||||
children: nil,
|
children: nil,
|
||||||
position: posLeaf,
|
position: posLeaf,
|
||||||
@ -35,9 +33,9 @@ func newIntegerTerm(tk *Token) *term {
|
|||||||
// -------- float const term
|
// -------- float const term
|
||||||
func newFloatTerm(tk *Token) *term {
|
func newFloatTerm(tk *Token) *term {
|
||||||
return &term{
|
return &term{
|
||||||
tk: *tk,
|
tk: *tk,
|
||||||
class: classConst,
|
// class: classConst,
|
||||||
kind: kindFloat,
|
// kind: kindFloat,
|
||||||
parent: nil,
|
parent: nil,
|
||||||
children: nil,
|
children: nil,
|
||||||
position: posLeaf,
|
position: posLeaf,
|
||||||
@ -49,9 +47,9 @@ func newFloatTerm(tk *Token) *term {
|
|||||||
// -------- string const term
|
// -------- string const term
|
||||||
func newStringTerm(tk *Token) *term {
|
func newStringTerm(tk *Token) *term {
|
||||||
return &term{
|
return &term{
|
||||||
tk: *tk,
|
tk: *tk,
|
||||||
class: classConst,
|
// class: classConst,
|
||||||
kind: kindString,
|
// kind: kindString,
|
||||||
parent: nil,
|
parent: nil,
|
||||||
children: nil,
|
children: nil,
|
||||||
position: posLeaf,
|
position: posLeaf,
|
||||||
|
@ -10,8 +10,6 @@ import "fmt"
|
|||||||
func newExprTerm(tk *Token) *term {
|
func newExprTerm(tk *Token) *term {
|
||||||
return &term{
|
return &term{
|
||||||
tk: *tk,
|
tk: *tk,
|
||||||
class: classVar,
|
|
||||||
kind: kindUnknown,
|
|
||||||
parent: nil,
|
parent: nil,
|
||||||
children: nil,
|
children: nil,
|
||||||
position: posLeaf,
|
position: posLeaf,
|
||||||
|
@ -11,9 +11,9 @@ import (
|
|||||||
// -------- function call term
|
// -------- function call term
|
||||||
func newFuncCallTerm(tk *Token, args []*term) *term {
|
func newFuncCallTerm(tk *Token, args []*term) *term {
|
||||||
return &term{
|
return &term{
|
||||||
tk: *tk,
|
tk: *tk,
|
||||||
class: classVar,
|
// class: classVar,
|
||||||
kind: kindUnknown,
|
// kind: kindUnknown,
|
||||||
parent: nil,
|
parent: nil,
|
||||||
children: args,
|
children: args,
|
||||||
position: posLeaf,
|
position: posLeaf,
|
||||||
@ -71,8 +71,6 @@ func exportFunc(ctx ExprContext, name string, info ExprFunc) {
|
|||||||
func newFuncDefTerm(tk *Token, args []*term) *term {
|
func newFuncDefTerm(tk *Token, args []*term) *term {
|
||||||
return &term{
|
return &term{
|
||||||
tk: *tk,
|
tk: *tk,
|
||||||
class: classVar,
|
|
||||||
kind: kindUnknown,
|
|
||||||
parent: nil,
|
parent: nil,
|
||||||
children: args, // arg[0]=formal-param-list, arg[1]=*ast
|
children: args, // arg[0]=formal-param-list, arg[1]=*ast
|
||||||
position: posLeaf,
|
position: posLeaf,
|
||||||
|
@ -8,8 +8,6 @@ package expr
|
|||||||
func newListTerm(args []*term) *term {
|
func newListTerm(args []*term) *term {
|
||||||
return &term{
|
return &term{
|
||||||
tk: *NewToken(0, 0, SymList, "[]"),
|
tk: *NewToken(0, 0, SymList, "[]"),
|
||||||
class: classVar,
|
|
||||||
kind: kindUnknown,
|
|
||||||
parent: nil,
|
parent: nil,
|
||||||
children: args,
|
children: args,
|
||||||
position: posLeaf,
|
position: posLeaf,
|
||||||
|
@ -17,8 +17,6 @@ func newSelectorCaseTerm(row, col int, filterList *term, caseExpr Expr) *term {
|
|||||||
tk := NewValueToken(row, col, SymSelectorCase, "", &selectorCase{filterList: filterList, caseExpr: caseExpr})
|
tk := NewValueToken(row, col, SymSelectorCase, "", &selectorCase{filterList: filterList, caseExpr: caseExpr})
|
||||||
return &term{
|
return &term{
|
||||||
tk: *tk,
|
tk: *tk,
|
||||||
class: classVar,
|
|
||||||
kind: kindUnknown,
|
|
||||||
parent: nil,
|
parent: nil,
|
||||||
children: nil,
|
children: nil,
|
||||||
position: posLeaf,
|
position: posLeaf,
|
||||||
|
@ -9,9 +9,9 @@ import "fmt"
|
|||||||
// -------- variable term
|
// -------- variable term
|
||||||
func newVarTerm(tk *Token) *term {
|
func newVarTerm(tk *Token) *term {
|
||||||
return &term{
|
return &term{
|
||||||
tk: *tk,
|
tk: *tk,
|
||||||
class: classVar,
|
// class: classVar,
|
||||||
kind: kindUnknown,
|
// kind: kindUnknown,
|
||||||
parent: nil,
|
parent: nil,
|
||||||
children: nil,
|
children: nil,
|
||||||
position: posLeaf,
|
position: posLeaf,
|
||||||
|
@ -9,8 +9,6 @@ package expr
|
|||||||
func newAssignTerm(tk *Token) (inst *term) {
|
func newAssignTerm(tk *Token) (inst *term) {
|
||||||
return &term{
|
return &term{
|
||||||
tk: *tk,
|
tk: *tk,
|
||||||
class: classOperator,
|
|
||||||
kind: kindUnknown,
|
|
||||||
children: make([]*term, 0, 2),
|
children: make([]*term, 0, 2),
|
||||||
position: posInfix,
|
position: posInfix,
|
||||||
priority: priAssign,
|
priority: priAssign,
|
||||||
|
@ -11,8 +11,6 @@ import "fmt"
|
|||||||
func newNotTerm(tk *Token) (inst *term) {
|
func newNotTerm(tk *Token) (inst *term) {
|
||||||
return &term{
|
return &term{
|
||||||
tk: *tk,
|
tk: *tk,
|
||||||
class: classOperator,
|
|
||||||
kind: kindBool,
|
|
||||||
children: make([]*term, 0, 1),
|
children: make([]*term, 0, 1),
|
||||||
position: posPrefix,
|
position: posPrefix,
|
||||||
priority: priNot,
|
priority: priNot,
|
||||||
@ -39,9 +37,9 @@ func evalNot(ctx ExprContext, self *term) (v any, err error) {
|
|||||||
|
|
||||||
func newAndTerm(tk *Token) (inst *term) {
|
func newAndTerm(tk *Token) (inst *term) {
|
||||||
return &term{
|
return &term{
|
||||||
tk: *tk,
|
tk: *tk,
|
||||||
class: classOperator,
|
// class: classOperator,
|
||||||
kind: kindBool,
|
// kind: kindBool,
|
||||||
children: make([]*term, 0, 2),
|
children: make([]*term, 0, 2),
|
||||||
position: posInfix,
|
position: posInfix,
|
||||||
priority: priAnd,
|
priority: priAnd,
|
||||||
@ -108,9 +106,9 @@ func evalAndWithShortcut(ctx ExprContext, self *term) (v any, err error) {
|
|||||||
|
|
||||||
func newOrTerm(tk *Token) (inst *term) {
|
func newOrTerm(tk *Token) (inst *term) {
|
||||||
return &term{
|
return &term{
|
||||||
tk: *tk,
|
tk: *tk,
|
||||||
class: classOperator,
|
// class: classOperator,
|
||||||
kind: kindBool,
|
// kind: kindBool,
|
||||||
children: make([]*term, 0, 2),
|
children: make([]*term, 0, 2),
|
||||||
position: posInfix,
|
position: posInfix,
|
||||||
priority: priOr,
|
priority: priOr,
|
||||||
|
@ -9,8 +9,6 @@ package expr
|
|||||||
func newButTerm(tk *Token) (inst *term) {
|
func newButTerm(tk *Token) (inst *term) {
|
||||||
return &term{
|
return &term{
|
||||||
tk: *tk,
|
tk: *tk,
|
||||||
class: classOperator,
|
|
||||||
kind: kindUnknown,
|
|
||||||
children: make([]*term, 0, 2),
|
children: make([]*term, 0, 2),
|
||||||
position: posInfix,
|
position: posInfix,
|
||||||
priority: priBut,
|
priority: priBut,
|
||||||
|
@ -8,9 +8,9 @@ package expr
|
|||||||
|
|
||||||
func newNullCoalesceTerm(tk *Token) (inst *term) {
|
func newNullCoalesceTerm(tk *Token) (inst *term) {
|
||||||
return &term{
|
return &term{
|
||||||
tk: *tk,
|
tk: *tk,
|
||||||
class: classOperator,
|
// class: classOperator,
|
||||||
kind: kindUnknown,
|
// kind: kindUnknown,
|
||||||
children: make([]*term, 0, 2),
|
children: make([]*term, 0, 2),
|
||||||
position: posInfix,
|
position: posInfix,
|
||||||
priority: priCoalesce,
|
priority: priCoalesce,
|
||||||
@ -48,8 +48,6 @@ func evalNullCoalesce(ctx ExprContext, self *term) (v any, err error) {
|
|||||||
func newCoalesceAssignTerm(tk *Token) (inst *term) {
|
func newCoalesceAssignTerm(tk *Token) (inst *term) {
|
||||||
return &term{
|
return &term{
|
||||||
tk: *tk,
|
tk: *tk,
|
||||||
class: classOperator,
|
|
||||||
kind: kindUnknown,
|
|
||||||
children: make([]*term, 0, 2),
|
children: make([]*term, 0, 2),
|
||||||
position: posInfix,
|
position: posInfix,
|
||||||
priority: priCoalesce,
|
priority: priCoalesce,
|
||||||
|
@ -9,8 +9,6 @@ package expr
|
|||||||
func newExportAllTerm(tk *Token) (inst *term) {
|
func newExportAllTerm(tk *Token) (inst *term) {
|
||||||
return &term{
|
return &term{
|
||||||
tk: *tk,
|
tk: *tk,
|
||||||
class: classOperator,
|
|
||||||
kind: kindUnknown,
|
|
||||||
children: nil,
|
children: nil,
|
||||||
position: posLeaf,
|
position: posLeaf,
|
||||||
priority: priValue,
|
priority: priValue,
|
||||||
|
@ -11,8 +11,6 @@ import "fmt"
|
|||||||
func newFactTerm(tk *Token) (inst *term) {
|
func newFactTerm(tk *Token) (inst *term) {
|
||||||
return &term{
|
return &term{
|
||||||
tk: *tk,
|
tk: *tk,
|
||||||
class: classOperator,
|
|
||||||
kind: kindInteger,
|
|
||||||
children: make([]*term, 0, 1),
|
children: make([]*term, 0, 1),
|
||||||
position: posPostfix,
|
position: posPostfix,
|
||||||
priority: priFact,
|
priority: priFact,
|
||||||
|
@ -13,9 +13,9 @@ import (
|
|||||||
|
|
||||||
func newMultiplyTerm(tk *Token) (inst *term) {
|
func newMultiplyTerm(tk *Token) (inst *term) {
|
||||||
return &term{
|
return &term{
|
||||||
tk: *tk,
|
tk: *tk,
|
||||||
class: classOperator,
|
// class: classOperator,
|
||||||
kind: kindUnknown,
|
// kind: kindUnknown,
|
||||||
children: make([]*term, 0, 2),
|
children: make([]*term, 0, 2),
|
||||||
position: posInfix,
|
position: posInfix,
|
||||||
priority: priProduct,
|
priority: priProduct,
|
||||||
@ -52,9 +52,9 @@ func evalMultiply(ctx ExprContext, self *term) (v any, err error) {
|
|||||||
|
|
||||||
func newDivideTerm(tk *Token) (inst *term) {
|
func newDivideTerm(tk *Token) (inst *term) {
|
||||||
return &term{
|
return &term{
|
||||||
tk: *tk,
|
tk: *tk,
|
||||||
class: classOperator,
|
// class: classOperator,
|
||||||
kind: kindUnknown,
|
// kind: kindUnknown,
|
||||||
children: make([]*term, 0, 2),
|
children: make([]*term, 0, 2),
|
||||||
position: posInfix,
|
position: posInfix,
|
||||||
priority: priProduct,
|
priority: priProduct,
|
||||||
@ -96,8 +96,6 @@ func evalDivide(ctx ExprContext, self *term) (v any, err error) {
|
|||||||
func newDivideAsFloatTerm(tk *Token) (inst *term) {
|
func newDivideAsFloatTerm(tk *Token) (inst *term) {
|
||||||
return &term{
|
return &term{
|
||||||
tk: *tk,
|
tk: *tk,
|
||||||
class: classOperator,
|
|
||||||
kind: kindUnknown,
|
|
||||||
children: make([]*term, 0, 2),
|
children: make([]*term, 0, 2),
|
||||||
position: posInfix,
|
position: posInfix,
|
||||||
priority: priProduct,
|
priority: priProduct,
|
||||||
@ -129,9 +127,9 @@ func evalDivideAsFloat(ctx ExprContext, self *term) (v any, err error) {
|
|||||||
|
|
||||||
func newReminderTerm(tk *Token) (inst *term) {
|
func newReminderTerm(tk *Token) (inst *term) {
|
||||||
return &term{
|
return &term{
|
||||||
tk: *tk,
|
tk: *tk,
|
||||||
class: classOperator,
|
// class: classOperator,
|
||||||
kind: kindUnknown,
|
// kind: kindUnknown,
|
||||||
children: make([]*term, 0, 2),
|
children: make([]*term, 0, 2),
|
||||||
position: posInfix,
|
position: posInfix,
|
||||||
priority: priProduct,
|
priority: priProduct,
|
||||||
|
@ -8,9 +8,9 @@ package expr
|
|||||||
|
|
||||||
func newEqualTerm(tk *Token) (inst *term) {
|
func newEqualTerm(tk *Token) (inst *term) {
|
||||||
return &term{
|
return &term{
|
||||||
tk: *tk,
|
tk: *tk,
|
||||||
class: classOperator,
|
// class: classOperator,
|
||||||
kind: kindBool,
|
// kind: kindBool,
|
||||||
children: make([]*term, 0, 2),
|
children: make([]*term, 0, 2),
|
||||||
position: posInfix,
|
position: posInfix,
|
||||||
priority: priRelational,
|
priority: priRelational,
|
||||||
@ -47,9 +47,9 @@ func evalEqual(ctx ExprContext, self *term) (v any, err error) {
|
|||||||
|
|
||||||
func newNotEqualTerm(tk *Token) (inst *term) {
|
func newNotEqualTerm(tk *Token) (inst *term) {
|
||||||
return &term{
|
return &term{
|
||||||
tk: *tk,
|
tk: *tk,
|
||||||
class: classOperator,
|
// class: classOperator,
|
||||||
kind: kindBool,
|
// kind: kindBool,
|
||||||
children: make([]*term, 0, 2),
|
children: make([]*term, 0, 2),
|
||||||
position: posInfix,
|
position: posInfix,
|
||||||
priority: priRelational,
|
priority: priRelational,
|
||||||
@ -94,9 +94,9 @@ func evalNotEqual(ctx ExprContext, self *term) (v any, err error) {
|
|||||||
|
|
||||||
func newLessTerm(tk *Token) (inst *term) {
|
func newLessTerm(tk *Token) (inst *term) {
|
||||||
return &term{
|
return &term{
|
||||||
tk: *tk,
|
tk: *tk,
|
||||||
class: classOperator,
|
// class: classOperator,
|
||||||
kind: kindBool,
|
// kind: kindBool,
|
||||||
children: make([]*term, 0, 2),
|
children: make([]*term, 0, 2),
|
||||||
position: posInfix,
|
position: posInfix,
|
||||||
priority: priRelational,
|
priority: priRelational,
|
||||||
@ -134,8 +134,6 @@ func evalLess(ctx ExprContext, self *term) (v any, err error) {
|
|||||||
func newLessEqualTerm(tk *Token) (inst *term) {
|
func newLessEqualTerm(tk *Token) (inst *term) {
|
||||||
return &term{
|
return &term{
|
||||||
tk: *tk,
|
tk: *tk,
|
||||||
class: classOperator,
|
|
||||||
kind: kindUnknown,
|
|
||||||
children: make([]*term, 0, 2),
|
children: make([]*term, 0, 2),
|
||||||
position: posInfix,
|
position: posInfix,
|
||||||
priority: priRelational,
|
priority: priRelational,
|
||||||
@ -172,9 +170,9 @@ func evalLessEqual(ctx ExprContext, self *term) (v any, err error) {
|
|||||||
|
|
||||||
func newGreaterTerm(tk *Token) (inst *term) {
|
func newGreaterTerm(tk *Token) (inst *term) {
|
||||||
return &term{
|
return &term{
|
||||||
tk: *tk,
|
tk: *tk,
|
||||||
class: classOperator,
|
// class: classOperator,
|
||||||
kind: kindBool,
|
// kind: kindBool,
|
||||||
children: make([]*term, 0, 2),
|
children: make([]*term, 0, 2),
|
||||||
position: posInfix,
|
position: posInfix,
|
||||||
priority: priRelational,
|
priority: priRelational,
|
||||||
@ -194,9 +192,9 @@ func evalGreater(ctx ExprContext, self *term) (v any, err error) {
|
|||||||
|
|
||||||
func newGreaterEqualTerm(tk *Token) (inst *term) {
|
func newGreaterEqualTerm(tk *Token) (inst *term) {
|
||||||
return &term{
|
return &term{
|
||||||
tk: *tk,
|
tk: *tk,
|
||||||
class: classOperator,
|
// class: classOperator,
|
||||||
kind: kindBool,
|
// kind: kindBool,
|
||||||
children: make([]*term, 0, 2),
|
children: make([]*term, 0, 2),
|
||||||
position: posInfix,
|
position: posInfix,
|
||||||
priority: priRelational,
|
priority: priRelational,
|
||||||
|
@ -9,8 +9,6 @@ package expr
|
|||||||
func newSelectorTerm(tk *Token) (inst *term) {
|
func newSelectorTerm(tk *Token) (inst *term) {
|
||||||
return &term{
|
return &term{
|
||||||
tk: *tk,
|
tk: *tk,
|
||||||
class: classOperator,
|
|
||||||
kind: kindUnknown,
|
|
||||||
children: make([]*term, 0, 3),
|
children: make([]*term, 0, 3),
|
||||||
position: posMultifix,
|
position: posMultifix,
|
||||||
priority: priSelector,
|
priority: priSelector,
|
||||||
|
@ -8,9 +8,9 @@ package expr
|
|||||||
|
|
||||||
func newPlusSignTerm(tk *Token) (inst *term) {
|
func newPlusSignTerm(tk *Token) (inst *term) {
|
||||||
return &term{
|
return &term{
|
||||||
tk: *tk,
|
tk: *tk,
|
||||||
class: classOperator,
|
// class: classOperator,
|
||||||
kind: kindUnknown,
|
// kind: kindUnknown,
|
||||||
children: make([]*term, 0, 1),
|
children: make([]*term, 0, 1),
|
||||||
position: posPrefix,
|
position: posPrefix,
|
||||||
priority: priSign,
|
priority: priSign,
|
||||||
@ -21,8 +21,6 @@ func newPlusSignTerm(tk *Token) (inst *term) {
|
|||||||
func newMinusSignTerm(tk *Token) (inst *term) {
|
func newMinusSignTerm(tk *Token) (inst *term) {
|
||||||
return &term{
|
return &term{
|
||||||
tk: *tk,
|
tk: *tk,
|
||||||
class: classOperator,
|
|
||||||
kind: kindUnknown,
|
|
||||||
children: make([]*term, 0, 1),
|
children: make([]*term, 0, 1),
|
||||||
position: posPrefix,
|
position: posPrefix,
|
||||||
priority: priSign,
|
priority: priSign,
|
||||||
|
@ -14,8 +14,6 @@ import (
|
|||||||
func newPlusTerm(tk *Token) (inst *term) {
|
func newPlusTerm(tk *Token) (inst *term) {
|
||||||
return &term{
|
return &term{
|
||||||
tk: *tk,
|
tk: *tk,
|
||||||
class: classOperator,
|
|
||||||
kind: kindUnknown,
|
|
||||||
children: make([]*term, 0, 2),
|
children: make([]*term, 0, 2),
|
||||||
position: posInfix,
|
position: posInfix,
|
||||||
priority: priSum,
|
priority: priSum,
|
||||||
@ -67,9 +65,9 @@ func evalPlus(ctx ExprContext, self *term) (v any, err error) {
|
|||||||
|
|
||||||
func newMinusTerm(tk *Token) (inst *term) {
|
func newMinusTerm(tk *Token) (inst *term) {
|
||||||
return &term{
|
return &term{
|
||||||
tk: *tk,
|
tk: *tk,
|
||||||
class: classOperator,
|
// class: classOperator,
|
||||||
kind: kindUnknown,
|
// kind: kindUnknown,
|
||||||
children: make([]*term, 0, 2),
|
children: make([]*term, 0, 2),
|
||||||
position: posInfix,
|
position: posInfix,
|
||||||
priority: priSum,
|
priority: priSum,
|
||||||
|
37
term.go
37
term.go
@ -8,27 +8,6 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
type termKind uint16
|
|
||||||
|
|
||||||
const (
|
|
||||||
kindUnknown termKind = iota
|
|
||||||
kindBool
|
|
||||||
kindInteger
|
|
||||||
kindFloat
|
|
||||||
kindString
|
|
||||||
kindIdentifier
|
|
||||||
)
|
|
||||||
|
|
||||||
type termClass uint16
|
|
||||||
|
|
||||||
const (
|
|
||||||
classNull termClass = iota
|
|
||||||
classConst
|
|
||||||
classVar
|
|
||||||
classFunc
|
|
||||||
classOperator
|
|
||||||
)
|
|
||||||
|
|
||||||
type termPriority uint32
|
type termPriority uint32
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -60,23 +39,11 @@ const (
|
|||||||
|
|
||||||
type evalFuncType func(ctx ExprContext, self *term) (v any, err error)
|
type evalFuncType func(ctx ExprContext, self *term) (v any, err error)
|
||||||
|
|
||||||
// type iterm interface {
|
|
||||||
// getClass() termClass
|
|
||||||
// getKind() termKind
|
|
||||||
// compute(ctx exprContext) (v any, err error)
|
|
||||||
// // isOperator() bool
|
|
||||||
// // isOperand() bool
|
|
||||||
// source() string
|
|
||||||
// setParent(parentNode term)
|
|
||||||
// }
|
|
||||||
|
|
||||||
type term struct {
|
type term struct {
|
||||||
tk Token
|
tk Token
|
||||||
class termClass
|
|
||||||
kind termKind
|
|
||||||
parent *term
|
parent *term
|
||||||
children []*term
|
children []*term
|
||||||
position termPosition // operator position: infix, prefix, suffix
|
position termPosition // operator position: leaf, infix, prefix, postfix, multifix
|
||||||
priority termPriority // operator priority: higher value means higher priority
|
priority termPriority // operator priority: higher value means higher priority
|
||||||
evalFunc evalFuncType
|
evalFunc evalFuncType
|
||||||
}
|
}
|
||||||
@ -169,7 +136,7 @@ func (self *term) value() any {
|
|||||||
|
|
||||||
func (self *term) compute(ctx ExprContext) (v any, err error) {
|
func (self *term) compute(ctx ExprContext) (v any, err error) {
|
||||||
if self.evalFunc == nil {
|
if self.evalFunc == nil {
|
||||||
err = self.tk.Errorf("undefined eval-func for %v term type", self.kind)
|
err = self.tk.Errorf("undefined eval-func for %q term", self.source())
|
||||||
} else {
|
} else {
|
||||||
v, err = self.evalFunc(ctx, self)
|
v, err = self.evalFunc(ctx, self)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user