From 0d860516ac712d721d88414535375f7f7be757a6 Mon Sep 17 00:00:00 2001 From: Jeremy Ashkenas Date: Tue, 13 Apr 2010 09:05:55 -0400 Subject: [PATCH] fixing non-spaced function application. --- lib/lexer.js | 2 +- src/lexer.coffee | 6 +++--- test/test_functions.coffee | 5 +++++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/lexer.js b/lib/lexer.js index 2cf3a040..52e5134c 100644 --- a/lib/lexer.js +++ b/lib/lexer.js @@ -434,7 +434,7 @@ tok[0] = 'PARAM'; } else if (_a === ')') { tok[0] = 'PARAM_END'; - } else if (_a === '(') { + } else if (_a === '(' || _a === 'CALL_START') { tok[0] = 'PARAM_START'; return tok[0]; } diff --git a/src/lexer.coffee b/src/lexer.coffee index f6fc3332..1fba0572 100644 --- a/src/lexer.coffee +++ b/src/lexer.coffee @@ -315,9 +315,9 @@ exports.Lexer: class Lexer tok: @prev i return if not tok switch tok[0] - when 'IDENTIFIER' then tok[0]: 'PARAM' - when ')' then tok[0]: 'PARAM_END' - when '(' then return tok[0]: 'PARAM_START' + when 'IDENTIFIER' then tok[0]: 'PARAM' + when ')' then tok[0]: 'PARAM_END' + when '(', 'CALL_START' then return tok[0]: 'PARAM_START' true # Close up all remaining open blocks at the end of the file. diff --git a/test/test_functions.coffee b/test/test_functions.coffee index 6c8c2bc4..63dd3308 100644 --- a/test/test_functions.coffee +++ b/test/test_functions.coffee @@ -76,6 +76,11 @@ fn: (arg) -> arg ok fn(fn {prop: 101}).prop is 101 +# Function calls sans-spacing. +ok((fn(x) -> + 3 +)() is 3) + # Multi-blocks with optional parens. result: fn( ->