From 838e6b4c964fe9e209d7fa78005742e7b0d5d590 Mon Sep 17 00:00:00 2001 From: Mikito Takada Date: Tue, 6 Sep 2016 17:12:15 -0700 Subject: [PATCH] Fix the preserverWhitespace option --- src/lexer.coffee | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lexer.coffee b/src/lexer.coffee index 4cb3d8b..3090270 100644 --- a/src/lexer.coffee +++ b/src/lexer.coffee @@ -130,9 +130,9 @@ class Lexer whitespaceToken: -> return 0 unless match = WHITESPACE.exec(@chunk) partMatch = match[0] - newlines = partMatch.replace(/[^\n]/, '').length - @currentLine += newlines - @token(name, partMatch) if @preserveWhitespace + @token('WHITESPACE', partMatch) if @preserveWhitespace + newlines = partMatch.match(/\n/g, '') + @currentLine += newlines?.length || 0 return partMatch.length regexEscape: (str) ->