Revert "Merge https://github.com/ngn/coffee-script"
This reverts commit277e82bd03
, reversing changes made to0f523de212
.
This commit is contained in:
parent
277e82bd03
commit
25e7eeac8f
|
@ -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 = '}');
|
||||
|
|
|
@ -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 = '}'
|
||||
|
|
|
@ -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}!'
|
||||
|
|
Loading…
Reference in New Issue