2010-07-25 07:15:12 +00:00
|
|
|
(function() {
|
2010-11-28 18:08:49 +00:00
|
|
|
var BALANCED_PAIRS, EXPRESSION_CLOSE, EXPRESSION_END, EXPRESSION_START, IMPLICIT_BLOCK, IMPLICIT_CALL, IMPLICIT_END, IMPLICIT_FUNC, IMPLICIT_UNSPACED_CALL, INVERSES, LINEBREAKS, SINGLE_CLOSERS, SINGLE_LINERS, left, rite, _i, _len, _ref;
|
2011-09-18 22:29:01 +00:00
|
|
|
var __hasProp = Object.prototype.hasOwnProperty, __indexOf = Array.prototype.indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (__hasProp.call(this, i) && this[i] === item) return i; } return -1; }, __slice = Array.prototype.slice;
|
2011-09-18 22:16:39 +00:00
|
|
|
|
2010-12-23 18:50:52 +00:00
|
|
|
exports.Rewriter = (function() {
|
2011-09-18 22:16:39 +00:00
|
|
|
|
2010-11-12 02:48:08 +00:00
|
|
|
function Rewriter() {}
|
2011-09-18 22:16:39 +00:00
|
|
|
|
2010-11-21 01:39:35 +00:00
|
|
|
Rewriter.prototype.rewrite = function(tokens) {
|
|
|
|
this.tokens = tokens;
|
2010-11-12 02:48:08 +00:00
|
|
|
this.removeLeadingNewlines();
|
|
|
|
this.removeMidExpressionNewlines();
|
|
|
|
this.closeOpenCalls();
|
|
|
|
this.closeOpenIndexes();
|
|
|
|
this.addImplicitIndentation();
|
|
|
|
this.tagPostfixConditionals();
|
|
|
|
this.addImplicitBraces();
|
|
|
|
this.addImplicitParentheses();
|
|
|
|
return this.tokens;
|
2010-11-09 13:20:09 +00:00
|
|
|
};
|
2011-09-18 22:16:39 +00:00
|
|
|
|
2010-11-12 02:48:08 +00:00
|
|
|
Rewriter.prototype.scanTokens = function(block) {
|
|
|
|
var i, token, tokens;
|
|
|
|
tokens = this.tokens;
|
|
|
|
i = 0;
|
|
|
|
while (token = tokens[i]) {
|
|
|
|
i += block.call(this, token, i, tokens);
|
2010-10-02 09:57:16 +00:00
|
|
|
}
|
2010-11-12 02:48:08 +00:00
|
|
|
return true;
|
2010-11-09 13:20:09 +00:00
|
|
|
};
|
2011-09-18 22:16:39 +00:00
|
|
|
|
2010-11-12 02:48:08 +00:00
|
|
|
Rewriter.prototype.detectEnd = function(i, condition, action) {
|
|
|
|
var levels, token, tokens, _ref, _ref2;
|
|
|
|
tokens = this.tokens;
|
|
|
|
levels = 0;
|
|
|
|
while (token = tokens[i]) {
|
2011-08-08 16:55:22 +00:00
|
|
|
if (levels === 0 && condition.call(this, token, i)) {
|
|
|
|
return action.call(this, token, i);
|
|
|
|
}
|
2011-08-07 06:59:37 +00:00
|
|
|
if (!token || levels < 0) return action.call(this, token, i - 1);
|
2010-11-12 02:48:08 +00:00
|
|
|
if (_ref = token[0], __indexOf.call(EXPRESSION_START, _ref) >= 0) {
|
|
|
|
levels += 1;
|
|
|
|
} else if (_ref2 = token[0], __indexOf.call(EXPRESSION_END, _ref2) >= 0) {
|
|
|
|
levels -= 1;
|
|
|
|
}
|
|
|
|
i += 1;
|
|
|
|
}
|
|
|
|
return i - 1;
|
2010-11-09 13:20:09 +00:00
|
|
|
};
|
2011-09-18 22:16:39 +00:00
|
|
|
|
2010-11-12 02:48:08 +00:00
|
|
|
Rewriter.prototype.removeLeadingNewlines = function() {
|
2010-11-20 21:25:22 +00:00
|
|
|
var i, tag, _len, _ref;
|
|
|
|
_ref = this.tokens;
|
|
|
|
for (i = 0, _len = _ref.length; i < _len; i++) {
|
|
|
|
tag = _ref[i][0];
|
2011-08-07 06:59:37 +00:00
|
|
|
if (tag !== 'TERMINATOR') break;
|
2010-10-02 09:57:16 +00:00
|
|
|
}
|
2011-08-07 06:59:37 +00:00
|
|
|
if (i) return this.tokens.splice(0, i);
|
2010-10-02 09:57:16 +00:00
|
|
|
};
|
2011-09-18 22:16:39 +00:00
|
|
|
|
2010-11-12 02:48:08 +00:00
|
|
|
Rewriter.prototype.removeMidExpressionNewlines = function() {
|
|
|
|
return this.scanTokens(function(token, i, tokens) {
|
|
|
|
var _ref;
|
2011-08-08 16:55:22 +00:00
|
|
|
if (!(token[0] === 'TERMINATOR' && (_ref = this.tag(i + 1), __indexOf.call(EXPRESSION_CLOSE, _ref) >= 0))) {
|
2011-08-08 16:27:53 +00:00
|
|
|
return 1;
|
2011-08-08 16:55:22 +00:00
|
|
|
}
|
2010-11-12 02:48:08 +00:00
|
|
|
tokens.splice(i, 1);
|
|
|
|
return 0;
|
|
|
|
});
|
2010-08-08 21:37:28 +00:00
|
|
|
};
|
2011-09-18 22:16:39 +00:00
|
|
|
|
2010-11-12 02:48:08 +00:00
|
|
|
Rewriter.prototype.closeOpenCalls = function() {
|
|
|
|
var action, condition;
|
|
|
|
condition = function(token, i) {
|
|
|
|
var _ref;
|
|
|
|
return ((_ref = token[0]) === ')' || _ref === 'CALL_END') || token[0] === 'OUTDENT' && this.tag(i - 1) === ')';
|
|
|
|
};
|
|
|
|
action = function(token, i) {
|
|
|
|
return this.tokens[token[0] === 'OUTDENT' ? i - 1 : i][0] = 'CALL_END';
|
|
|
|
};
|
|
|
|
return this.scanTokens(function(token, i) {
|
2011-08-07 06:59:37 +00:00
|
|
|
if (token[0] === 'CALL_START') this.detectEnd(i + 1, condition, action);
|
2010-10-07 15:56:01 +00:00
|
|
|
return 1;
|
2010-11-12 02:48:08 +00:00
|
|
|
});
|
2010-02-28 00:46:45 +00:00
|
|
|
};
|
2011-09-18 22:16:39 +00:00
|
|
|
|
2010-11-12 02:48:08 +00:00
|
|
|
Rewriter.prototype.closeOpenIndexes = function() {
|
|
|
|
var action, condition;
|
|
|
|
condition = function(token, i) {
|
|
|
|
var _ref;
|
|
|
|
return (_ref = token[0]) === ']' || _ref === 'INDEX_END';
|
|
|
|
};
|
|
|
|
action = function(token, i) {
|
|
|
|
return token[0] = 'INDEX_END';
|
|
|
|
};
|
|
|
|
return this.scanTokens(function(token, i) {
|
2011-08-07 06:59:37 +00:00
|
|
|
if (token[0] === 'INDEX_START') this.detectEnd(i + 1, condition, action);
|
2010-10-07 15:56:01 +00:00
|
|
|
return 1;
|
2010-11-12 02:48:08 +00:00
|
|
|
});
|
|
|
|
};
|
2011-09-18 22:16:39 +00:00
|
|
|
|
2010-11-12 02:48:08 +00:00
|
|
|
Rewriter.prototype.addImplicitBraces = function() {
|
2010-11-14 19:21:55 +00:00
|
|
|
var action, condition, stack, start, startIndent;
|
2010-11-12 02:48:08 +00:00
|
|
|
stack = [];
|
|
|
|
start = null;
|
2010-11-14 19:21:55 +00:00
|
|
|
startIndent = 0;
|
2010-11-12 02:48:08 +00:00
|
|
|
condition = function(token, i) {
|
2010-12-20 13:13:07 +00:00
|
|
|
var one, tag, three, two, _ref, _ref2;
|
2011-09-21 22:56:20 +00:00
|
|
|
_ref = this.tokens.slice(i + 1, (i + 3) + 1 || 9e9), one = _ref[0], two = _ref[1], three = _ref[2];
|
2011-08-07 06:59:37 +00:00
|
|
|
if ('HERECOMMENT' === (one != null ? one[0] : void 0)) return false;
|
2010-10-07 15:56:01 +00:00
|
|
|
tag = token[0];
|
2011-05-01 14:43:50 +00:00
|
|
|
return ((tag === 'TERMINATOR' || tag === 'OUTDENT') && !((two != null ? two[0] : void 0) === ':' || (one != null ? one[0] : void 0) === '@' && (three != null ? three[0] : void 0) === ':')) || (tag === ',' && one && ((_ref2 = one[0]) !== 'IDENTIFIER' && _ref2 !== 'NUMBER' && _ref2 !== 'STRING' && _ref2 !== '@' && _ref2 !== 'TERMINATOR' && _ref2 !== 'OUTDENT'));
|
2010-11-12 02:48:08 +00:00
|
|
|
};
|
|
|
|
action = function(token, i) {
|
2011-05-01 14:03:50 +00:00
|
|
|
var tok;
|
|
|
|
tok = ['}', '}', token[2]];
|
|
|
|
tok.generated = true;
|
|
|
|
return this.tokens.splice(i, 0, tok);
|
2010-11-12 02:48:08 +00:00
|
|
|
};
|
|
|
|
return this.scanTokens(function(token, i, tokens) {
|
2010-11-28 17:42:43 +00:00
|
|
|
var ago, idx, tag, tok, value, _ref, _ref2;
|
2010-11-12 02:48:08 +00:00
|
|
|
if (_ref = (tag = token[0]), __indexOf.call(EXPRESSION_START, _ref) >= 0) {
|
|
|
|
stack.push([(tag === 'INDENT' && this.tag(i - 1) === '{' ? '{' : tag), i]);
|
|
|
|
return 1;
|
2010-10-07 15:56:01 +00:00
|
|
|
}
|
2010-11-12 02:48:08 +00:00
|
|
|
if (__indexOf.call(EXPRESSION_END, tag) >= 0) {
|
|
|
|
start = stack.pop();
|
|
|
|
return 1;
|
2010-10-07 15:56:01 +00:00
|
|
|
}
|
2011-08-08 16:55:22 +00:00
|
|
|
if (!(tag === ':' && ((ago = this.tag(i - 2)) === ':' || ((_ref2 = stack[stack.length - 1]) != null ? _ref2[0] : void 0) !== '{'))) {
|
2011-08-08 16:27:53 +00:00
|
|
|
return 1;
|
2011-08-08 16:55:22 +00:00
|
|
|
}
|
2010-11-12 02:48:08 +00:00
|
|
|
stack.push(['{']);
|
2010-11-28 17:42:43 +00:00
|
|
|
idx = ago === '@' ? i - 2 : i - 1;
|
2010-11-29 01:54:00 +00:00
|
|
|
while (this.tag(idx - 2) === 'HERECOMMENT') {
|
2010-11-12 02:48:08 +00:00
|
|
|
idx -= 2;
|
2010-08-14 15:42:19 +00:00
|
|
|
}
|
2010-11-13 17:17:09 +00:00
|
|
|
value = new String('{');
|
|
|
|
value.generated = true;
|
|
|
|
tok = ['{', value, token[2]];
|
2010-11-12 02:48:08 +00:00
|
|
|
tok.generated = true;
|
|
|
|
tokens.splice(idx, 0, tok);
|
2010-10-02 09:57:16 +00:00
|
|
|
this.detectEnd(i + 2, condition, action);
|
2010-11-12 02:48:08 +00:00
|
|
|
return 2;
|
|
|
|
});
|
|
|
|
};
|
2011-09-18 22:16:39 +00:00
|
|
|
|
2010-11-12 02:48:08 +00:00
|
|
|
Rewriter.prototype.addImplicitParentheses = function() {
|
2010-12-23 19:22:01 +00:00
|
|
|
var action, noCall;
|
|
|
|
noCall = false;
|
2010-11-12 02:48:08 +00:00
|
|
|
action = function(token, i) {
|
2011-09-17 00:16:30 +00:00
|
|
|
return this.tokens.splice(i, 0, ['CALL_END', ')', token[2]]);
|
2010-11-12 02:48:08 +00:00
|
|
|
};
|
|
|
|
return this.scanTokens(function(token, i, tokens) {
|
2011-05-15 14:41:41 +00:00
|
|
|
var callObject, current, next, prev, seenControl, seenSingle, tag, _ref, _ref2, _ref3;
|
2010-11-12 02:48:08 +00:00
|
|
|
tag = token[0];
|
2011-08-07 06:59:37 +00:00
|
|
|
if (tag === 'CLASS' || tag === 'IF') noCall = true;
|
2011-09-21 22:56:20 +00:00
|
|
|
_ref = tokens.slice(i - 1, (i + 1) + 1 || 9e9), prev = _ref[0], current = _ref[1], next = _ref[2];
|
2010-12-20 13:13:07 +00:00
|
|
|
callObject = !noCall && tag === 'INDENT' && next && next.generated && next[0] === '{' && prev && (_ref2 = prev[0], __indexOf.call(IMPLICIT_FUNC, _ref2) >= 0);
|
2010-11-12 02:48:08 +00:00
|
|
|
seenSingle = false;
|
2011-05-15 14:41:41 +00:00
|
|
|
seenControl = false;
|
2011-08-07 06:59:37 +00:00
|
|
|
if (__indexOf.call(LINEBREAKS, tag) >= 0) noCall = false;
|
|
|
|
if (prev && !prev.spaced && tag === '?') token.call = true;
|
|
|
|
if (token.fromThen) return 1;
|
2011-08-08 16:55:22 +00:00
|
|
|
if (!(callObject || (prev != null ? prev.spaced : void 0) && (prev.call || (_ref3 = prev[0], __indexOf.call(IMPLICIT_FUNC, _ref3) >= 0)) && (__indexOf.call(IMPLICIT_CALL, tag) >= 0 || !(token.spaced || token.newLine) && __indexOf.call(IMPLICIT_UNSPACED_CALL, tag) >= 0))) {
|
2011-08-08 16:27:53 +00:00
|
|
|
return 1;
|
2011-08-08 16:55:22 +00:00
|
|
|
}
|
2010-11-12 02:48:08 +00:00
|
|
|
tokens.splice(i, 0, ['CALL_START', '(', token[2]]);
|
2010-12-18 20:27:19 +00:00
|
|
|
this.detectEnd(i + 1, function(token, i) {
|
2011-03-28 21:12:27 +00:00
|
|
|
var post, _ref4;
|
2010-12-22 01:28:48 +00:00
|
|
|
tag = token[0];
|
2011-08-07 06:59:37 +00:00
|
|
|
if (!seenSingle && token.fromThen) return true;
|
2011-08-08 16:55:22 +00:00
|
|
|
if (tag === 'IF' || tag === 'ELSE' || tag === 'CATCH' || tag === '->' || tag === '=>') {
|
2011-08-08 16:27:53 +00:00
|
|
|
seenSingle = true;
|
2011-08-08 16:55:22 +00:00
|
|
|
}
|
|
|
|
if (tag === 'IF' || tag === 'ELSE' || tag === 'SWITCH' || tag === 'TRY') {
|
|
|
|
seenControl = true;
|
|
|
|
}
|
|
|
|
if ((tag === '.' || tag === '?.' || tag === '::') && this.tag(i - 1) === 'OUTDENT') {
|
2011-08-08 16:27:53 +00:00
|
|
|
return true;
|
2011-08-08 16:55:22 +00:00
|
|
|
}
|
2011-05-15 14:41:41 +00:00
|
|
|
return !token.generated && this.tag(i - 1) !== ',' && (__indexOf.call(IMPLICIT_END, tag) >= 0 || (tag === 'INDENT' && !seenControl)) && (tag !== 'INDENT' || (this.tag(i - 2) !== 'CLASS' && (_ref4 = this.tag(i - 1), __indexOf.call(IMPLICIT_BLOCK, _ref4) < 0) && !((post = this.tokens[i + 1]) && post.generated && post[0] === '{')));
|
2010-11-12 02:48:08 +00:00
|
|
|
}, action);
|
2011-08-07 06:59:37 +00:00
|
|
|
if (prev[0] === '?') prev[0] = 'FUNC_EXIST';
|
2010-11-12 02:48:08 +00:00
|
|
|
return 2;
|
|
|
|
});
|
|
|
|
};
|
2011-09-18 22:16:39 +00:00
|
|
|
|
2010-11-12 02:48:08 +00:00
|
|
|
Rewriter.prototype.addImplicitIndentation = function() {
|
|
|
|
return this.scanTokens(function(token, i, tokens) {
|
|
|
|
var action, condition, indent, outdent, starter, tag, _ref, _ref2;
|
|
|
|
tag = token[0];
|
|
|
|
if (tag === 'TERMINATOR' && this.tag(i + 1) === 'THEN') {
|
2010-10-02 09:57:16 +00:00
|
|
|
tokens.splice(i, 1);
|
2010-11-12 02:48:08 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if (tag === 'ELSE' && this.tag(i - 1) !== 'OUTDENT') {
|
|
|
|
tokens.splice.apply(tokens, [i, 0].concat(__slice.call(this.indentation(token))));
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
if (tag === 'CATCH' && ((_ref = this.tag(i + 2)) === 'OUTDENT' || _ref === 'TERMINATOR' || _ref === 'FINALLY')) {
|
|
|
|
tokens.splice.apply(tokens, [i + 2, 0].concat(__slice.call(this.indentation(token))));
|
|
|
|
return 4;
|
|
|
|
}
|
|
|
|
if (__indexOf.call(SINGLE_LINERS, tag) >= 0 && this.tag(i + 1) !== 'INDENT' && !(tag === 'ELSE' && this.tag(i + 1) === 'IF')) {
|
|
|
|
starter = tag;
|
|
|
|
_ref2 = this.indentation(token), indent = _ref2[0], outdent = _ref2[1];
|
2011-08-07 06:59:37 +00:00
|
|
|
if (starter === 'THEN') indent.fromThen = true;
|
2010-11-12 02:48:08 +00:00
|
|
|
indent.generated = outdent.generated = true;
|
|
|
|
tokens.splice(i + 1, 0, indent);
|
|
|
|
condition = function(token, i) {
|
2011-03-28 21:12:27 +00:00
|
|
|
var _ref3;
|
|
|
|
return token[1] !== ';' && (_ref3 = token[0], __indexOf.call(SINGLE_CLOSERS, _ref3) >= 0) && !(token[0] === 'ELSE' && (starter !== 'IF' && starter !== 'THEN'));
|
2010-11-12 02:48:08 +00:00
|
|
|
};
|
|
|
|
action = function(token, i) {
|
|
|
|
return this.tokens.splice((this.tag(i - 1) === ',' ? i - 1 : i), 0, outdent);
|
|
|
|
};
|
|
|
|
this.detectEnd(i + 2, condition, action);
|
2011-08-07 06:59:37 +00:00
|
|
|
if (tag === 'THEN') tokens.splice(i, 1);
|
2010-11-12 02:48:08 +00:00
|
|
|
return 1;
|
2010-07-25 06:42:37 +00:00
|
|
|
}
|
2010-07-25 07:15:12 +00:00
|
|
|
return 1;
|
2010-11-12 02:48:08 +00:00
|
|
|
});
|
2010-07-25 06:42:37 +00:00
|
|
|
};
|
2011-09-18 22:16:39 +00:00
|
|
|
|
2010-11-12 02:48:08 +00:00
|
|
|
Rewriter.prototype.tagPostfixConditionals = function() {
|
|
|
|
var condition;
|
|
|
|
condition = function(token, i) {
|
|
|
|
var _ref;
|
|
|
|
return (_ref = token[0]) === 'TERMINATOR' || _ref === 'INDENT';
|
|
|
|
};
|
|
|
|
return this.scanTokens(function(token, i) {
|
2010-12-21 03:50:49 +00:00
|
|
|
var original;
|
2011-08-07 06:59:37 +00:00
|
|
|
if (token[0] !== 'IF') return 1;
|
2010-11-12 02:48:08 +00:00
|
|
|
original = token;
|
|
|
|
this.detectEnd(i + 1, condition, function(token, i) {
|
2011-08-07 06:59:37 +00:00
|
|
|
if (token[0] !== 'INDENT') return original[0] = 'POST_' + original[0];
|
2010-11-12 02:48:08 +00:00
|
|
|
});
|
|
|
|
return 1;
|
2010-08-12 01:07:47 +00:00
|
|
|
});
|
2010-11-12 02:48:08 +00:00
|
|
|
};
|
2011-09-18 22:16:39 +00:00
|
|
|
|
2010-11-12 02:48:08 +00:00
|
|
|
Rewriter.prototype.indentation = function(token) {
|
|
|
|
return [['INDENT', 2, token[2]], ['OUTDENT', 2, token[2]]];
|
|
|
|
};
|
2011-09-18 22:16:39 +00:00
|
|
|
|
2010-11-12 02:48:08 +00:00
|
|
|
Rewriter.prototype.tag = function(i) {
|
|
|
|
var _ref;
|
|
|
|
return (_ref = this.tokens[i]) != null ? _ref[0] : void 0;
|
|
|
|
};
|
2011-09-18 22:16:39 +00:00
|
|
|
|
2010-11-12 02:48:08 +00:00
|
|
|
return Rewriter;
|
2011-09-18 22:16:39 +00:00
|
|
|
|
2010-12-23 18:50:52 +00:00
|
|
|
})();
|
2011-09-18 22:16:39 +00:00
|
|
|
|
2010-10-02 09:57:16 +00:00
|
|
|
BALANCED_PAIRS = [['(', ')'], ['[', ']'], ['{', '}'], ['INDENT', 'OUTDENT'], ['CALL_START', 'CALL_END'], ['PARAM_START', 'PARAM_END'], ['INDEX_START', 'INDEX_END']];
|
2011-09-18 22:16:39 +00:00
|
|
|
|
2011-09-16 23:26:04 +00:00
|
|
|
exports.INVERSES = INVERSES = {};
|
2011-09-18 22:16:39 +00:00
|
|
|
|
2010-10-02 09:57:16 +00:00
|
|
|
EXPRESSION_START = [];
|
2011-09-18 22:16:39 +00:00
|
|
|
|
2010-10-02 09:57:16 +00:00
|
|
|
EXPRESSION_END = [];
|
2011-09-18 22:16:39 +00:00
|
|
|
|
2010-10-22 01:51:06 +00:00
|
|
|
for (_i = 0, _len = BALANCED_PAIRS.length; _i < _len; _i++) {
|
2010-10-02 09:57:16 +00:00
|
|
|
_ref = BALANCED_PAIRS[_i], left = _ref[0], rite = _ref[1];
|
|
|
|
EXPRESSION_START.push(INVERSES[rite] = left);
|
|
|
|
EXPRESSION_END.push(INVERSES[left] = rite);
|
2010-03-07 19:41:52 +00:00
|
|
|
}
|
2011-09-18 22:16:39 +00:00
|
|
|
|
2010-03-07 19:41:52 +00:00
|
|
|
EXPRESSION_CLOSE = ['CATCH', 'WHEN', 'ELSE', 'FINALLY'].concat(EXPRESSION_END);
|
2011-09-18 22:16:39 +00:00
|
|
|
|
2010-09-09 00:15:16 +00:00
|
|
|
IMPLICIT_FUNC = ['IDENTIFIER', 'SUPER', ')', 'CALL_END', ']', 'INDEX_END', '@', 'THIS'];
|
2011-09-18 22:16:39 +00:00
|
|
|
|
2010-12-23 20:57:27 +00:00
|
|
|
IMPLICIT_CALL = ['IDENTIFIER', 'NUMBER', 'STRING', 'JS', 'REGEX', 'NEW', 'PARAM_START', 'CLASS', 'IF', 'TRY', 'SWITCH', 'THIS', 'BOOL', 'UNARY', 'SUPER', '@', '->', '=>', '[', '(', '{', '--', '++'];
|
2011-09-18 22:16:39 +00:00
|
|
|
|
2010-10-19 15:52:07 +00:00
|
|
|
IMPLICIT_UNSPACED_CALL = ['+', '-'];
|
2011-09-18 22:16:39 +00:00
|
|
|
|
2010-03-07 19:41:52 +00:00
|
|
|
IMPLICIT_BLOCK = ['->', '=>', '{', '[', ','];
|
2011-09-18 22:16:39 +00:00
|
|
|
|
2011-05-15 14:41:41 +00:00
|
|
|
IMPLICIT_END = ['POST_IF', 'FOR', 'WHILE', 'UNTIL', 'WHEN', 'BY', 'LOOP', 'TERMINATOR'];
|
2011-09-18 22:16:39 +00:00
|
|
|
|
2010-10-02 09:57:16 +00:00
|
|
|
SINGLE_LINERS = ['ELSE', '->', '=>', 'TRY', 'FINALLY', 'THEN'];
|
2011-09-18 22:16:39 +00:00
|
|
|
|
2010-03-07 19:41:52 +00:00
|
|
|
SINGLE_CLOSERS = ['TERMINATOR', 'CATCH', 'FINALLY', 'ELSE', 'OUTDENT', 'LEADING_WHEN'];
|
2011-09-18 22:16:39 +00:00
|
|
|
|
2010-08-14 23:56:00 +00:00
|
|
|
LINEBREAKS = ['TERMINATOR', 'INDENT', 'OUTDENT'];
|
2011-09-18 22:16:39 +00:00
|
|
|
|
2010-09-21 07:53:58 +00:00
|
|
|
}).call(this);
|