mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-01-14 17:27:59 -05:00
fixes #1442: javascript literals should increase line count when they
contain newlines
This commit is contained in:
@@ -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() {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user