diff options
| author | Paul Buetow <paul@buetow.org> | 2026-05-24 18:48:05 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-05-24 18:48:05 +0300 |
| commit | 4188db97bcb771c1c8790ddbac2db3f9ee8884c3 (patch) | |
| tree | 493e88ccd30232dc7b5105b0067764183721511c | |
| parent | a03e4511536a3cdafb51e187aa3bb9df764e8fec (diff) | |
fix(rpn): define OperatorRegistryProvider interface to fix DIP violation (task nk)
| -rw-r--r-- | internal/rpn/operations_interfaces.go | 9 | ||||
| -rw-r--r-- | internal/rpn/rpn_state.go | 2 |
2 files changed, 10 insertions, 1 deletions
diff --git a/internal/rpn/operations_interfaces.go b/internal/rpn/operations_interfaces.go index e659644..f317f8a 100644 --- a/internal/rpn/operations_interfaces.go +++ b/internal/rpn/operations_interfaces.go @@ -152,6 +152,15 @@ type OperationsProvider interface { CustomMetricManager } +// OperatorRegistryProvider defines the methods RPN needs from the operator registry. +// RPN depends on this interface (DIP) rather than the concrete *OperatorRegistry type. +type OperatorRegistryProvider interface { + IsStandardOperator(token string) bool + IsHyperOperator(token string) bool + HandleStandardOperator(stack *Stack, token string) (string, bool, error) + HandleHyperOperator(stack *Stack, token string) (string, bool, error) +} + // Operator implementations are split across focused sub-interfaces // (ArithmeticOperator, LogarithmicOperator, MetricOperator, BooleanOperator, // HyperOperator, StackOperator, VariableOperator, ConstantOperator, diff --git a/internal/rpn/rpn_state.go b/internal/rpn/rpn_state.go index a42372a..f2cc4ed 100644 --- a/internal/rpn/rpn_state.go +++ b/internal/rpn/rpn_state.go @@ -15,7 +15,7 @@ type RPN struct { vars VariableStore consts ConstantsProvider ops OperationsProvider - opRegistry *OperatorRegistry + opRegistry OperatorRegistryProvider maxStack int currentStack *Stack } |
