Skip to content

Commit

Permalink
lexer: added FUNCTION to BLOCK_USERS
Browse files Browse the repository at this point in the history
  • Loading branch information
satyr committed Aug 3, 2012
1 parent e9c65f9 commit 1b0dafd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/lexer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1446,7 +1446,7 @@ INVERSES = new function(){
};
CHAIN = ['(', '{', '[', 'ID', 'STRNUM', 'LITERAL', 'LET', 'WITH', 'WORDS'];
ARG = CHAIN.concat(['...', 'UNARY', 'CREMENT', 'PARAM(', 'FUNCTION', 'IF', 'SWITCH', 'TRY', 'CLASS', 'RANGE', 'LABEL', 'DECL', 'DO']);
BLOCK_USERS = [',', ':', '->', 'ELSE', 'ASSIGN', 'IMPORT', 'UNARY', 'DEFAULT', 'TRY', 'CATCH', 'FINALLY', 'HURL', 'DECL', 'DO', 'LET'];
BLOCK_USERS = [',', ':', '->', 'ELSE', 'ASSIGN', 'IMPORT', 'UNARY', 'DEFAULT', 'TRY', 'CATCH', 'FINALLY', 'HURL', 'DECL', 'DO', 'LET', 'FUNCTION'];
function clone$(it){
function fun(){} fun.prototype = it;
return new fun;
Expand Down
2 changes: 1 addition & 1 deletion src/lexer.co
Original file line number Diff line number Diff line change
Expand Up @@ -1020,4 +1020,4 @@ ARG = CHAIN.concat <[ ... UNARY CREMENT PARAM( FUNCTION

# Tokens that expect INDENT on the right.
BLOCK_USERS = <[ , : -> ELSE ASSIGN IMPORT UNARY DEFAULT TRY CATCH FINALLY
HURL DECL DO LET ]>
HURL DECL DO LET FUNCTION ]>
6 changes: 6 additions & 0 deletions test/if.co
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ else

# Post-condition should accept trailing non-`if` block.
ok true if ->
ok true if do
true
ok true if let
true
ok true if do function f
true


# [coffee#738](https://github.com/jashkenas/coffee-script/issues/738)
Expand Down

0 comments on commit 1b0dafd

Please sign in to comment.