From c3ff752c403727fe834a6c29bf71e706e9726ea6 Mon Sep 17 00:00:00 2001 From: Jeremy Ashkenas Date: Thu, 24 Dec 2009 15:05:14 -0800 Subject: [PATCH] ... --- examples/whitespace.cs | 4 +--- lib/coffee_script/grammar.y | 7 ++++++- lib/coffee_script/lexer.rb | 1 + 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/examples/whitespace.cs b/examples/whitespace.cs index e2f42719..0f26bd45 100644 --- a/examples/whitespace.cs +++ b/examples/whitespace.cs @@ -5,8 +5,6 @@ square: x => elements.each(el => el.click(event => - el.show() - ) -) + el.show())) a: 5 \ No newline at end of file diff --git a/lib/coffee_script/grammar.y b/lib/coffee_script/grammar.y index 126d5f88..e1ec2fb9 100644 --- a/lib/coffee_script/grammar.y +++ b/lib/coffee_script/grammar.y @@ -88,7 +88,12 @@ rule Block: Expression { result = Expressions.new(val) } - | INDENT Expressions OUTDENT { result = val[1] } + | INDENT Expressions Outdent { result = val[1] } + ; + + Outdent: + /* nothing */ + | OUTDENT ; # All tokens that can terminate an expression. diff --git a/lib/coffee_script/lexer.rb b/lib/coffee_script/lexer.rb index aeb266d4..e72c3cb7 100644 --- a/lib/coffee_script/lexer.rb +++ b/lib/coffee_script/lexer.rb @@ -136,6 +136,7 @@ module CoffeeScript @indents.pop while @indents.last && ((@indents.last || 0) > size) @indent = @indents.last || 0 end + @line += 1 @i += (size + 1) token(tag, size) end