rewriter.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534
  1. // Generated by CoffeeScript 1.12.6
  2. (function() {
  3. var BALANCED_PAIRS, CALL_CLOSERS, EXPRESSION_CLOSE, EXPRESSION_END, EXPRESSION_START, IMPLICIT_CALL, IMPLICIT_END, IMPLICIT_FUNC, IMPLICIT_UNSPACED_CALL, INVERSES, LINEBREAKS, Rewriter, SINGLE_CLOSERS, SINGLE_LINERS, generate, k, left, len, ref, rite,
  4. indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },
  5. slice = [].slice;
  6. generate = function(tag, value, origin) {
  7. var tok;
  8. tok = [tag, value];
  9. tok.generated = true;
  10. if (origin) {
  11. tok.origin = origin;
  12. }
  13. return tok;
  14. };
  15. exports.Rewriter = Rewriter = (function() {
  16. function Rewriter() {}
  17. Rewriter.prototype.rewrite = function(tokens1) {
  18. this.tokens = tokens1;
  19. this.removeLeadingNewlines();
  20. this.closeOpenCalls();
  21. this.closeOpenIndexes();
  22. this.normalizeLines();
  23. this.tagPostfixConditionals();
  24. this.addImplicitBracesAndParens();
  25. this.addLocationDataToGeneratedTokens();
  26. this.fixOutdentLocationData();
  27. return this.tokens;
  28. };
  29. Rewriter.prototype.scanTokens = function(block) {
  30. var i, token, tokens;
  31. tokens = this.tokens;
  32. i = 0;
  33. while (token = tokens[i]) {
  34. i += block.call(this, token, i, tokens);
  35. }
  36. return true;
  37. };
  38. Rewriter.prototype.detectEnd = function(i, condition, action) {
  39. var levels, ref, ref1, token, tokens;
  40. tokens = this.tokens;
  41. levels = 0;
  42. while (token = tokens[i]) {
  43. if (levels === 0 && condition.call(this, token, i)) {
  44. return action.call(this, token, i);
  45. }
  46. if (!token || levels < 0) {
  47. return action.call(this, token, i - 1);
  48. }
  49. if (ref = token[0], indexOf.call(EXPRESSION_START, ref) >= 0) {
  50. levels += 1;
  51. } else if (ref1 = token[0], indexOf.call(EXPRESSION_END, ref1) >= 0) {
  52. levels -= 1;
  53. }
  54. i += 1;
  55. }
  56. return i - 1;
  57. };
  58. Rewriter.prototype.removeLeadingNewlines = function() {
  59. var i, k, len, ref, tag;
  60. ref = this.tokens;
  61. for (i = k = 0, len = ref.length; k < len; i = ++k) {
  62. tag = ref[i][0];
  63. if (tag !== 'TERMINATOR') {
  64. break;
  65. }
  66. }
  67. if (i) {
  68. return this.tokens.splice(0, i);
  69. }
  70. };
  71. Rewriter.prototype.closeOpenCalls = function() {
  72. var action, condition;
  73. condition = function(token, i) {
  74. var ref;
  75. return ((ref = token[0]) === ')' || ref === 'CALL_END') || token[0] === 'OUTDENT' && this.tag(i - 1) === ')';
  76. };
  77. action = function(token, i) {
  78. return this.tokens[token[0] === 'OUTDENT' ? i - 1 : i][0] = 'CALL_END';
  79. };
  80. return this.scanTokens(function(token, i) {
  81. if (token[0] === 'CALL_START') {
  82. this.detectEnd(i + 1, condition, action);
  83. }
  84. return 1;
  85. });
  86. };
  87. Rewriter.prototype.closeOpenIndexes = function() {
  88. var action, condition;
  89. condition = function(token, i) {
  90. var ref;
  91. return (ref = token[0]) === ']' || ref === 'INDEX_END';
  92. };
  93. action = function(token, i) {
  94. return token[0] = 'INDEX_END';
  95. };
  96. return this.scanTokens(function(token, i) {
  97. if (token[0] === 'INDEX_START') {
  98. this.detectEnd(i + 1, condition, action);
  99. }
  100. return 1;
  101. });
  102. };
  103. Rewriter.prototype.indexOfTag = function() {
  104. var fuzz, i, j, k, pattern, ref, ref1;
  105. i = arguments[0], pattern = 2 <= arguments.length ? slice.call(arguments, 1) : [];
  106. fuzz = 0;
  107. for (j = k = 0, ref = pattern.length; 0 <= ref ? k < ref : k > ref; j = 0 <= ref ? ++k : --k) {
  108. while (this.tag(i + j + fuzz) === 'HERECOMMENT') {
  109. fuzz += 2;
  110. }
  111. if (pattern[j] == null) {
  112. continue;
  113. }
  114. if (typeof pattern[j] === 'string') {
  115. pattern[j] = [pattern[j]];
  116. }
  117. if (ref1 = this.tag(i + j + fuzz), indexOf.call(pattern[j], ref1) < 0) {
  118. return -1;
  119. }
  120. }
  121. return i + j + fuzz - 1;
  122. };
  123. Rewriter.prototype.looksObjectish = function(j) {
  124. var end, index;
  125. if (this.indexOfTag(j, '@', null, ':') > -1 || this.indexOfTag(j, null, ':') > -1) {
  126. return true;
  127. }
  128. index = this.indexOfTag(j, EXPRESSION_START);
  129. if (index > -1) {
  130. end = null;
  131. this.detectEnd(index + 1, (function(token) {
  132. var ref;
  133. return ref = token[0], indexOf.call(EXPRESSION_END, ref) >= 0;
  134. }), (function(token, i) {
  135. return end = i;
  136. }));
  137. if (this.tag(end + 1) === ':') {
  138. return true;
  139. }
  140. }
  141. return false;
  142. };
  143. Rewriter.prototype.findTagsBackwards = function(i, tags) {
  144. var backStack, ref, ref1, ref2, ref3, ref4, ref5;
  145. backStack = [];
  146. while (i >= 0 && (backStack.length || (ref2 = this.tag(i), indexOf.call(tags, ref2) < 0) && ((ref3 = this.tag(i), indexOf.call(EXPRESSION_START, ref3) < 0) || this.tokens[i].generated) && (ref4 = this.tag(i), indexOf.call(LINEBREAKS, ref4) < 0))) {
  147. if (ref = this.tag(i), indexOf.call(EXPRESSION_END, ref) >= 0) {
  148. backStack.push(this.tag(i));
  149. }
  150. if ((ref1 = this.tag(i), indexOf.call(EXPRESSION_START, ref1) >= 0) && backStack.length) {
  151. backStack.pop();
  152. }
  153. i -= 1;
  154. }
  155. return ref5 = this.tag(i), indexOf.call(tags, ref5) >= 0;
  156. };
  157. Rewriter.prototype.addImplicitBracesAndParens = function() {
  158. var stack, start;
  159. stack = [];
  160. start = null;
  161. return this.scanTokens(function(token, i, tokens) {
  162. var endImplicitCall, endImplicitObject, forward, inImplicit, inImplicitCall, inImplicitControl, inImplicitObject, isImplicit, isImplicitCall, isImplicitObject, k, newLine, nextTag, offset, prevTag, prevToken, ref, ref1, ref2, ref3, ref4, ref5, s, sameLine, stackIdx, stackItem, stackTag, stackTop, startIdx, startImplicitCall, startImplicitObject, startsLine, tag;
  163. tag = token[0];
  164. prevTag = (prevToken = i > 0 ? tokens[i - 1] : [])[0];
  165. nextTag = (i < tokens.length - 1 ? tokens[i + 1] : [])[0];
  166. stackTop = function() {
  167. return stack[stack.length - 1];
  168. };
  169. startIdx = i;
  170. forward = function(n) {
  171. return i - startIdx + n;
  172. };
  173. isImplicit = function(stackItem) {
  174. var ref;
  175. return stackItem != null ? (ref = stackItem[2]) != null ? ref.ours : void 0 : void 0;
  176. };
  177. isImplicitObject = function(stackItem) {
  178. return isImplicit(stackItem) && (stackItem != null ? stackItem[0] : void 0) === '{';
  179. };
  180. isImplicitCall = function(stackItem) {
  181. return isImplicit(stackItem) && (stackItem != null ? stackItem[0] : void 0) === '(';
  182. };
  183. inImplicit = function() {
  184. return isImplicit(stackTop());
  185. };
  186. inImplicitCall = function() {
  187. return isImplicitCall(stackTop());
  188. };
  189. inImplicitObject = function() {
  190. return isImplicitObject(stackTop());
  191. };
  192. inImplicitControl = function() {
  193. var ref;
  194. return inImplicit && ((ref = stackTop()) != null ? ref[0] : void 0) === 'CONTROL';
  195. };
  196. startImplicitCall = function(j) {
  197. var idx;
  198. idx = j != null ? j : i;
  199. stack.push([
  200. '(', idx, {
  201. ours: true
  202. }
  203. ]);
  204. tokens.splice(idx, 0, generate('CALL_START', '('));
  205. if (j == null) {
  206. return i += 1;
  207. }
  208. };
  209. endImplicitCall = function() {
  210. stack.pop();
  211. tokens.splice(i, 0, generate('CALL_END', ')', ['', 'end of input', token[2]]));
  212. return i += 1;
  213. };
  214. startImplicitObject = function(j, startsLine) {
  215. var idx, val;
  216. if (startsLine == null) {
  217. startsLine = true;
  218. }
  219. idx = j != null ? j : i;
  220. stack.push([
  221. '{', idx, {
  222. sameLine: true,
  223. startsLine: startsLine,
  224. ours: true
  225. }
  226. ]);
  227. val = new String('{');
  228. val.generated = true;
  229. tokens.splice(idx, 0, generate('{', val, token));
  230. if (j == null) {
  231. return i += 1;
  232. }
  233. };
  234. endImplicitObject = function(j) {
  235. j = j != null ? j : i;
  236. stack.pop();
  237. tokens.splice(j, 0, generate('}', '}', token));
  238. return i += 1;
  239. };
  240. if (inImplicitCall() && (tag === 'IF' || tag === 'TRY' || tag === 'FINALLY' || tag === 'CATCH' || tag === 'CLASS' || tag === 'SWITCH')) {
  241. stack.push([
  242. 'CONTROL', i, {
  243. ours: true
  244. }
  245. ]);
  246. return forward(1);
  247. }
  248. if (tag === 'INDENT' && inImplicit()) {
  249. if (prevTag !== '=>' && prevTag !== '->' && prevTag !== '[' && prevTag !== '(' && prevTag !== ',' && prevTag !== '{' && prevTag !== 'TRY' && prevTag !== 'ELSE' && prevTag !== '=') {
  250. while (inImplicitCall()) {
  251. endImplicitCall();
  252. }
  253. }
  254. if (inImplicitControl()) {
  255. stack.pop();
  256. }
  257. stack.push([tag, i]);
  258. return forward(1);
  259. }
  260. if (indexOf.call(EXPRESSION_START, tag) >= 0) {
  261. stack.push([tag, i]);
  262. return forward(1);
  263. }
  264. if (indexOf.call(EXPRESSION_END, tag) >= 0) {
  265. while (inImplicit()) {
  266. if (inImplicitCall()) {
  267. endImplicitCall();
  268. } else if (inImplicitObject()) {
  269. endImplicitObject();
  270. } else {
  271. stack.pop();
  272. }
  273. }
  274. start = stack.pop();
  275. }
  276. if ((indexOf.call(IMPLICIT_FUNC, tag) >= 0 && token.spaced || tag === '?' && i > 0 && !tokens[i - 1].spaced) && (indexOf.call(IMPLICIT_CALL, nextTag) >= 0 || indexOf.call(IMPLICIT_UNSPACED_CALL, nextTag) >= 0 && !((ref = tokens[i + 1]) != null ? ref.spaced : void 0) && !((ref1 = tokens[i + 1]) != null ? ref1.newLine : void 0))) {
  277. if (tag === '?') {
  278. tag = token[0] = 'FUNC_EXIST';
  279. }
  280. startImplicitCall(i + 1);
  281. return forward(2);
  282. }
  283. if (indexOf.call(IMPLICIT_FUNC, tag) >= 0 && this.indexOfTag(i + 1, 'INDENT') > -1 && this.looksObjectish(i + 2) && !this.findTagsBackwards(i, ['CLASS', 'EXTENDS', 'IF', 'CATCH', 'SWITCH', 'LEADING_WHEN', 'FOR', 'WHILE', 'UNTIL'])) {
  284. startImplicitCall(i + 1);
  285. stack.push(['INDENT', i + 2]);
  286. return forward(3);
  287. }
  288. if (tag === ':') {
  289. s = (function() {
  290. var ref2;
  291. switch (false) {
  292. case ref2 = this.tag(i - 1), indexOf.call(EXPRESSION_END, ref2) < 0:
  293. return start[1];
  294. case this.tag(i - 2) !== '@':
  295. return i - 2;
  296. default:
  297. return i - 1;
  298. }
  299. }).call(this);
  300. while (this.tag(s - 2) === 'HERECOMMENT') {
  301. s -= 2;
  302. }
  303. this.insideForDeclaration = nextTag === 'FOR';
  304. startsLine = s === 0 || (ref2 = this.tag(s - 1), indexOf.call(LINEBREAKS, ref2) >= 0) || tokens[s - 1].newLine;
  305. if (stackTop()) {
  306. ref3 = stackTop(), stackTag = ref3[0], stackIdx = ref3[1];
  307. if ((stackTag === '{' || stackTag === 'INDENT' && this.tag(stackIdx - 1) === '{') && (startsLine || this.tag(s - 1) === ',' || this.tag(s - 1) === '{')) {
  308. return forward(1);
  309. }
  310. }
  311. startImplicitObject(s, !!startsLine);
  312. return forward(2);
  313. }
  314. if (indexOf.call(LINEBREAKS, tag) >= 0) {
  315. for (k = stack.length - 1; k >= 0; k += -1) {
  316. stackItem = stack[k];
  317. if (isImplicitObject(stackItem)) {
  318. stackItem[2].sameLine = false;
  319. }
  320. }
  321. }
  322. newLine = prevTag === 'OUTDENT' || prevToken.newLine;
  323. if (indexOf.call(IMPLICIT_END, tag) >= 0 || indexOf.call(CALL_CLOSERS, tag) >= 0 && newLine) {
  324. while (inImplicit()) {
  325. ref4 = stackTop(), stackTag = ref4[0], stackIdx = ref4[1], (ref5 = ref4[2], sameLine = ref5.sameLine, startsLine = ref5.startsLine);
  326. if (inImplicitCall() && prevTag !== ',') {
  327. endImplicitCall();
  328. } else if (inImplicitObject() && !this.insideForDeclaration && sameLine && tag !== 'TERMINATOR' && prevTag !== ':') {
  329. endImplicitObject();
  330. } else if (inImplicitObject() && tag === 'TERMINATOR' && prevTag !== ',' && !(startsLine && this.looksObjectish(i + 1))) {
  331. if (nextTag === 'HERECOMMENT') {
  332. return forward(1);
  333. }
  334. endImplicitObject();
  335. } else {
  336. break;
  337. }
  338. }
  339. }
  340. if (tag === ',' && !this.looksObjectish(i + 1) && inImplicitObject() && !this.insideForDeclaration && (nextTag !== 'TERMINATOR' || !this.looksObjectish(i + 2))) {
  341. offset = nextTag === 'OUTDENT' ? 1 : 0;
  342. while (inImplicitObject()) {
  343. endImplicitObject(i + offset);
  344. }
  345. }
  346. return forward(1);
  347. });
  348. };
  349. Rewriter.prototype.addLocationDataToGeneratedTokens = function() {
  350. return this.scanTokens(function(token, i, tokens) {
  351. var column, line, nextLocation, prevLocation, ref, ref1;
  352. if (token[2]) {
  353. return 1;
  354. }
  355. if (!(token.generated || token.explicit)) {
  356. return 1;
  357. }
  358. if (token[0] === '{' && (nextLocation = (ref = tokens[i + 1]) != null ? ref[2] : void 0)) {
  359. line = nextLocation.first_line, column = nextLocation.first_column;
  360. } else if (prevLocation = (ref1 = tokens[i - 1]) != null ? ref1[2] : void 0) {
  361. line = prevLocation.last_line, column = prevLocation.last_column;
  362. } else {
  363. line = column = 0;
  364. }
  365. token[2] = {
  366. first_line: line,
  367. first_column: column,
  368. last_line: line,
  369. last_column: column
  370. };
  371. return 1;
  372. });
  373. };
  374. Rewriter.prototype.fixOutdentLocationData = function() {
  375. return this.scanTokens(function(token, i, tokens) {
  376. var prevLocationData;
  377. if (!(token[0] === 'OUTDENT' || (token.generated && token[0] === 'CALL_END') || (token.generated && token[0] === '}'))) {
  378. return 1;
  379. }
  380. prevLocationData = tokens[i - 1][2];
  381. token[2] = {
  382. first_line: prevLocationData.last_line,
  383. first_column: prevLocationData.last_column,
  384. last_line: prevLocationData.last_line,
  385. last_column: prevLocationData.last_column
  386. };
  387. return 1;
  388. });
  389. };
  390. Rewriter.prototype.normalizeLines = function() {
  391. var action, condition, indent, outdent, starter;
  392. starter = indent = outdent = null;
  393. condition = function(token, i) {
  394. var ref, ref1, ref2, ref3;
  395. return token[1] !== ';' && (ref = token[0], indexOf.call(SINGLE_CLOSERS, ref) >= 0) && !(token[0] === 'TERMINATOR' && (ref1 = this.tag(i + 1), indexOf.call(EXPRESSION_CLOSE, ref1) >= 0)) && !(token[0] === 'ELSE' && starter !== 'THEN') && !(((ref2 = token[0]) === 'CATCH' || ref2 === 'FINALLY') && (starter === '->' || starter === '=>')) || (ref3 = token[0], indexOf.call(CALL_CLOSERS, ref3) >= 0) && (this.tokens[i - 1].newLine || this.tokens[i - 1][0] === 'OUTDENT');
  396. };
  397. action = function(token, i) {
  398. return this.tokens.splice((this.tag(i - 1) === ',' ? i - 1 : i), 0, outdent);
  399. };
  400. return this.scanTokens(function(token, i, tokens) {
  401. var j, k, ref, ref1, ref2, tag;
  402. tag = token[0];
  403. if (tag === 'TERMINATOR') {
  404. if (this.tag(i + 1) === 'ELSE' && this.tag(i - 1) !== 'OUTDENT') {
  405. tokens.splice.apply(tokens, [i, 1].concat(slice.call(this.indentation())));
  406. return 1;
  407. }
  408. if (ref = this.tag(i + 1), indexOf.call(EXPRESSION_CLOSE, ref) >= 0) {
  409. tokens.splice(i, 1);
  410. return 0;
  411. }
  412. }
  413. if (tag === 'CATCH') {
  414. for (j = k = 1; k <= 2; j = ++k) {
  415. if (!((ref1 = this.tag(i + j)) === 'OUTDENT' || ref1 === 'TERMINATOR' || ref1 === 'FINALLY')) {
  416. continue;
  417. }
  418. tokens.splice.apply(tokens, [i + j, 0].concat(slice.call(this.indentation())));
  419. return 2 + j;
  420. }
  421. }
  422. if (indexOf.call(SINGLE_LINERS, tag) >= 0 && this.tag(i + 1) !== 'INDENT' && !(tag === 'ELSE' && this.tag(i + 1) === 'IF')) {
  423. starter = tag;
  424. ref2 = this.indentation(tokens[i]), indent = ref2[0], outdent = ref2[1];
  425. if (starter === 'THEN') {
  426. indent.fromThen = true;
  427. }
  428. tokens.splice(i + 1, 0, indent);
  429. this.detectEnd(i + 2, condition, action);
  430. if (tag === 'THEN') {
  431. tokens.splice(i, 1);
  432. }
  433. return 1;
  434. }
  435. return 1;
  436. });
  437. };
  438. Rewriter.prototype.tagPostfixConditionals = function() {
  439. var action, condition, original;
  440. original = null;
  441. condition = function(token, i) {
  442. var prevTag, tag;
  443. tag = token[0];
  444. prevTag = this.tokens[i - 1][0];
  445. return tag === 'TERMINATOR' || (tag === 'INDENT' && indexOf.call(SINGLE_LINERS, prevTag) < 0);
  446. };
  447. action = function(token, i) {
  448. if (token[0] !== 'INDENT' || (token.generated && !token.fromThen)) {
  449. return original[0] = 'POST_' + original[0];
  450. }
  451. };
  452. return this.scanTokens(function(token, i) {
  453. if (token[0] !== 'IF') {
  454. return 1;
  455. }
  456. original = token;
  457. this.detectEnd(i + 1, condition, action);
  458. return 1;
  459. });
  460. };
  461. Rewriter.prototype.indentation = function(origin) {
  462. var indent, outdent;
  463. indent = ['INDENT', 2];
  464. outdent = ['OUTDENT', 2];
  465. if (origin) {
  466. indent.generated = outdent.generated = true;
  467. indent.origin = outdent.origin = origin;
  468. } else {
  469. indent.explicit = outdent.explicit = true;
  470. }
  471. return [indent, outdent];
  472. };
  473. Rewriter.prototype.generate = generate;
  474. Rewriter.prototype.tag = function(i) {
  475. var ref;
  476. return (ref = this.tokens[i]) != null ? ref[0] : void 0;
  477. };
  478. return Rewriter;
  479. })();
  480. BALANCED_PAIRS = [['(', ')'], ['[', ']'], ['{', '}'], ['INDENT', 'OUTDENT'], ['CALL_START', 'CALL_END'], ['PARAM_START', 'PARAM_END'], ['INDEX_START', 'INDEX_END'], ['STRING_START', 'STRING_END'], ['REGEX_START', 'REGEX_END']];
  481. exports.INVERSES = INVERSES = {};
  482. EXPRESSION_START = [];
  483. EXPRESSION_END = [];
  484. for (k = 0, len = BALANCED_PAIRS.length; k < len; k++) {
  485. ref = BALANCED_PAIRS[k], left = ref[0], rite = ref[1];
  486. EXPRESSION_START.push(INVERSES[rite] = left);
  487. EXPRESSION_END.push(INVERSES[left] = rite);
  488. }
  489. EXPRESSION_CLOSE = ['CATCH', 'THEN', 'ELSE', 'FINALLY'].concat(EXPRESSION_END);
  490. IMPLICIT_FUNC = ['IDENTIFIER', 'PROPERTY', 'SUPER', ')', 'CALL_END', ']', 'INDEX_END', '@', 'THIS'];
  491. IMPLICIT_CALL = ['IDENTIFIER', 'PROPERTY', 'NUMBER', 'INFINITY', 'NAN', 'STRING', 'STRING_START', 'REGEX', 'REGEX_START', 'JS', 'NEW', 'PARAM_START', 'CLASS', 'IF', 'TRY', 'SWITCH', 'THIS', 'UNDEFINED', 'NULL', 'BOOL', 'UNARY', 'YIELD', 'UNARY_MATH', 'SUPER', 'THROW', '@', '->', '=>', '[', '(', '{', '--', '++'];
  492. IMPLICIT_UNSPACED_CALL = ['+', '-'];
  493. IMPLICIT_END = ['POST_IF', 'FOR', 'WHILE', 'UNTIL', 'WHEN', 'BY', 'LOOP', 'TERMINATOR'];
  494. SINGLE_LINERS = ['ELSE', '->', '=>', 'TRY', 'FINALLY', 'THEN'];
  495. SINGLE_CLOSERS = ['TERMINATOR', 'CATCH', 'FINALLY', 'ELSE', 'OUTDENT', 'LEADING_WHEN'];
  496. LINEBREAKS = ['TERMINATOR', 'INDENT', 'OUTDENT'];
  497. CALL_CLOSERS = ['.', '?.', '::', '?::'];
  498. }).call(this);