class and kind types removed
This commit is contained in:
@@ -8,27 +8,6 @@ import (
|
||||
"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
|
||||
|
||||
const (
|
||||
@@ -60,23 +39,11 @@ const (
|
||||
|
||||
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 {
|
||||
tk Token
|
||||
class termClass
|
||||
kind termKind
|
||||
parent *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
|
||||
evalFunc evalFuncType
|
||||
}
|
||||
@@ -169,7 +136,7 @@ func (self *term) value() any {
|
||||
|
||||
func (self *term) compute(ctx ExprContext) (v any, err error) {
|
||||
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 {
|
||||
v, err = self.evalFunc(ctx, self)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user