Description
Parse and store array base index (0 or 1) per ECMA-55 specification.
OPTION BASE sets the lower bound for all array subscripts. Must be called before any arrays are allocated.
ECMA-55 References
- ECMA55-ARR-001: OPTION BASE 0 or OPTION BASE 1
- ECMA55-ARR-002: Must appear before any DIM statements
Acceptance Criteria
Tests to Write First
// Valid cases
OPTION BASE 0 → sets base to 0
OPTION BASE 1 → sets base to 1
// Invalid cases
OPTION BASE 2 → syntax error
OPTION BASE -1 → syntax error
OPTION BASE 0, then OPTION BASE 1 → error (duplicate)
// Default behavior
No OPTION BASE → defaults to 0
// Timing error
DIM A(10), then OPTION BASE 1 → error (too late)
Implementation Tasks
Files Affected
- src/ECMABasic.Domain/IEnvironment.cs
- src/ECMABasic.Application/Parsers/OptionBaseStatementParser.cs
- src/ECMABasic.Application/EnvironmentBase.cs
- test/ECMABasic.Test/OptionBaseStatementTests.cs
Parent Issue
Part of #38 - Implement DIM and OPTION BASE for array support
Estimated Effort
2-3 hours
Dependencies
None - this is the foundation for array support
Description
Parse and store array base index (0 or 1) per ECMA-55 specification.
OPTION BASE sets the lower bound for all array subscripts. Must be called before any arrays are allocated.
ECMA-55 References
Acceptance Criteria
Tests to Write First
Implementation Tasks
Files Affected
Parent Issue
Part of #38 - Implement DIM and OPTION BASE for array support
Estimated Effort
2-3 hours
Dependencies
None - this is the foundation for array support