diff --git a/lib/lexer.js b/lib/lexer.js index c4ff357d..1523fd68 100644 --- a/lib/lexer.js +++ b/lib/lexer.js @@ -595,7 +595,7 @@ STRING_NEWLINES = /\n[ \t]*/g; NO_NEWLINE = /^([+\*&|\/\-%=<>!.\\][<>=&|]*|and|or|is|isnt|not|delete|typeof|instanceof)$/; HEREDOC_INDENT = /(\n+([ \t]*)|^([ \t]+))/g; - ASSIGNED = /^\s*([a-zA-Z\$_@]\w*[ \t]*?[:=][^=])/; + ASSIGNED = /^\s*(([a-zA-Z\$_@]\w*|["'][^\r\n]+?["'])[ \t]*?[:=][^=])/; NEXT_CHARACTER = /^\s*(\S)/; NOT_REGEX = ['NUMBER', 'REGEX', '++', '--', 'FALSE', 'NULL', 'TRUE', ']']; CALLABLE = ['IDENTIFIER', 'SUPER', ')', ']', '}', 'STRING', '@', 'THIS', '?', '::']; diff --git a/src/lexer.coffee b/src/lexer.coffee index 62ad048f..a1d1066b 100644 --- a/src/lexer.coffee +++ b/src/lexer.coffee @@ -531,7 +531,7 @@ MULTILINER = /\n/g STRING_NEWLINES = /\n[ \t]*/g NO_NEWLINE = /^([+\*&|\/\-%=<>!.\\][<>=&|]*|and|or|is|isnt|not|delete|typeof|instanceof)$/ HEREDOC_INDENT = /(\n+([ \t]*)|^([ \t]+))/g -ASSIGNED = /^\s*([a-zA-Z\$_@]\w*[ \t]*?[:=][^=])/ +ASSIGNED = /^\s*(([a-zA-Z\$_@]\w*|["'][^\r\n]+?["'])[ \t]*?[:=][^=])/ NEXT_CHARACTER = /^\s*(\S)/ # Tokens which a regular expression will never immediately follow, but which diff --git a/test/test_literals.coffee b/test/test_literals.coffee index 2947482a..93b9b856 100644 --- a/test/test_literals.coffee +++ b/test/test_literals.coffee @@ -167,7 +167,7 @@ ok obj.fn() is null # Implicit objects with wacky indentation: obj = - reverse: (obj) -> + 'reverse': (obj) -> Array.prototype.reverse.call obj abc: -> @reverse(