From f29b1f13b1676e423c5d6a13faeb4e8df1a9ed9a Mon Sep 17 00:00:00 2001 From: Celestino Amoroso Date: Tue, 2 Apr 2024 05:00:48 +0200 Subject: [PATCH] preset definitions and functions were moved to the new preset.go file --- ast.go | 35 ----------------------------------- 1 file changed, 35 deletions(-) diff --git a/ast.go b/ast.go index 8aadfd4..704ab0b 100644 --- a/ast.go +++ b/ast.go @@ -124,38 +124,3 @@ func (self *ast) Eval(ctx exprContext, preset bool) (result any, err error) { } return } - -// Preset variables -const ( - preset_last_result = "_last" - preset_bool_shortcut = "_bool_shortcut" -) - -func initDefaultVars(ctx exprContext) { - ctx.SetValue(preset_bool_shortcut, true) -} - -func enable(ctx exprContext, name string) { - if strings.HasPrefix(name, "_") { - ctx.SetValue(name, true) - } else { - ctx.SetValue("_"+name, true) - } -} - -func disable(ctx exprContext, name string) { - if strings.HasPrefix(name, "_") { - ctx.SetValue(name, false) - } else { - ctx.SetValue("_"+name, false) - } -} - -func isEnabled(ctx exprContext, name string) (status bool) { - if v, exists := ctx.GetValue(name); exists { - if b, ok := v.(bool); ok { - status = b - } - } - return -}