New operators 'but' and assignment ('=')
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
// 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)
|
||||
}
|
||||
Reference in New Issue
Block a user