summaryrefslogtreecommitdiff
path: root/internal/repl
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-26 09:12:21 +0200
committerPaul Buetow <paul@buetow.org>2026-03-26 09:12:21 +0200
commit1eb967082ac29d6833a87733ac5bbafd41399468 (patch)
treeb856ce0cc3d93742ae3e595f4e74ceba6d611635 /internal/repl
parentdd7fb519b25b75a8a33868c835ddf0b991ef8c24 (diff)
feat: Add integration tests for variable assignments and fix RPN parser bugs
Diffstat (limited to 'internal/repl')
-rw-r--r--internal/repl/handlers.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/internal/repl/handlers.go b/internal/repl/handlers.go
index 663fd84..6647f3d 100644
--- a/internal/repl/handlers.go
+++ b/internal/repl/handlers.go
@@ -200,6 +200,19 @@ func (h *RPNHandler) Handle(repl *REPL, input string) (output string, handled bo
return result, true, nil
}
}
+
+ // Check if input is a symbol syntax (:x) - valid RPN that pushes a symbol
+ if len(fields) == 1 {
+ token := fields[0]
+ if len(token) > 0 && token[0] == ':' {
+ // This is a symbol syntax like :x
+ result, err := state.rpnCalc.ParseAndEvaluate(token)
+ if err != nil {
+ return "", true, err
+ }
+ return result, true, nil
+ }
+ }
}
return h.Next(repl, input)