mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
ForBody is really the ForSource
This commit is contained in:
parent
763e04fec9
commit
f55b4cd8b6
1 changed files with 4 additions and 2 deletions
|
@ -318,15 +318,17 @@ rule
|
|||
# Array comprehensions, including guard and current index.
|
||||
For:
|
||||
Expression FOR
|
||||
ForVariables ForBody { result = ForNode.new(val[0], val[3][0], val[2][0], val[3][1], val[2][1]) }
|
||||
ForVariables ForSource { result = ForNode.new(val[0], val[3][0], val[2][0], val[3][1], val[2][1]) }
|
||||
;
|
||||
|
||||
# An array comprehension has variables for the current element and index.
|
||||
ForVariables:
|
||||
IDENTIFIER { result = val }
|
||||
| IDENTIFIER "," IDENTIFIER { result = [val[0], val[2]] }
|
||||
;
|
||||
|
||||
ForBody:
|
||||
# The source of the array comprehension can optionally be filtered.
|
||||
ForSource:
|
||||
IN PureExpression "." { result = [val[1]] }
|
||||
| IN PureExpression
|
||||
IF Expression "." { result = [val[1], val[3]] }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue