removing dollar-prefixed local vars (let's keep 'em for globals only)
This commit is contained in:
parent
08388fea5a
commit
c79a7b5055
|
@ -569,8 +569,8 @@
|
||||||
return str.replace(MULTILINER, heredoc ? '\\n' : '');
|
return str.replace(MULTILINER, heredoc ? '\\n' : '');
|
||||||
};
|
};
|
||||||
Lexer.prototype.makeString = function(body, quote, heredoc) {
|
Lexer.prototype.makeString = function(body, quote, heredoc) {
|
||||||
body = body.replace(/\\([\s\S])/g, function($amp, $1) {
|
body = body.replace(/\\([\s\S])/g, function(match, contents) {
|
||||||
return ('\n' === $1 || quote === $1) ? $1 : $amp;
|
return ('\n' === contents || quote === contents) ? contents : match;
|
||||||
});
|
});
|
||||||
body = body.replace(RegExp("" + quote, "g"), '\\$&');
|
body = body.replace(RegExp("" + quote, "g"), '\\$&');
|
||||||
return quote + this.escapeLines(body, heredoc) + quote;
|
return quote + this.escapeLines(body, heredoc) + quote;
|
||||||
|
|
|
@ -490,8 +490,8 @@ exports.Lexer = class Lexer
|
||||||
|
|
||||||
# Constructs a string token by escaping quotes and newlines.
|
# Constructs a string token by escaping quotes and newlines.
|
||||||
makeString: (body, quote, heredoc) ->
|
makeString: (body, quote, heredoc) ->
|
||||||
body = body.replace /\\([\s\S])/g, ($amp, $1) ->
|
body = body.replace /\\([\s\S])/g, (match, contents) ->
|
||||||
if $1 in ['\n', quote] then $1 else $amp
|
if contents in ['\n', quote] then contents else match
|
||||||
body = body.replace /// #{quote} ///g, '\\$&'
|
body = body.replace /// #{quote} ///g, '\\$&'
|
||||||
quote + @escapeLines(body, heredoc) + quote
|
quote + @escapeLines(body, heredoc) + quote
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue