// Copyright (c) 2024 Celestino Amoroso (celestino.amoroso@gmail.com). // All rights reserved. // operand-const.go package expr // -------- const term func newConstTerm(tk *Token) *term { return &term{ tk: *tk, parent: nil, children: nil, position: posLeaf, priority: priValue, evalFunc: evalConst, } } // -------- eval func func evalConst(ctx ExprContext, self *term) (v any, err error) { v = self.tk.Value return } // init func init() { registerTermConstructor(SymString, newConstTerm) registerTermConstructor(SymInteger, newConstTerm) registerTermConstructor(SymFloat, newConstTerm) registerTermConstructor(SymBool, newConstTerm) registerTermConstructor(SymKwNil, newConstTerm) }