From 774e3d3e3153d3496279b2f58b5816a83c8995cb Mon Sep 17 00:00:00 2001 From: Jeremy Ashkenas Date: Wed, 30 Dec 2009 21:41:01 -0500 Subject: [PATCH] moving the newline escaping detection up higher so indents don't overrule it --- lib/coffee_script/lexer.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/coffee_script/lexer.rb b/lib/coffee_script/lexer.rb index 0d31e38c..23a5e597 100644 --- a/lib/coffee_script/lexer.rb +++ b/lib/coffee_script/lexer.rb @@ -156,6 +156,10 @@ module CoffeeScript return false unless indent = @chunk[MULTI_DENT, 1] @line += indent.scan(MULTILINER).size @i += indent.size + if last_value == "\\" + @tokens.pop + return true + end size = indent.scan(LAST_DENT).last.last.length return newline_token(indent) if size == @indent if size > @indent @@ -185,9 +189,7 @@ module CoffeeScript # Multiple newlines get merged together. # Use a trailing \ to escape newlines. def newline_token(newlines) - lines = newlines.scan(MULTILINER).length - token("\n", "\n") unless ["\n", "\\"].include?(last_value) - @tokens.pop if last_value == "\\" + token("\n", "\n") unless last_value == "\n" true end