lexpr/options.go
Alexander Kiryukhin 0562659220
initial
2022-06-13 04:31:31 +03:00

30 lines
528 B
Go

package lexpr
type Opt func(*Lexpr)
func WithOperators(operators map[string]Operator) Opt {
return func(l *Lexpr) {
l.operators = operators
}
}
func WithFunctions(functions map[string]func(ts *TokenStack) error) Opt {
return func(l *Lexpr) {
l.functions = functions
}
}
func WithValues(variables map[string]any) Opt {
return func(l *Lexpr) {
l.variables = variables
}
}
func WithDefaults() Opt {
return func(l *Lexpr) {
l.operators = Operators
l.functions = Functions
l.variables = map[string]any{}
}
}