From 4188db97bcb771c1c8790ddbac2db3f9ee8884c3 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 24 May 2026 18:48:05 +0300 Subject: fix(rpn): define OperatorRegistryProvider interface to fix DIP violation (task nk) --- internal/rpn/operations_interfaces.go | 9 +++++++++ internal/rpn/rpn_state.go | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) 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 } -- cgit v1.2.3