| Age | Commit message (Collapse) | Author |
|
|
|
|
|
- Added 'SPDX-License-Identifier: MIT' and 'Copyright (c) 2026 Paul Buetow' headers
- Files updated: 24 .go files across cmd/gt/, internal/calculator/, internal/repl/, internal/rpn/
The MIT license from LICENSE file is reflected in all source files.
|
|
- Removed duplicate getCommandDescription function from completer.go
- Added package-level getCommandDescription in repl.go as single source of truth
- Updated defaultGetCommandDescription to delegate to getCommandDescription
- Created minimal completer.go that uses getCommandDescription for test compatibility
Command descriptions are now defined only once, eliminating duplication
between the original completer.go and defaultGetCommandDescription in repl.go.
The refactoring maintains:
- Backward compatibility (tests still work)
- Consistent descriptions across the codebase
- Single source of truth for command descriptions
|
|
- Enhanced NewREPL documentation with detailed parameter descriptions
- Enhanced RunREPL documentation clarifying it's a convenience wrapper
- Improved executor documentation explaining backward compatibility and testing usage
- Enhanced defaultExecutor documentation with input processing details and panic recovery
- Enhanced defaultCompleter documentation with tab-completion behavior details
- Enhanced defaultGetCommandDescription documentation with command description details
- Improved TTYChecker methods (IsTTY, EnsureTTY) documentation
- Improved SignalHandler.Start method documentation
All exported and non-exported functions in the REPL package now have comprehensive documentation comments that describe their purpose, parameters, and return values.
|
|
- Move RPNState type definition before any functions
- Move rpnState and rpnStateOnce variable declarations before any functions
- Keep REPL struct and NewREPL constructor at the top (as per Go best practices)
- Update getRPNState comment to be more descriptive
This change follows Go best practices where constants, global variables, and type
definitions should be at the top of the file before functions.
|
|
- Add RPN (Reverse Polish Notation) calculator with stack-based operations
- Support precise rational number calculations using *big.Rat
- Implement chain of responsibility pattern for command handling
- Add auto-completion for built-in commands
- Add history persistence with configurable max entries
- Support standard operators: +, -, *, /, ^, %, lg, log, ln
- Support hyper operators: [+], [-], [*], [/], [^], [%], [lg], [log], [ln]
- Support stack manipulation: dup, swap, pop, show
- Support variable assignments and management
- Add rat mode for switching between float64 and rational calculations
- Refactor calculator to return Calculation struct with formatting
- Add proper version support (v0.3.0)
All changes follow Go best practices with comprehensive test coverage.
|
|
Added defer-recover mechanism to the executor function to catch unexpected panics.
When a panic occurs, a user-friendly error message is displayed and the REPL can continue to function.
This improves the robustness of the REPL when handling unexpected errors.
|
|
- Error wrapping improvements across multiple files
- Thread-safe singleton initialization using sync.Once
- Proper error handling for file close operations
- Removed speculative complexity in history management
- Fixed operator interface design
Audit report: COMPLETE_AUDIT_REPORT.md
|
|
|
|
|
|
|
|
|
|
- Moved public RunREPL function before private functions
- Constructor-like getRPNState immediately follows type definition
- This aligns with project Go best practices for file organization
|
|
- Modified ParseAndEvaluate() to not reset stack at beginning, only initialize if nil
- Changed runRPN() to use getRPNState() for persistent state across calls
- Fixed Stack type definition ordering in variables.go to follow Go best practices
- Updated tests to create fresh RPN instances where independence is needed
This enables REPL-style incremental RPN calculations like '3 4 +' followed by '5 +'.
|
|
- 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
|
|
- Reset currentStack at start of each ParseAndEvaluate call
- This ensures test isolation while allowing incremental operations
- Added tests for EvalOperator for incremental RPN evaluation
- All tests pass, coverage 79.2% for rpn package
|
|
|
|
- Bare expressions like '1 2 +' now work without 'calc' prefix
- Assignment format 'name value =' requires 'calc' subcommand prefix
|
|
- Import rpn package in repl.go
- Add 'rpn' and 'calc' as built-in commands
- Update executor to handle 'rpn <expr>' and 'calc <expr>' commands
- Add rpn/calc descriptions to help text
- All tests pass, go vet passes
|
|
- Add REPL mode with vi keybindings
- Add built-in commands (help, clear, quit/exit)
- Add mage repl target
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|