feat: allow Range objects as list subscript operator arguments

Extend the list subscript operator to accept Range arguments in addition to plain numbers. When a Range is provided, the operator returns a new list containing the elements within that range, supporting inclusive (..) and exclusive (...) bounds, negative indices that count from the end, and automatic reversal for backwards ranges. Added validation functions for integer values and range bounds, with dedicated error messages for non-integer range endpoints and out-of-bounds conditions. Updated the test suite with comprehensive range subscript tests and removed the old test that only checked for non-numeric subscripts.
This commit is contained in:
Bob Nystrom
2014-01-30 17:12:44 +00:00
parent 1464007327
commit 1607b6d2dd
13 changed files with 133 additions and 28 deletions
+1 -1
View File
@@ -41,7 +41,7 @@ prep:
mkdir -p build/debug build/release
# Run the tests against the debug build of Wren.
test: wrend
test: debug
@./script/test.py
# Generate the Wren site.