made ForNode avoid needless cachings

This commit is contained in:
satyr
2010-10-02 07:26:37 +09:00
parent 341f511bbd
commit 2ea549ce5f
8 changed files with 112 additions and 114 deletions

View File

@@ -421,7 +421,7 @@
throw new Error("SyntaxError: Reserved word \"" + (this.value()) + "\" on line " + (this.line + 1) + " can't be assigned");
};
Lexer.prototype.balancedString = function(str, delimited, options) {
var _i, _len, _ref2, _ref3, close, i, levels, open, pair, slash, slen;
var _i, _len, _ref2, close, i, levels, open, pair, slash, slen;
options || (options = {});
slash = delimited[0][0] === '/';
levels = [];
@@ -431,10 +431,9 @@
if (levels.length && str.charAt(i) === '\\') {
i += 1;
} else {
_ref2 = delimited;
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
pair = _ref2[_i];
_ref3 = pair, open = _ref3[0], close = _ref3[1];
for (_i = 0, _len = delimited.length; _i < _len; _i++) {
pair = delimited[_i];
_ref2 = pair, open = _ref2[0], close = _ref2[1];
if (levels.length && starts(str, close, i) && last(levels) === pair) {
levels.pop();
i += close.length - 1;
@@ -463,7 +462,7 @@
return !i ? false : str.slice(0, i);
};
Lexer.prototype.interpolateString = function(str, options) {
var _len, _ref2, _ref3, end, escapeQuotes, escaped, expr, heredoc, i, idx, inner, interpolated, lexer, nested, pi, push, quote, s, tag, tok, token, tokens, value;
var _len, _ref2, end, escapeQuotes, escaped, expr, heredoc, i, idx, inner, interpolated, lexer, nested, pi, push, quote, s, tag, tok, token, tokens, value;
_ref2 = options || {}, heredoc = _ref2.heredoc, escapeQuotes = _ref2.escapeQuotes;
quote = str.charAt(0);
if (quote !== '"' || str.length < 3) {
@@ -489,9 +488,8 @@
nested = lexer.tokenize("(" + (inner) + ")", {
line: this.line
});
_ref2 = nested;
for (idx = 0, _len = _ref2.length; idx < _len; idx++) {
tok = _ref2[idx];
for (idx = 0, _len = nested.length; idx < _len; idx++) {
tok = nested[idx];
if (tok[0] === 'CALL_END') {
(tok[0] = ')');
}
@@ -518,10 +516,9 @@
this.token('(', '(');
}
push = tokens.push;
_ref2 = tokens;
for (i = 0, _len = _ref2.length; i < _len; i++) {
token = _ref2[i];
_ref3 = token, tag = _ref3[0], value = _ref3[1];
for (i = 0, _len = tokens.length; i < _len; i++) {
token = tokens[i];
_ref2 = token, tag = _ref2[0], value = _ref2[1];
if (tag === 'TOKENS') {
push.apply(this.tokens, value);
} else if (tag === 'STRING' && escapeQuotes) {