This reverts commit 277e82bd03, reversing
changes made to 0f523de212.
This commit is contained in:
Michael Ficarra 2011-06-17 11:53:48 -04:00
parent 277e82bd03
commit 25e7eeac8f
3 changed files with 4 additions and 13 deletions

View File

@ -190,9 +190,7 @@
if (!(this.chunk.charAt(0) === '`' && (match = JSTOKEN.exec(this.chunk)))) {
return 0;
}
script = match[0];
this.line += count(script, '\n');
this.token('JS', script.slice(1, -1));
this.token('JS', (script = match[0]).slice(1, -1));
return script.length;
};
Lexer.prototype.regexToken = function() {
@ -478,7 +476,7 @@
end = stack[stack.length - 1];
continue;
}
if (end === '}' && (letter === '"' || letter === "'" || letter === '/')) {
if (end === '}' && (letter === '"' || letter === "'")) {
stack.push(end = letter);
} else if (end === '}' && letter === '{') {
stack.push(end = '}');

View File

@ -181,9 +181,7 @@ 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
script = match[0]
@line += count script, '\n'
@token 'JS', script[1...-1]
@token 'JS', (script = match[0]).slice 1, -1
script.length
# Matches regular expression literals. Lexing regular expressions is difficult
@ -414,7 +412,7 @@ exports.Lexer = class Lexer
return str.slice 0, i + 1
end = stack[stack.length - 1]
continue
if end is '}' and letter in ['"', "'", '/']
if end is '}' and letter in ['"', "'"]
stack.push end = letter
else if end is '}' and letter is '{'
stack.push end = '}'

View File

@ -20,11 +20,6 @@ eq "#{ "{" }", "{"
eq "#{ '#{}}' } }", '#{}} }'
eq "#{"'#{ ({a: "b#{1}"}['a']) }'"}", "'b1'"
# Issue 1150: String interpolation regression
eq "#{/'/.test ''}", 'false'
eq "#{"'/" + '/"' + /"'/.test ''}", '\'//"false'
eq "#{"'/"}#{'/"'}#{/"'/.test ''}", '\'//"false'
hello = 'Hello'
world = 'World'
ok '#{hello} #{world}!' is '#{hello} #{world}!'