28 lines
508 B
Go
28 lines
508 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,
|
|
children: make([]*term, 0, 2),
|
|
position: posInfix,
|
|
priority: priBut,
|
|
evalFunc: evalBut,
|
|
}
|
|
}
|
|
|
|
func evalBut(ctx ExprContext, opTerm *term) (v any, err error) {
|
|
_, v, err = opTerm.evalInfix(ctx)
|
|
return
|
|
}
|
|
|
|
// init
|
|
func init() {
|
|
registerTermConstructor(SymKwBut, newButTerm)
|
|
}
|