diff --git a/ast.go b/ast.go index cde43ec..50171d0 100644 --- a/ast.go +++ b/ast.go @@ -119,7 +119,7 @@ func (self *ast) eval(ctx ExprContext, preset bool) (result any, err error) { if self.forest != nil { for _, root := range self.forest { if result, err = root.compute(ctx); err == nil { - ctx.SetVar(control_last_result, result) + ctx.SetVar(ControlLastResult, result) } else { //err = fmt.Errorf("error in expression nr %d: %v", i+1, err) break diff --git a/control.go b/control.go index d8b07ee..f6ac68d 100644 --- a/control.go +++ b/control.go @@ -5,9 +5,9 @@ import "strings" // Preset control variables const ( - control_last_result = "_last" - control_bool_shortcut = "_bool_shortcut" - control_import_path = "_import_path" + ControlLastResult = "last" + ControlBoolShortcut = "_bool_shortcut" + ControlImportPath = "_import_path" ) // Other control variables @@ -21,8 +21,8 @@ const ( ) func initDefaultVars(ctx ExprContext) { - ctx.SetVar(control_bool_shortcut, true) - ctx.SetVar(control_import_path, init_import_path) + ctx.SetVar(ControlBoolShortcut, true) + ctx.SetVar(ControlImportPath, init_import_path) } func enable(ctx ExprContext, name string) { diff --git a/func-import.go b/func-import.go index 53df859..1b4cd8c 100644 --- a/func-import.go +++ b/func-import.go @@ -51,7 +51,7 @@ func addEnvImportDirs(dirList []string) []string { } func addPresetImportDirs(ctx ExprContext, dirList []string) []string { - if dirSpec, exists := getControlString(ctx, control_import_path); exists { + if dirSpec, exists := getControlString(ctx, ControlImportPath); exists { dirs := strings.Split(dirSpec, ":") if dirList == nil { dirList = dirs diff --git a/operator-bool.go b/operator-bool.go index d390e91..51ad1d8 100644 --- a/operator-bool.go +++ b/operator-bool.go @@ -48,7 +48,7 @@ func newAndTerm(tk *Token) (inst *term) { } func evalAnd(ctx ExprContext, self *term) (v any, err error) { - if isEnabled(ctx, control_bool_shortcut) { + if isEnabled(ctx, ControlBoolShortcut) { v, err = evalAndWithShortcut(ctx, self) } else { v, err = evalAndWithoutShortcut(ctx, self) @@ -117,7 +117,7 @@ func newOrTerm(tk *Token) (inst *term) { } func evalOr(ctx ExprContext, self *term) (v any, err error) { - if isEnabled(ctx, control_bool_shortcut) { + if isEnabled(ctx, ControlBoolShortcut) { v, err = evalOrWithShortcut(ctx, self) } else { v, err = evalOrWithoutShortcut(ctx, self)