30 lines
556 B
Go
30 lines
556 B
Go
|
// Copyright (c) 2024 Celestino Amoroso (celestino.amoroso@gmail.com).
|
||
|
// All rights reserved.
|
||
|
|
||
|
// operator-but.go
|
||
|
package expr
|
||
|
|
||
|
//-------- but term
|
||
|
|
||
|
func newButTerm(tk *Token) (inst *term) {
|
||
|
return &term{
|
||
|
tk: *tk,
|
||
|
class: classOperator,
|
||
|
kind: kindUnknown,
|
||
|
children: make([]*term, 0, 2),
|
||
|
position: posInfix,
|
||
|
priority: priBut,
|
||
|
evalFunc: evalBut,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func evalBut(ctx exprContext, self *term) (v any, err error) {
|
||
|
_, v, err = self.evalInfix(ctx)
|
||
|
return
|
||
|
}
|
||
|
|
||
|
// init
|
||
|
func init() {
|
||
|
registerTermConstructor(SymKwBut, newButTerm)
|
||
|
}
|