diff --git a/lib/lexer.js b/lib/lexer.js index bf0b38f8..71bf0c34 100644 --- a/lib/lexer.js +++ b/lib/lexer.js @@ -190,7 +190,9 @@ if (!(this.chunk.charAt(0) === '`' && (match = JSTOKEN.exec(this.chunk)))) { return 0; } - this.token('JS', (script = match[0]).slice(1, -1)); + script = match[0]; + this.line += count(script, '\n'); + this.token('JS', script.slice(1, -1)); return script.length; }; Lexer.prototype.regexToken = function() { diff --git a/src/lexer.coffee b/src/lexer.coffee index d4170c57..3e11fc40 100644 --- a/src/lexer.coffee +++ b/src/lexer.coffee @@ -181,7 +181,9 @@ exports.Lexer = class Lexer # Matches JavaScript interpolated directly into the source via backticks. jsToken: -> return 0 unless @chunk.charAt(0) is '`' and match = JSTOKEN.exec @chunk - @token 'JS', (script = match[0]).slice 1, -1 + script = match[0] + @line += count script, '\n' + @token 'JS', script[1...-1] script.length # Matches regular expression literals. Lexing regular expressions is difficult