diff options
| author | Paul Buetow <paul@buetow.org> | 2026-05-24 00:45:02 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-05-24 00:45:02 +0300 |
| commit | 226eeaa912df006f2a279b6bc2ccaf72f9a74217 (patch) | |
| tree | 70409ff927cb5f62b0879d8c612ef7d29c4ed020 | |
| parent | 2a947d40d7705ae166337adcc911ce6e3a0ed1f2 (diff) | |
docs(rpn): fix misleading comments in operations_variables.go
- AssignVariable: remove false 'Usage: name value =' claim; the = operator
uses AssignLeft, not AssignVariable (which is only used in tests).
- UseVariable: remove false 'Usage: varname' claim; this method is not wired
into the operator registry and is only used in tests.
- AssignLeft: update to note it handles both = and =: operators, not just =:.
| -rw-r--r-- | internal/rpn/operations_variables.go | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/internal/rpn/operations_variables.go b/internal/rpn/operations_variables.go index bf0c469..da233d8 100644 --- a/internal/rpn/operations_variables.go +++ b/internal/rpn/operations_variables.go @@ -8,7 +8,9 @@ import "fmt" // variables operations // AssignVariable assigns a value from stack to a variable. -// Usage: `name value =` +// This is a direct API method that takes the variable name as a parameter +// and pops the value from the stack. It is not the handler for the `=` operator; +// use AssignLeft (for `=` and `=:`) or AssignRight (for `:=`) instead. func (o *Operations) AssignVariable(stack *Stack, name string) error { if name == "" { return fmt.Errorf("variable name cannot be empty") @@ -32,7 +34,8 @@ func (o *Operations) AssignVariable(stack *Stack, name string) error { } // UseVariable pushes a variable's value onto the stack. -// Usage: `varname` (pushes stored value) +// This is a direct API method that takes the variable name as a parameter. +// It is not wired into the operator registry. func (o *Operations) UseVariable(stack *Stack, name string) error { if name == "" { return fmt.Errorf("variable name cannot be empty") @@ -74,7 +77,7 @@ func (o *Operations) ClearVariables() { o.vars.ClearVariables() } -// AssignLeft assigns a value to a variable (for =: operator). +// AssignLeft assigns a value to a variable (for = and =: operators). // Stack order: value name =: (value on bottom, name on top). // This function pops name first (top of stack), then value. // Usage: `value name =:` (e.g., `5 x =:`) |
