safer lexing for ruby, too

This commit is contained in:
Jeremy Ashkenas 2010-02-12 21:06:00 -05:00
parent b21780b738
commit b36196286a
1 changed files with 2 additions and 1 deletions

View File

@ -166,7 +166,8 @@ module CoffeeScript
@line += indent.scan(MULTILINER).size
@i += indent.size
next_character = @chunk[MULTI_DENT, 4]
no_newlines = next_character == '.' || (last_value.to_s.match(NO_NEWLINE) && @tokens[-2][0] != '.' && !last_value.match(CODE))
prev = @tokens[-2]
no_newlines = next_character == '.' || (last_value.to_s.match(NO_NEWLINE) && prev && prev[0] != '.' && !last_value.match(CODE))
return suppress_newlines(indent) if no_newlines
size = indent.scan(LAST_DENT).last.last.length
return newline_token(indent) if size == @indent