Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jashkenas committed Jan 11, 2011
1 parent 44355f8 commit 9b3197c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
6 changes: 3 additions & 3 deletions lib/grammar.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions lib/parser.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/grammar.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -483,13 +483,13 @@ grammar =
IfBlock: [
o 'IF Expression Block', -> new If $2, $3, type: $1
o 'IfBlock ELSE IF Expression Block', -> $1.addElse new If $4, $5, type: $3
o 'IfBlock ELSE Block', -> $1.addElse $3
]

# The full complement of *if* expressions, including postfix one-liner
# *if* and *unless*.
If: [
o 'IfBlock'
o 'IfBlock ELSE Block', -> $1.addElse $3
o 'Statement POST_IF Expression', -> new If $3, Expressions.wrap([$1]), type: $2, statement: true
o 'Expression POST_IF Expression', -> new If $3, Expressions.wrap([$1]), type: $2, statement: true
]
Expand Down
10 changes: 10 additions & 0 deletions test/compilation.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,13 @@ eq λ, 5

test "don't accidentally stringify keywords", ->
ok (-> this == 'this')() is false

test "#1026", ->
cantCompile '''
if a
b
else
c
else
d
'''

0 comments on commit 9b3197c

Please sign in to comment.