aboutsummaryrefslogblamecommitdiff
path: root/options.go
blob: 591f552992a678cd5159ba553ce81e5ceca94fd8 (plain) (tree)




























                                                                         
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{}
	}
}