fixing heredocs with multiple double quotes (broken regex from the Ruby translation), with tests.

This commit is contained in:
Jeremy Ashkenas
2010-02-28 10:29:30 -05:00
parent 47f71f9193
commit b08995cbcc
3 changed files with 8 additions and 2 deletions

View File

@@ -159,7 +159,7 @@ exports.Lexer: class Lexer
indent: (doc.match(HEREDOC_INDENT) or ['']).sort()[0]
doc: doc.replace(new RegExp("^" + indent, 'gm'), '')
.replace(MULTILINER, "\\n")
.replace('"', '\\"')
.replace(/"/g, '\\"')
@token 'STRING', '"' + doc + '"'
@line += @count match[1], "\n"
@i += match[1].length