From fc071785f821395cf213d760654abb4f115f119c Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 24 May 2026 10:32:34 +0300 Subject: rpn: replace fragile error message parsing with direct registry check In handleOperator, replace strings.Contains(err.Error(), "unknown token") with a direct check against opRegistry.IsStandardOperator and opRegistry.IsHyperOperator. This is robust against future changes to error message text. --- internal/rpn/rpn_parse.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/rpn/rpn_parse.go b/internal/rpn/rpn_parse.go index 4035e3d..0d96d3f 100644 --- a/internal/rpn/rpn_parse.go +++ b/internal/rpn/rpn_parse.go @@ -407,7 +407,7 @@ func (r *RPN) handleOperator(stack *Stack, token string, tokenIndex int) (string // If it's an unknown token error and we're at the evaluate stage, // it might be a bare identifier that should be a symbol // Check if the caller is the main evaluate loop - if strings.Contains(err.Error(), "unknown token") { + if !r.opRegistry.IsStandardOperator(token) && !r.opRegistry.IsHyperOperator(token) { // For bare identifiers, push a Symbol instead of returning error // But only if it looks like a valid identifier (alphanumeric/underscore, starts with letter/_) // Don't push symbols for tokens with special characters like %, ., etc. -- cgit v1.2.3