Issue #621. Added the ability to leave the start and end index off of arrays. list[5..] is now valid CoffeeScript, slicing to the end of the array.

This commit is contained in:
Jeremy Ashkenas
2010-08-18 21:51:44 -04:00
parent bf6bafa3ac
commit 4ddd65a4c4
6 changed files with 145 additions and 104 deletions

View File

@@ -348,6 +348,10 @@ grammar =
Slice: [
o "INDEX_START Expression . . Expression INDEX_END", -> new RangeNode $2, $5
o "INDEX_START Expression . . . Expression INDEX_END", -> new RangeNode $2, $6, true
o "INDEX_START Expression . . INDEX_END", -> new RangeNode $2, null
o "INDEX_START Expression . . . INDEX_END", -> new RangeNode $2, null, true
o "INDEX_START . . Expression INDEX_END", -> new RangeNode null, $4
o "INDEX_START . . . Expression INDEX_END", -> new RangeNode null, $5, true
]
# The array literal.