summaryrefslogtreecommitdiff
path: root/internal/repl
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-20 22:09:19 +0200
committerPaul Buetow <paul@buetow.org>2026-03-20 22:09:19 +0200
commit77c21d86ea4c9b8621af1dcbd64acec7b65706a3 (patch)
tree568f9fa09cc06db113cc57f47e3447e7e3427cb5 /internal/repl
parentc62aef166f1163524fe5d63a5c00571a75731dcf (diff)
refactor: update Operations to use VariableStore interface
- Changed Operations.vars from *Variables to VariableStore interface - Changed NewOperations to accept VariableStore interface - Changed RPN.vars from *Variables to VariableStore interface - Changed NewRPN to accept VariableStore interface - Removed type assertions in main.go and repl.go - Added FormatVariables to VariableStore interface - All tests pass, build successful
Diffstat (limited to 'internal/repl')
-rw-r--r--internal/repl/repl.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/internal/repl/repl.go b/internal/repl/repl.go
index c5a87b1..f79f92f 100644
--- a/internal/repl/repl.go
+++ b/internal/repl/repl.go
@@ -20,7 +20,7 @@ const historyFile = ".perc_history"
// RPNState holds the state for RPN operations in REPL
type RPNState struct {
- vars *rpn.Variables
+ vars rpn.VariableStore
rpnCalc *rpn.RPN
}
@@ -29,7 +29,7 @@ var rpnState *RPNState
// getRPNState returns or creates the RPN state
func getRPNState() *RPNState {
if rpnState == nil {
- vars := rpn.NewVariables().(*rpn.Variables)
+ vars := rpn.NewVariables()
rpnState = &RPNState{
vars: vars,
rpnCalc: rpn.NewRPN(vars),
@@ -109,7 +109,7 @@ func executor(input string) {
// runRPN parses and evaluates an RPN expression
func runRPN(input string) (string, error) {
- vars := rpn.NewVariables().(*rpn.Variables)
+ vars := rpn.NewVariables()
rpnCalc := rpn.NewRPN(vars)
return rpnCalc.ParseAndEvaluate(input)
}