commit
message
Converted parser.js to typescript
author
Ben Vogt <[email protected]>
date
2017-07-08 14:43:36
stats
9 file(s) changed,
2991 insertions(+),
1775 deletions(-)
files
TODO.md
dist/NewParser.js
dist/Sheet.js
dist/parser.js
lib/parser.js
src/Parser.ts
package.json
src/Parser.d.ts
src/Sheet.ts
tests.sh
1diff --git a/TODO.md b/TODO.md
2index 85bd4be..3823d59 100644
3--- a/TODO.md
4+++ b/TODO.md
5@@ -25,29 +25,29 @@ For example 64 tbs to a qt.
6
7 ### Formulas to write
8
9-* ERROR.TYPE - Requires changes to parser.js
10-* ISBLANK - Requires changes to parser.js
11-* ISERR - Requires changes to parser.js
12-* ISERROR - Requires changes to parser.js
13-* ISFORMULA - Requires changes to parser.js
14-* ISNA - Requires changes to parser.js
15-* ISREF - Requires changes to parser.js
16-* TYPE - Requires changes to parser.js
17-* CELL - Requires changes to parser.js
18-* IFERROR - Requires changes to parser.js
19-* ADDRESS - Requires changes to parser.js
20-* COLUMN - Requires changes to parser.js
21-* COLUMNS - Requires changes to parser.js
22-* HLOOKUP - Requires changes to parser.js
23-* INDEX - Requires changes to parser.js
24-* INDIRECT - Requires changes to parser.js
25-* LOOKUP - Requires changes to parser.js
26-* MATCH - Requires changes to parser.js
27-* OFFSET - Requires changes to parser.js
28-* ROW - Requires changes to parser.js
29-* ROWS - Requires changes to parser.js
30-* VLOOKUP - Requires changes to parser.js
31-* COUNTBLANK - Requires changes to parser.js
32+* ERROR.TYPE - Requires changes to Parser.ts
33+* ISBLANK - Requires changes to Parser.ts
34+* ISERR - Requires changes to Parser.ts
35+* ISERROR - Requires changes to Parser.ts
36+* ISFORMULA - Requires changes to Parser.ts
37+* ISNA - Requires changes to Parser.ts
38+* ISREF - Requires changes to Parser.ts
39+* TYPE - Requires changes to Parser.ts
40+* CELL - Requires changes to Parser.ts
41+* IFERROR - Requires changes to Parser.ts
42+* ADDRESS - Requires changes to Parser.ts
43+* COLUMN - Requires changes to Parser.ts
44+* COLUMNS - Requires changes to Parser.ts
45+* HLOOKUP - Requires changes to Parser.ts
46+* INDEX - Requires changes to Parser.ts
47+* INDIRECT - Requires changes to Parser.ts
48+* LOOKUP - Requires changes to Parser.ts
49+* MATCH - Requires changes to Parser.ts
50+* OFFSET - Requires changes to Parser.ts
51+* ROW - Requires changes to Parser.ts
52+* ROWS - Requires changes to Parser.ts
53+* VLOOKUP - Requires changes to Parser.ts
54+* COUNTBLANK - Requires changes to
55 * SERIESSUM
56 * SUBTOTAL
57 * TO_DATE - Contingent upon cells having display formats derived from type-hierarchy
58diff --git a/dist/NewParser.js b/dist/NewParser.js
59new file mode 100644
60index 0000000..becf7b6
61--- /dev/null
62+++ b/dist/NewParser.js
63@@ -0,0 +1,1425 @@
64+"use strict";
65+exports.__esModule = true;
66+/* parser generated by jison 0.4.15 */
67+/*
68+ Returns a Parser object of the following structure:
69+
70+ Parser: {
71+ yy: {}
72+ }
73+
74+ Parser.prototype: {
75+ yy: {},
76+ trace: function(),
77+ symbols_: {associative list: name ==> number},
78+ terminals_: {associative list: number ==> name},
79+ productions_: [...],
80+ performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
81+ table: [...],
82+ defaultActions: {...},
83+ parseError: function(str, hash),
84+ parse: function(input),
85+
86+ lexer: {
87+ EOF: 1,
88+ parseError: function(str, hash),
89+ setInput: function(input),
90+ input: function(),
91+ unput: function(str),
92+ more: function(),
93+ less: function(n),
94+ pastInput: function(),
95+ upcomingInput: function(),
96+ showPosition: function(),
97+ test_match: function(regex_match_array, rule_index),
98+ next: function(),
99+ lex: function(),
100+ begin: function(condition),
101+ popState: function(),
102+ _currentRules: function(),
103+ topState: function(),
104+ pushState: function(condition),
105+
106+ options: {
107+ ranges: boolean (optional: true ==> token location info will include a .range[] member)
108+ flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
109+ backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code)
110+ },
111+
112+ performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
113+ rules: [...],
114+ conditions: {associative list: name ==> set},
115+ }
116+ }
117+
118+
119+ token location info (@$, _$, etc.): {
120+ first_line: n,
121+ last_line: n,
122+ first_column: n,
123+ last_column: n,
124+ range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
125+ }
126+
127+
128+ the parseError function receives a 'hash' object with these members for lexer and parser errors: {
129+ text: (matched text)
130+ token: (the produced terminal token, if any)
131+ line: (yylineno)
132+ }
133+ while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
134+ loc: (yylloc)
135+ expected: (string describing the set of expected tokens)
136+ recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
137+ }
138+ */
139+var Parser = (function () {
140+ var o = function (k, v, o, l) {
141+ for (o = o || {}, l = k.length; l--; o[k[l]] = v) {
142+ }
143+ return o;
144+ }, $V0 = [1, 4], $V1 = [1, 5], $V2 = [1, 7], $V3 = [1, 10], $V4 = [1, 8], $V5 = [1, 9], $V6 = [1, 11], $V7 = [1, 16], $V8 = [1, 17], $V9 = [1, 14], $Va = [1, 15], $Vb = [1, 18], $Vc = [1, 20], $Vd = [1, 21], $Ve = [1, 22], $Vf = [1, 23], $Vg = [1, 24], $Vh = [1, 25], $Vi = [1, 26], $Vj = [1, 27], $Vk = [1, 28], $Vl = [1, 29], $Vm = [5, 11, 12, 13, 15, 16, 17, 18, 19, 20, 21, 22, 30, 31], $Vn = [5, 11, 12, 13, 15, 16, 17, 18, 19, 20, 21, 22, 30, 31, 33], $Vo = [1, 38], $Vp = [5, 11, 12, 13, 15, 16, 17, 18, 19, 20, 21, 22, 30, 31, 35], $Vq = [5, 12, 13, 15, 16, 17, 18, 19, 30, 31], $Vr = [5, 12, 15, 16, 17, 18, 30, 31], $Vs = [5, 12, 13, 15, 16, 17, 18, 19, 20, 21, 30, 31], $Vt = [15, 30, 31], $Vu = [5, 11, 12, 13, 15, 16, 17, 18, 19, 20, 21, 22, 30, 31, 32, 36];
145+ var parser = {
146+ lexer: undefined,
147+ Parser: undefined,
148+ trace: function trace() {
149+ },
150+ yy: {},
151+ symbols_: {
152+ "error": 2,
153+ "expressions": 3,
154+ "expression": 4,
155+ "EOF": 5,
156+ "variableSequence": 6,
157+ "TIME_AMPM": 7,
158+ "TIME_24": 8,
159+ "number": 9,
160+ "STRING": 10,
161+ "&": 11,
162+ "=": 12,
163+ "+": 13,
164+ "(": 14,
165+ ")": 15,
166+ "<": 16,
167+ ">": 17,
168+ "NOT": 18,
169+ "-": 19,
170+ "*": 20,
171+ "/": 21,
172+ "^": 22,
173+ "FUNCTION": 23,
174+ "expseq": 24,
175+ "cell": 25,
176+ "FIXEDCELL": 26,
177+ ":": 27,
178+ "CELL": 28,
179+ "ARRAY": 29,
180+ ";": 30,
181+ ",": 31,
182+ "VARIABLE": 32,
183+ "DECIMAL": 33,
184+ "NUMBER": 34,
185+ "%": 35,
186+ "#": 36,
187+ "!": 37,
188+ "$accept": 0,
189+ "$end": 1
190+ },
191+ terminals_: {
192+ 5: "EOF",
193+ 7: "TIME_AMPM",
194+ 8: "TIME_24",
195+ 10: "STRING",
196+ 11: "&",
197+ 12: "=",
198+ 13: "+",
199+ 14: "(",
200+ 15: ")",
201+ 16: "<",
202+ 17: ">",
203+ 18: "NOT",
204+ 19: "-",
205+ 20: "*",
206+ 21: "/",
207+ 22: "^",
208+ 23: "FUNCTION",
209+ 26: "FIXEDCELL",
210+ 27: ":",
211+ 28: "CELL",
212+ 29: "ARRAY",
213+ 30: ";",
214+ 31: ",",
215+ 32: "VARIABLE",
216+ 33: "DECIMAL",
217+ 34: "NUMBER",
218+ 35: "%",
219+ 36: "#",
220+ 37: "!"
221+ },
222+ productions_: [0, [3, 2], [4, 1], [4, 1], [4, 1], [4, 1], [4, 1], [4, 3], [4, 3], [4, 3], [4, 3], [4, 4], [4, 4], [4, 4], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 2], [4, 2], [4, 3], [4, 4], [4, 1], [4, 1], [4, 2], [25, 1], [25, 3], [25, 1], [25, 3], [24, 1], [24, 1], [24, 3], [24, 3], [6, 1], [6, 3], [9, 1], [9, 3], [9, 2], [2, 3], [2, 4]],
223+ performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
224+ /* this == yyval */
225+ var $0 = $$.length - 1;
226+ switch (yystate) {
227+ case 1:
228+ return $$[$0 - 1];
229+ case 2:
230+ this.$ = yy.handler.helper.callVariable.call(this, $$[$0]);
231+ break;
232+ case 3:
233+ this.$ = yy.handler.time.call(yy.obj, $$[$0], true);
234+ break;
235+ case 4:
236+ this.$ = yy.handler.time.call(yy.obj, $$[$0]);
237+ break;
238+ case 5:
239+ this.$ = yy.handler.helper.number($$[$0]);
240+ break;
241+ case 6:
242+ this.$ = yy.handler.helper.string($$[$0]);
243+ break;
244+ case 7:
245+ this.$ = yy.handler.helper.specialMatch('&', $$[$0 - 2], $$[$0]);
246+ break;
247+ case 8:
248+ this.$ = yy.handler.helper.logicMatch('=', $$[$0 - 2], $$[$0]);
249+ break;
250+ case 9:
251+ this.$ = yy.handler.helper.mathMatch('+', $$[$0 - 2], $$[$0]);
252+ break;
253+ case 10:
254+ this.$ = yy.handler.helper.number($$[$0 - 1]);
255+ break;
256+ case 11:
257+ this.$ = yy.handler.helper.logicMatch('<=', $$[$0 - 3], $$[$0]);
258+ break;
259+ case 12:
260+ this.$ = yy.handler.helper.logicMatch('>=', $$[$0 - 3], $$[$0]);
261+ break;
262+ case 13:
263+ this.$ = yy.handler.helper.logicMatch('<>', $$[$0 - 3], $$[$0]);
264+ break;
265+ case 14:
266+ this.$ = yy.handler.helper.logicMatch('NOT', $$[$0 - 2], $$[$0]);
267+ break;
268+ case 15:
269+ this.$ = yy.handler.helper.logicMatch('>', $$[$0 - 2], $$[$0]);
270+ break;
271+ case 16:
272+ this.$ = yy.handler.helper.logicMatch('<', $$[$0 - 2], $$[$0]);
273+ break;
274+ case 17:
275+ this.$ = yy.handler.helper.mathMatch('-', $$[$0 - 2], $$[$0]);
276+ break;
277+ case 18:
278+ this.$ = yy.handler.helper.mathMatch('*', $$[$0 - 2], $$[$0]);
279+ break;
280+ case 19:
281+ this.$ = yy.handler.helper.mathMatch('/', $$[$0 - 2], $$[$0]);
282+ break;
283+ case 20:
284+ this.$ = yy.handler.helper.mathMatch('^', $$[$0 - 2], $$[$0]);
285+ break;
286+ case 21:
287+ var n1 = yy.handler.helper.numberInverted($$[$0]);
288+ this.$ = n1;
289+ if (isNaN(this.$)) {
290+ this.$ = 0;
291+ }
292+ break;
293+ case 22:
294+ var n1 = yy.handler.helper.number($$[$0]);
295+ this.$ = n1;
296+ if (isNaN(this.$)) {
297+ this.$ = 0;
298+ }
299+ break;
300+ case 23:
301+ this.$ = yy.handler.helper.callFunction.call(this, $$[$0 - 2], '');
302+ break;
303+ case 24:
304+ this.$ = yy.handler.helper.callFunction.call(this, $$[$0 - 3], $$[$0 - 1]);
305+ break;
306+ case 28:
307+ this.$ = yy.handler.helper.fixedCellValue.call(yy.obj, $$[$0]);
308+ break;
309+ case 29:
310+ this.$ = yy.handler.helper.fixedCellRangeValue.call(yy.obj, $$[$0 - 2], $$[$0]);
311+ break;
312+ case 30:
313+ this.$ = yy.handler.helper.cellValue.call(yy.obj, $$[$0]);
314+ break;
315+ case 31:
316+ this.$ = yy.handler.helper.cellRangeValue.call(yy.obj, $$[$0 - 2], $$[$0]);
317+ break;
318+ case 32:
319+ if (yy.handler.utils.isArray($$[$0])) {
320+ this.$ = $$[$0];
321+ }
322+ else {
323+ this.$ = [$$[$0]];
324+ }
325+ break;
326+ case 33:
327+ var result = [], arr = eval("[" + yytext + "]");
328+ arr.forEach(function (item) {
329+ result.push(item);
330+ });
331+ this.$ = result;
332+ break;
333+ case 34:
334+ case 35:
335+ $$[$0 - 2].push($$[$0]);
336+ this.$ = $$[$0 - 2];
337+ break;
338+ case 36:
339+ this.$ = [$$[$0]];
340+ break;
341+ case 37:
342+ this.$ = (yy.handler.utils.isArray($$[$0 - 2]) ? $$[$0 - 2] : [$$[$0 - 2]]);
343+ this.$.push($$[$0]);
344+ break;
345+ case 38:
346+ this.$ = $$[$0];
347+ break;
348+ case 39:
349+ this.$ = parseFloat($$[$0 - 2] + '.' + $$[$0]) * 1;
350+ break;
351+ case 40:
352+ this.$ = $$[$0 - 1] * 0.01;
353+ break;
354+ case 41:
355+ case 42:
356+ this.$ = $$[$0 - 2] + $$[$0 - 1] + $$[$0];
357+ break;
358+ }
359+ },
360+ table: [{
361+ 2: 13,
362+ 3: 1,
363+ 4: 2,
364+ 6: 3,
365+ 7: $V0,
366+ 8: $V1,
367+ 9: 6,
368+ 10: $V2,
369+ 13: $V3,
370+ 14: $V4,
371+ 19: $V5,
372+ 23: $V6,
373+ 25: 12,
374+ 26: $V7,
375+ 28: $V8,
376+ 32: $V9,
377+ 34: $Va,
378+ 36: $Vb
379+ }, { 1: [3] }, {
380+ 5: [1, 19],
381+ 11: $Vc,
382+ 12: $Vd,
383+ 13: $Ve,
384+ 16: $Vf,
385+ 17: $Vg,
386+ 18: $Vh,
387+ 19: $Vi,
388+ 20: $Vj,
389+ 21: $Vk,
390+ 22: $Vl
391+ }, o($Vm, [2, 2], { 33: [1, 30] }), o($Vm, [2, 3]), o($Vm, [2, 4]), o($Vm, [2, 5], { 35: [1, 31] }), o($Vm, [2, 6]), {
392+ 2: 13,
393+ 4: 32,
394+ 6: 3,
395+ 7: $V0,
396+ 8: $V1,
397+ 9: 6,
398+ 10: $V2,
399+ 13: $V3,
400+ 14: $V4,
401+ 19: $V5,
402+ 23: $V6,
403+ 25: 12,
404+ 26: $V7,
405+ 28: $V8,
406+ 32: $V9,
407+ 34: $Va,
408+ 36: $Vb
409+ }, {
410+ 2: 13,
411+ 4: 33,
412+ 6: 3,
413+ 7: $V0,
414+ 8: $V1,
415+ 9: 6,
416+ 10: $V2,
417+ 13: $V3,
418+ 14: $V4,
419+ 19: $V5,
420+ 23: $V6,
421+ 25: 12,
422+ 26: $V7,
423+ 28: $V8,
424+ 32: $V9,
425+ 34: $Va,
426+ 36: $Vb
427+ }, {
428+ 2: 13,
429+ 4: 34,
430+ 6: 3,
431+ 7: $V0,
432+ 8: $V1,
433+ 9: 6,
434+ 10: $V2,
435+ 13: $V3,
436+ 14: $V4,
437+ 19: $V5,
438+ 23: $V6,
439+ 25: 12,
440+ 26: $V7,
441+ 28: $V8,
442+ 32: $V9,
443+ 34: $Va,
444+ 36: $Vb
445+ }, { 14: [1, 35] }, o($Vm, [2, 25]), o($Vm, [2, 26], {
446+ 2: 36,
447+ 32: [1, 37],
448+ 36: $Vb
449+ }), o($Vn, [2, 36], { 36: $Vo }), o($Vp, [2, 38], { 33: [1, 39] }), o($Vm, [2, 28], { 27: [1, 40] }), o($Vm, [2, 30], { 27: [1, 41] }), { 32: [1, 42] }, { 1: [2, 1] }, {
450+ 2: 13,
451+ 4: 43,
452+ 6: 3,
453+ 7: $V0,
454+ 8: $V1,
455+ 9: 6,
456+ 10: $V2,
457+ 13: $V3,
458+ 14: $V4,
459+ 19: $V5,
460+ 23: $V6,
461+ 25: 12,
462+ 26: $V7,
463+ 28: $V8,
464+ 32: $V9,
465+ 34: $Va,
466+ 36: $Vb
467+ }, {
468+ 2: 13,
469+ 4: 44,
470+ 6: 3,
471+ 7: $V0,
472+ 8: $V1,
473+ 9: 6,
474+ 10: $V2,
475+ 13: $V3,
476+ 14: $V4,
477+ 19: $V5,
478+ 23: $V6,
479+ 25: 12,
480+ 26: $V7,
481+ 28: $V8,
482+ 32: $V9,
483+ 34: $Va,
484+ 36: $Vb
485+ }, {
486+ 2: 13,
487+ 4: 45,
488+ 6: 3,
489+ 7: $V0,
490+ 8: $V1,
491+ 9: 6,
492+ 10: $V2,
493+ 13: $V3,
494+ 14: $V4,
495+ 19: $V5,
496+ 23: $V6,
497+ 25: 12,
498+ 26: $V7,
499+ 28: $V8,
500+ 32: $V9,
501+ 34: $Va,
502+ 36: $Vb
503+ }, {
504+ 2: 13,
505+ 4: 48,
506+ 6: 3,
507+ 7: $V0,
508+ 8: $V1,
509+ 9: 6,
510+ 10: $V2,
511+ 12: [1, 46],
512+ 13: $V3,
513+ 14: $V4,
514+ 17: [1, 47],
515+ 19: $V5,
516+ 23: $V6,
517+ 25: 12,
518+ 26: $V7,
519+ 28: $V8,
520+ 32: $V9,
521+ 34: $Va,
522+ 36: $Vb
523+ }, {
524+ 2: 13,
525+ 4: 50,
526+ 6: 3,
527+ 7: $V0,
528+ 8: $V1,
529+ 9: 6,
530+ 10: $V2,
531+ 12: [1, 49],
532+ 13: $V3,
533+ 14: $V4,
534+ 19: $V5,
535+ 23: $V6,
536+ 25: 12,
537+ 26: $V7,
538+ 28: $V8,
539+ 32: $V9,
540+ 34: $Va,
541+ 36: $Vb
542+ }, {
543+ 2: 13,
544+ 4: 51,
545+ 6: 3,
546+ 7: $V0,
547+ 8: $V1,
548+ 9: 6,
549+ 10: $V2,
550+ 13: $V3,
551+ 14: $V4,
552+ 19: $V5,
553+ 23: $V6,
554+ 25: 12,
555+ 26: $V7,
556+ 28: $V8,
557+ 32: $V9,
558+ 34: $Va,
559+ 36: $Vb
560+ }, {
561+ 2: 13,
562+ 4: 52,
563+ 6: 3,
564+ 7: $V0,
565+ 8: $V1,
566+ 9: 6,
567+ 10: $V2,
568+ 13: $V3,
569+ 14: $V4,
570+ 19: $V5,
571+ 23: $V6,
572+ 25: 12,
573+ 26: $V7,
574+ 28: $V8,
575+ 32: $V9,
576+ 34: $Va,
577+ 36: $Vb
578+ }, {
579+ 2: 13,
580+ 4: 53,
581+ 6: 3,
582+ 7: $V0,
583+ 8: $V1,
584+ 9: 6,
585+ 10: $V2,
586+ 13: $V3,
587+ 14: $V4,
588+ 19: $V5,
589+ 23: $V6,
590+ 25: 12,
591+ 26: $V7,
592+ 28: $V8,
593+ 32: $V9,
594+ 34: $Va,
595+ 36: $Vb
596+ }, {
597+ 2: 13,
598+ 4: 54,
599+ 6: 3,
600+ 7: $V0,
601+ 8: $V1,
602+ 9: 6,
603+ 10: $V2,
604+ 13: $V3,
605+ 14: $V4,
606+ 19: $V5,
607+ 23: $V6,
608+ 25: 12,
609+ 26: $V7,
610+ 28: $V8,
611+ 32: $V9,
612+ 34: $Va,
613+ 36: $Vb
614+ }, {
615+ 2: 13,
616+ 4: 55,
617+ 6: 3,
618+ 7: $V0,
619+ 8: $V1,
620+ 9: 6,
621+ 10: $V2,
622+ 13: $V3,
623+ 14: $V4,
624+ 19: $V5,
625+ 23: $V6,
626+ 25: 12,
627+ 26: $V7,
628+ 28: $V8,
629+ 32: $V9,
630+ 34: $Va,
631+ 36: $Vb
632+ }, { 32: [1, 56] }, o($Vp, [2, 40]), {
633+ 11: $Vc,
634+ 12: $Vd,
635+ 13: $Ve,
636+ 15: [1, 57],
637+ 16: $Vf,
638+ 17: $Vg,
639+ 18: $Vh,
640+ 19: $Vi,
641+ 20: $Vj,
642+ 21: $Vk,
643+ 22: $Vl
644+ }, o($Vq, [2, 21], { 11: $Vc, 20: $Vj, 21: $Vk, 22: $Vl }), o($Vq, [2, 22], {
645+ 11: $Vc,
646+ 20: $Vj,
647+ 21: $Vk,
648+ 22: $Vl
649+ }), {
650+ 2: 13,
651+ 4: 60,
652+ 6: 3,
653+ 7: $V0,
654+ 8: $V1,
655+ 9: 6,
656+ 10: $V2,
657+ 13: $V3,
658+ 14: $V4,
659+ 15: [1, 58],
660+ 19: $V5,
661+ 23: $V6,
662+ 24: 59,
663+ 25: 12,
664+ 26: $V7,
665+ 28: $V8,
666+ 29: [1, 61],
667+ 32: $V9,
668+ 34: $Va,
669+ 36: $Vb
670+ }, o($Vm, [2, 27]), { 36: $Vo }, { 32: [1, 62] }, { 34: [1, 63] }, { 26: [1, 64] }, { 28: [1, 65] }, { 37: [1, 66] }, o($Vm, [2, 7]), o([5, 12, 15, 30, 31], [2, 8], {
671+ 11: $Vc,
672+ 13: $Ve,
673+ 16: $Vf,
674+ 17: $Vg,
675+ 18: $Vh,
676+ 19: $Vi,
677+ 20: $Vj,
678+ 21: $Vk,
679+ 22: $Vl
680+ }), o($Vq, [2, 9], { 11: $Vc, 20: $Vj, 21: $Vk, 22: $Vl }), {
681+ 2: 13,
682+ 4: 67,
683+ 6: 3,
684+ 7: $V0,
685+ 8: $V1,
686+ 9: 6,
687+ 10: $V2,
688+ 13: $V3,
689+ 14: $V4,
690+ 19: $V5,
691+ 23: $V6,
692+ 25: 12,
693+ 26: $V7,
694+ 28: $V8,
695+ 32: $V9,
696+ 34: $Va,
697+ 36: $Vb
698+ }, {
699+ 2: 13,
700+ 4: 68,
701+ 6: 3,
702+ 7: $V0,
703+ 8: $V1,
704+ 9: 6,
705+ 10: $V2,
706+ 13: $V3,
707+ 14: $V4,
708+ 19: $V5,
709+ 23: $V6,
710+ 25: 12,
711+ 26: $V7,
712+ 28: $V8,
713+ 32: $V9,
714+ 34: $Va,
715+ 36: $Vb
716+ }, o($Vr, [2, 16], { 11: $Vc, 13: $Ve, 19: $Vi, 20: $Vj, 21: $Vk, 22: $Vl }), {
717+ 2: 13,
718+ 4: 69,
719+ 6: 3,
720+ 7: $V0,
721+ 8: $V1,
722+ 9: 6,
723+ 10: $V2,
724+ 13: $V3,
725+ 14: $V4,
726+ 19: $V5,
727+ 23: $V6,
728+ 25: 12,
729+ 26: $V7,
730+ 28: $V8,
731+ 32: $V9,
732+ 34: $Va,
733+ 36: $Vb
734+ }, o($Vr, [2, 15], {
735+ 11: $Vc,
736+ 13: $Ve,
737+ 19: $Vi,
738+ 20: $Vj,
739+ 21: $Vk,
740+ 22: $Vl
741+ }), o([5, 12, 15, 18, 30, 31], [2, 14], {
742+ 11: $Vc,
743+ 13: $Ve,
744+ 16: $Vf,
745+ 17: $Vg,
746+ 19: $Vi,
747+ 20: $Vj,
748+ 21: $Vk,
749+ 22: $Vl
750+ }), o($Vq, [2, 17], { 11: $Vc, 20: $Vj, 21: $Vk, 22: $Vl }), o($Vs, [2, 18], {
751+ 11: $Vc,
752+ 22: $Vl
753+ }), o($Vs, [2, 19], {
754+ 11: $Vc,
755+ 22: $Vl
756+ }), o([5, 12, 13, 15, 16, 17, 18, 19, 20, 21, 22, 30, 31], [2, 20], { 11: $Vc }), o($Vn, [2, 37]), o($Vm, [2, 10]), o($Vm, [2, 23]), {
757+ 15: [1, 70],
758+ 30: [1, 71],
759+ 31: [1, 72]
760+ }, o($Vt, [2, 32], {
761+ 11: $Vc,
762+ 12: $Vd,
763+ 13: $Ve,
764+ 16: $Vf,
765+ 17: $Vg,
766+ 18: $Vh,
767+ 19: $Vi,
768+ 20: $Vj,
769+ 21: $Vk,
770+ 22: $Vl
771+ }), o($Vt, [2, 33]), { 37: [1, 73] }, o($Vp, [2, 39]), o($Vm, [2, 29]), o($Vm, [2, 31]), o($Vu, [2, 41]), o($Vr, [2, 11], {
772+ 11: $Vc,
773+ 13: $Ve,
774+ 19: $Vi,
775+ 20: $Vj,
776+ 21: $Vk,
777+ 22: $Vl
778+ }), o($Vr, [2, 13], { 11: $Vc, 13: $Ve, 19: $Vi, 20: $Vj, 21: $Vk, 22: $Vl }), o($Vr, [2, 12], {
779+ 11: $Vc,
780+ 13: $Ve,
781+ 19: $Vi,
782+ 20: $Vj,
783+ 21: $Vk,
784+ 22: $Vl
785+ }), o($Vm, [2, 24]), {
786+ 2: 13,
787+ 4: 74,
788+ 6: 3,
789+ 7: $V0,
790+ 8: $V1,
791+ 9: 6,
792+ 10: $V2,
793+ 13: $V3,
794+ 14: $V4,
795+ 19: $V5,
796+ 23: $V6,
797+ 25: 12,
798+ 26: $V7,
799+ 28: $V8,
800+ 32: $V9,
801+ 34: $Va,
802+ 36: $Vb
803+ }, {
804+ 2: 13,
805+ 4: 75,
806+ 6: 3,
807+ 7: $V0,
808+ 8: $V1,
809+ 9: 6,
810+ 10: $V2,
811+ 13: $V3,
812+ 14: $V4,
813+ 19: $V5,
814+ 23: $V6,
815+ 25: 12,
816+ 26: $V7,
817+ 28: $V8,
818+ 32: $V9,
819+ 34: $Va,
820+ 36: $Vb
821+ }, o($Vu, [2, 42]), o($Vt, [2, 34], {
822+ 11: $Vc,
823+ 12: $Vd,
824+ 13: $Ve,
825+ 16: $Vf,
826+ 17: $Vg,
827+ 18: $Vh,
828+ 19: $Vi,
829+ 20: $Vj,
830+ 21: $Vk,
831+ 22: $Vl
832+ }), o($Vt, [2, 35], { 11: $Vc, 12: $Vd, 13: $Ve, 16: $Vf, 17: $Vg, 18: $Vh, 19: $Vi, 20: $Vj, 21: $Vk, 22: $Vl })],
833+ defaultActions: { 19: [2, 1] },
834+ parseError: function parseError(str, hash) {
835+ if (hash.recoverable) {
836+ this.trace(str);
837+ }
838+ else {
839+ throw new Error(str);
840+ }
841+ },
842+ parse: function parse(input) {
843+ var self = this, stack = [0], tstack = [], // token stack
844+ vstack = [null], // semantic value stack
845+ lstack = [], // location stack
846+ table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
847+ var args = lstack.slice.call(arguments, 1);
848+ //this.reductionCount = this.shiftCount = 0;
849+ var lexer = Object.create(this.lexer);
850+ var sharedState = { yy: { parseError: undefined, lexer: { parseError: undefined }, parser: { parseError: undefined } } };
851+ // copy state
852+ for (var k in this.yy) {
853+ if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
854+ sharedState.yy[k] = this.yy[k];
855+ }
856+ }
857+ lexer.setInput(input, sharedState.yy);
858+ sharedState.yy.lexer = lexer;
859+ sharedState.yy.parser = this;
860+ if (typeof lexer.yylloc == 'undefined') {
861+ lexer.yylloc = {};
862+ }
863+ var yyloc = lexer.yylloc;
864+ lstack.push(yyloc);
865+ var ranges = lexer.options && lexer.options.ranges;
866+ if (typeof sharedState.yy.parseError === 'function') {
867+ this.parseError = sharedState.yy.parseError;
868+ }
869+ else {
870+ this.parseError = Object.getPrototypeOf(this).parseError;
871+ }
872+ function popStack(n) {
873+ stack.length = stack.length - 2 * n;
874+ vstack.length = vstack.length - n;
875+ lstack.length = lstack.length - n;
876+ }
877+ function lex() {
878+ var token;
879+ token = lexer.lex() || EOF;
880+ // if token isn't its numeric value, convert
881+ if (typeof token !== 'number') {
882+ token = self.symbols_[token] || token;
883+ }
884+ return token;
885+ }
886+ var symbol, preErrorSymbol, state, action, a, r, yyval = {
887+ $: undefined,
888+ _$: undefined
889+ }, p, len, newState, expected;
890+ while (true) {
891+ // retreive state number from top of stack
892+ state = stack[stack.length - 1];
893+ // use default actions if available
894+ if (this.defaultActions[state]) {
895+ action = this.defaultActions[state];
896+ }
897+ else {
898+ if (symbol === null || typeof symbol == 'undefined') {
899+ symbol = lex();
900+ }
901+ // read action for current state and first input
902+ action = table[state] && table[state][symbol];
903+ }
904+ // handle parse error
905+ if (typeof action === 'undefined' || !action.length || !action[0]) {
906+ var error_rule_depth;
907+ var errStr = '';
908+ // Return the rule stack depth where the nearest error rule can be found.
909+ // Return FALSE when no error recovery rule was found.
910+ this.locateNearestErrorRecoveryRule = function (state) {
911+ var stack_probe = stack.length - 1;
912+ var depth = 0;
913+ // try to recover from error
914+ for (;;) {
915+ // check for error recovery rule in this state
916+ if ((TERROR.toString()) in table[state]) {
917+ return depth;
918+ }
919+ if (state === 0 || stack_probe < 2) {
920+ return false; // No suitable error recovery rule available.
921+ }
922+ stack_probe -= 2; // popStack(1): [symbol, action]
923+ state = stack[stack_probe];
924+ ++depth;
925+ }
926+ };
927+ if (!recovering) {
928+ // first see if there's any chance at hitting an error recovery rule:
929+ error_rule_depth = this.locateNearestErrorRecoveryRule(state);
930+ // Report error
931+ expected = [];
932+ for (p in table[state]) {
933+ if (this.terminals_[p] && p > TERROR) {
934+ expected.push("'" + this.terminals_[p] + "'");
935+ }
936+ }
937+ if (lexer.showPosition) {
938+ errStr = 'Parse error on line ' + (yylineno + 1) + ":\n" + lexer.showPosition() + "\nExpecting " + expected.join(', ') + ", got '" + (this.terminals_[symbol] || symbol) + "'";
939+ }
940+ else {
941+ errStr = 'Parse error on line ' + (yylineno + 1) + ": Unexpected " +
942+ (symbol == EOF ? "end of input" :
943+ ("'" + (this.terminals_[symbol] || symbol) + "'"));
944+ }
945+ this.parseError(errStr, {
946+ text: lexer.match,
947+ token: this.terminals_[symbol] || symbol,
948+ line: lexer.yylineno,
949+ loc: yyloc,
950+ expected: expected,
951+ recoverable: (error_rule_depth !== false)
952+ });
953+ }
954+ else if (preErrorSymbol !== EOF) {
955+ error_rule_depth = this.locateNearestErrorRecoveryRule(state);
956+ }
957+ // just recovered from another error
958+ if (recovering == 3) {
959+ if (symbol === EOF || preErrorSymbol === EOF) {
960+ throw new Error(errStr || 'Parsing halted while starting to recover from another error.');
961+ }
962+ // discard current lookahead and grab another
963+ yyleng = lexer.yyleng;
964+ yytext = lexer.yytext;
965+ yylineno = lexer.yylineno;
966+ yyloc = lexer.yylloc;
967+ symbol = lex();
968+ }
969+ // try to recover from error
970+ if (error_rule_depth === false) {
971+ throw new Error(errStr || 'Parsing halted. No suitable error recovery rule available.');
972+ }
973+ popStack(error_rule_depth);
974+ preErrorSymbol = (symbol == TERROR ? null : symbol); // save the lookahead token
975+ symbol = TERROR; // insert generic error symbol as new lookahead
976+ state = stack[stack.length - 1];
977+ action = table[state] && table[state][TERROR];
978+ recovering = 3; // allow 3 real symbols to be shifted before reporting a new error
979+ }
980+ // this shouldn't happen, unless resolve defaults are off
981+ if (action[0] instanceof Array && action.length > 1) {
982+ throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
983+ }
984+ switch (action[0]) {
985+ case 1:
986+ //this.shiftCount++;
987+ stack.push(symbol);
988+ vstack.push(lexer.yytext);
989+ lstack.push(lexer.yylloc);
990+ stack.push(action[1]); // push state
991+ symbol = null;
992+ if (!preErrorSymbol) {
993+ yyleng = lexer.yyleng;
994+ yytext = lexer.yytext;
995+ yylineno = lexer.yylineno;
996+ yyloc = lexer.yylloc;
997+ if (recovering > 0) {
998+ recovering--;
999+ }
1000+ }
1001+ else {
1002+ // error just occurred, resume old lookahead f/ before error
1003+ symbol = preErrorSymbol;
1004+ preErrorSymbol = null;
1005+ }
1006+ break;
1007+ case 2:
1008+ // reduce
1009+ //this.reductionCount++;
1010+ len = this.productions_[action[1]][1];
1011+ // perform semantic action
1012+ yyval.$ = vstack[vstack.length - len]; // default to $$ = $1
1013+ // default location, uses first token for firsts, last for lasts
1014+ yyval._$ = {
1015+ first_line: lstack[lstack.length - (len || 1)].first_line,
1016+ last_line: lstack[lstack.length - 1].last_line,
1017+ first_column: lstack[lstack.length - (len || 1)].first_column,
1018+ last_column: lstack[lstack.length - 1].last_column
1019+ };
1020+ if (ranges) {
1021+ yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]];
1022+ }
1023+ r = this.performAction.apply(yyval, [yytext, yyleng, yylineno, sharedState.yy, action[1], vstack, lstack].concat(args));
1024+ if (typeof r !== 'undefined') {
1025+ return r;
1026+ }
1027+ // pop off stack
1028+ if (len) {
1029+ stack = stack.slice(0, -1 * len * 2);
1030+ vstack = vstack.slice(0, -1 * len);
1031+ lstack = lstack.slice(0, -1 * len);
1032+ }
1033+ stack.push(this.productions_[action[1]][0]); // push nonterminal (reduce)
1034+ vstack.push(yyval.$);
1035+ lstack.push(yyval._$);
1036+ // goto new state = table[STATE][NONTERMINAL]
1037+ newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
1038+ stack.push(newState);
1039+ break;
1040+ case 3:
1041+ // accept
1042+ return true;
1043+ }
1044+ }
1045+ }
1046+ };
1047+ /* generated by jison-lex 0.3.4 */
1048+ var lexer = (function () {
1049+ var lexer = ({
1050+ EOF: 1,
1051+ parseError: function parseError(str, hash) {
1052+ if (this.yy.parser) {
1053+ this.yy.parser.parseError(str, hash);
1054+ }
1055+ else {
1056+ throw new Error(str);
1057+ }
1058+ },
1059+ // resets the lexer, sets new input
1060+ setInput: function (input, yy) {
1061+ this.yy = yy || this.yy || {};
1062+ this._input = input;
1063+ this._more = this._backtrack = this.done = false;
1064+ this.yylineno = this.yyleng = 0;
1065+ this.yytext = this.matched = this.match = '';
1066+ this.conditionStack = ['INITIAL'];
1067+ this.yylloc = {
1068+ first_line: 1,
1069+ first_column: 0,
1070+ last_line: 1,
1071+ last_column: 0
1072+ };
1073+ if (this.options.ranges) {
1074+ this.yylloc.range = [0, 0];
1075+ }
1076+ this.offset = 0;
1077+ return this;
1078+ },
1079+ // consumes and returns one char from the input
1080+ input: function () {
1081+ var ch = this._input[0];
1082+ this.yytext += ch;
1083+ this.yyleng++;
1084+ this.offset++;
1085+ this.match += ch;
1086+ this.matched += ch;
1087+ var lines = ch.match(/(?:\r\n?|\n).*/g);
1088+ if (lines) {
1089+ this.yylineno++;
1090+ this.yylloc.last_line++;
1091+ }
1092+ else {
1093+ this.yylloc.last_column++;
1094+ }
1095+ if (this.options.ranges) {
1096+ this.yylloc.range[1]++;
1097+ }
1098+ this._input = this._input.slice(1);
1099+ return ch;
1100+ },
1101+ // unshifts one char (or a string) into the input
1102+ unput: function (ch) {
1103+ var len = ch.length;
1104+ var lines = ch.split(/(?:\r\n?|\n)/g);
1105+ this._input = ch + this._input;
1106+ this.yytext = this.yytext.substr(0, this.yytext.length - len);
1107+ //this.yyleng -= len;
1108+ this.offset -= len;
1109+ var oldLines = this.match.split(/(?:\r\n?|\n)/g);
1110+ this.match = this.match.substr(0, this.match.length - 1);
1111+ this.matched = this.matched.substr(0, this.matched.length - 1);
1112+ if (lines.length - 1) {
1113+ this.yylineno -= lines.length - 1;
1114+ }
1115+ var r = this.yylloc.range;
1116+ this.yylloc = {
1117+ first_line: this.yylloc.first_line,
1118+ last_line: this.yylineno + 1,
1119+ first_column: this.yylloc.first_column,
1120+ last_column: lines ?
1121+ (lines.length === oldLines.length ? this.yylloc.first_column : 0)
1122+ + oldLines[oldLines.length - lines.length].length - lines[0].length :
1123+ this.yylloc.first_column - len
1124+ };
1125+ if (this.options.ranges) {
1126+ this.yylloc.range = [r[0], r[0] + this.yyleng - len];
1127+ }
1128+ this.yyleng = this.yytext.length;
1129+ return this;
1130+ },
1131+ // When called from action, caches matched text and appends it on next action
1132+ more: function () {
1133+ this._more = true;
1134+ return this;
1135+ },
1136+ // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
1137+ reject: function () {
1138+ if (this.options.backtrack_lexer) {
1139+ this._backtrack = true;
1140+ }
1141+ else {
1142+ return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), {
1143+ text: "",
1144+ token: null,
1145+ line: this.yylineno
1146+ });
1147+ }
1148+ return this;
1149+ },
1150+ // retain first n characters of the match
1151+ less: function (n) {
1152+ this.unput(this.match.slice(n));
1153+ },
1154+ // displays already matched input, i.e. for error messages
1155+ pastInput: function () {
1156+ var past = this.matched.substr(0, this.matched.length - this.match.length);
1157+ return (past.length > 20 ? '...' : '') + past.substr(-20).replace(/\n/g, "");
1158+ },
1159+ // displays upcoming input, i.e. for error messages
1160+ upcomingInput: function () {
1161+ var next = this.match;
1162+ if (next.length < 20) {
1163+ next += this._input.substr(0, 20 - next.length);
1164+ }
1165+ return (next.substr(0, 20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
1166+ },
1167+ // displays the character position where the lexing error occurred, i.e. for error messages
1168+ showPosition: function () {
1169+ var pre = this.pastInput();
1170+ var c = new Array(pre.length + 1).join("-");
1171+ return pre + this.upcomingInput() + "\n" + c + "^";
1172+ },
1173+ // test the lexed token: return FALSE when not a match, otherwise return token
1174+ test_match: function (match, indexed_rule) {
1175+ var token, lines, backup;
1176+ if (this.options.backtrack_lexer) {
1177+ // save context
1178+ backup = {
1179+ yylineno: this.yylineno,
1180+ yylloc: {
1181+ first_line: this.yylloc.first_line,
1182+ last_line: this.last_line,
1183+ first_column: this.yylloc.first_column,
1184+ last_column: this.yylloc.last_column
1185+ },
1186+ yytext: this.yytext,
1187+ match: this.match,
1188+ matches: this.matches,
1189+ matched: this.matched,
1190+ yyleng: this.yyleng,
1191+ offset: this.offset,
1192+ _more: this._more,
1193+ _input: this._input,
1194+ yy: this.yy,
1195+ conditionStack: this.conditionStack.slice(0),
1196+ done: this.done
1197+ };
1198+ if (this.options.ranges) {
1199+ backup.yylloc.range = this.yylloc.range.slice(0);
1200+ }
1201+ }
1202+ lines = match[0].match(/(?:\r\n?|\n).*/g);
1203+ if (lines) {
1204+ this.yylineno += lines.length;
1205+ }
1206+ this.yylloc = {
1207+ first_line: this.yylloc.last_line,
1208+ last_line: this.yylineno + 1,
1209+ first_column: this.yylloc.last_column,
1210+ last_column: lines ?
1211+ lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
1212+ this.yylloc.last_column + match[0].length
1213+ };
1214+ this.yytext += match[0];
1215+ this.match += match[0];
1216+ this.matches = match;
1217+ this.yyleng = this.yytext.length;
1218+ if (this.options.ranges) {
1219+ this.yylloc.range = [this.offset, this.offset += this.yyleng];
1220+ }
1221+ this._more = false;
1222+ this._backtrack = false;
1223+ this._input = this._input.slice(match[0].length);
1224+ this.matched += match[0];
1225+ token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
1226+ if (this.done && this._input) {
1227+ this.done = false;
1228+ }
1229+ if (token) {
1230+ return token;
1231+ }
1232+ else if (this._backtrack) {
1233+ // recover context
1234+ for (var k in backup) {
1235+ this[k] = backup[k];
1236+ }
1237+ return false; // rule action called reject() implying the next rule should be tested instead.
1238+ }
1239+ return false;
1240+ },
1241+ // return next match in input
1242+ next: function () {
1243+ if (this.done) {
1244+ return this.EOF;
1245+ }
1246+ if (!this._input) {
1247+ this.done = true;
1248+ }
1249+ var token, match, tempMatch, index;
1250+ if (!this._more) {
1251+ this.yytext = '';
1252+ this.match = '';
1253+ }
1254+ var rules = this._currentRules();
1255+ for (var i = 0; i < rules.length; i++) {
1256+ tempMatch = this._input.match(this.rules[rules[i]]);
1257+ if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
1258+ match = tempMatch;
1259+ index = i;
1260+ if (this.options.backtrack_lexer) {
1261+ token = this.test_match(tempMatch, rules[i]);
1262+ if (token !== false) {
1263+ return token;
1264+ }
1265+ else if (this._backtrack) {
1266+ match = false;
1267+ continue; // rule action called reject() implying a rule MISmatch.
1268+ }
1269+ else {
1270+ // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
1271+ return false;
1272+ }
1273+ }
1274+ else if (!this.options.flex) {
1275+ break;
1276+ }
1277+ }
1278+ }
1279+ if (match) {
1280+ token = this.test_match(match, rules[index]);
1281+ if (token !== false) {
1282+ return token;
1283+ }
1284+ // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
1285+ return false;
1286+ }
1287+ if (this._input === "") {
1288+ return this.EOF;
1289+ }
1290+ else {
1291+ return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
1292+ text: "",
1293+ token: null,
1294+ line: this.yylineno
1295+ });
1296+ }
1297+ },
1298+ // return next match that has a token
1299+ lex: function lex() {
1300+ var r = this.next();
1301+ if (r) {
1302+ return r;
1303+ }
1304+ else {
1305+ return this.lex();
1306+ }
1307+ },
1308+ // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
1309+ begin: function begin(condition) {
1310+ this.conditionStack.push(condition);
1311+ },
1312+ // pop the previously active lexer condition state off the condition stack
1313+ popState: function popState() {
1314+ var n = this.conditionStack.length - 1;
1315+ if (n > 0) {
1316+ return this.conditionStack.pop();
1317+ }
1318+ else {
1319+ return this.conditionStack[0];
1320+ }
1321+ },
1322+ // produce the lexer rule set which is active for the currently active lexer condition state
1323+ _currentRules: function _currentRules() {
1324+ if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
1325+ return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
1326+ }
1327+ else {
1328+ return this.conditions["INITIAL"].rules;
1329+ }
1330+ },
1331+ // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
1332+ topState: function topState(n) {
1333+ n = this.conditionStack.length - 1 - Math.abs(n || 0);
1334+ if (n >= 0) {
1335+ return this.conditionStack[n];
1336+ }
1337+ else {
1338+ return "INITIAL";
1339+ }
1340+ },
1341+ // alias for begin(condition)
1342+ pushState: function pushState(condition) {
1343+ this.begin(condition);
1344+ },
1345+ // return the number of states currently on the stack
1346+ stateStackSize: function stateStackSize() {
1347+ return this.conditionStack.length;
1348+ },
1349+ options: {},
1350+ performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
1351+ var YYSTATE = YY_START;
1352+ switch ($avoiding_name_collisions) {
1353+ case 0:
1354+ break;
1355+ case 1:
1356+ return 10;
1357+ case 2:
1358+ return 10;
1359+ case 3:
1360+ return 23;
1361+ case 4:
1362+ return 7;
1363+ case 5:
1364+ return 8;
1365+ case 6:
1366+ //if (yy.obj.type == 'cell') return 26;
1367+ //return 32;
1368+ return 26;
1369+ case 7:
1370+ //if (yy.obj.type == 'cell') return 28;
1371+ //return 32;
1372+ return 28;
1373+ case 8:
1374+ return 23;
1375+ case 9:
1376+ return 32;
1377+ case 10:
1378+ return 32;
1379+ case 11:
1380+ return 34;
1381+ case 12:
1382+ return 29;
1383+ case 13:
1384+ break;
1385+ case 14:
1386+ return 11;
1387+ case 15:
1388+ return ' ';
1389+ case 16:
1390+ return 33;
1391+ case 17:
1392+ return 27;
1393+ case 18:
1394+ return 30;
1395+ case 19:
1396+ return 31;
1397+ case 20:
1398+ return 20;
1399+ case 21:
1400+ return 21;
1401+ case 22:
1402+ return 19;
1403+ case 23:
1404+ return 13;
1405+ case 24:
1406+ return 22;
1407+ case 25:
1408+ return 14;
1409+ case 26:
1410+ return 15;
1411+ case 27:
1412+ return 17;
1413+ case 28:
1414+ return 16;
1415+ case 29:
1416+ return 18;
1417+ case 30:
1418+ return '"';
1419+ case 31:
1420+ return "'";
1421+ case 32:
1422+ return "!";
1423+ case 33:
1424+ return 12;
1425+ case 34:
1426+ return 35;
1427+ case 35:
1428+ return 36;
1429+ case 36:
1430+ return 5;
1431+ }
1432+ },
1433+ // NOTE: Alterations made in some regular-expressions to allow for formulas containing dot-notation. Eg: F.INV
1434+ rules: [/^(?:\s+)/,
1435+ /^(?:"(\\["]|[^"])*")/,
1436+ /^(?:'(\\[']|[^'])*')/,
1437+ /^(?:[A-Za-z.]{1,}[A-Za-z_0-9]+(?=[(]))/,
1438+ /^(?:([0]?[1-9]|1[0-2])[:][0-5][0-9]([:][0-5][0-9])?[ ]?(AM|am|aM|Am|PM|pm|pM|Pm))/,
1439+ /^(?:([0]?[0-9]|1[0-9]|2[0-3])[:][0-5][0-9]([:][0-5][0-9])?)/,
1440+ /^(?:\$[A-Za-z]+\$[0-9]+)/,
1441+ /^(?:[A-Za-z]+[0-9]+)/,
1442+ /^(?:[A-Za-z.]+(?=[(]))/,
1443+ /^(?:[A-Za-z]{1,}[A-Za-z_0-9]+)/,
1444+ /^(?:[A-Za-z_]+)/,
1445+ /^(?:[0-9]+)/,
1446+ /^(?:\[(.*)?\])/,
1447+ /^(?:\$)/,
1448+ /^(?:&)/,
1449+ /^(?: )/,
1450+ /^(?:[.])/,
1451+ /^(?::)/,
1452+ /^(?:;)/,
1453+ /^(?:,)/,
1454+ /^(?:\*)/,
1455+ /^(?:\/)/,
1456+ /^(?:-)/,
1457+ /^(?:\+)/,
1458+ /^(?:\^)/,
1459+ /^(?:\()/,
1460+ /^(?:\))/,
1461+ /^(?:>)/,
1462+ /^(?:<)/,
1463+ /^(?:NOT\b)/,
1464+ /^(?:")/,
1465+ /^(?:')/,
1466+ /^(?:!)/,
1467+ /^(?:=)/,
1468+ /^(?:%)/,
1469+ /^(?:[#])/,
1470+ /^(?:$)/],
1471+ conditions: {
1472+ "INITIAL": {
1473+ "rules": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36],
1474+ "inclusive": true
1475+ }
1476+ }
1477+ });
1478+ return lexer;
1479+ })();
1480+ parser.lexer = lexer;
1481+ function Parser() {
1482+ this.yy = {};
1483+ }
1484+ Parser.prototype = parser;
1485+ parser.Parser = Parser;
1486+ return new Parser;
1487+})();
1488+exports.Parser = Parser;
1489diff --git a/dist/Sheet.js b/dist/Sheet.js
1490index b135c2c..4181e58 100644
1491--- a/dist/Sheet.js
1492+++ b/dist/Sheet.js
1493@@ -1,6 +1,5 @@
1494 "use strict";
1495 exports.__esModule = true;
1496-/// <reference path="parser.d.ts"/>
1497 var Parser_1 = require("./Parser");
1498 var Cell_1 = require("./Cell");
1499 var Errors_1 = require("./Errors");
1500diff --git a/dist/parser.js b/dist/parser.js
1501index 7579d6c..becf7b6 100644
1502--- a/dist/parser.js
1503+++ b/dist/parser.js
1504@@ -1,3 +1,5 @@
1505+"use strict";
1506+exports.__esModule = true;
1507 /* parser generated by jison 0.4.15 */
1508 /*
1509 Returns a Parser object of the following structure:
1510@@ -72,1524 +74,1352 @@
1511 }
1512 */
1513 var Parser = (function () {
1514- var o = function (k, v, o, l) {
1515- for (o = o || {}, l = k.length; l--; o[k[l]] = v);
1516- return o
1517- }, $V0 = [1, 4], $V1 = [1, 5], $V2 = [1, 7], $V3 = [1, 10], $V4 = [1, 8], $V5 = [1, 9], $V6 = [1, 11], $V7 = [1, 16], $V8 = [1, 17], $V9 = [1, 14], $Va = [1, 15], $Vb = [1, 18], $Vc = [1, 20], $Vd = [1, 21], $Ve = [1, 22], $Vf = [1, 23], $Vg = [1, 24], $Vh = [1, 25], $Vi = [1, 26], $Vj = [1, 27], $Vk = [1, 28], $Vl = [1, 29], $Vm = [5, 11, 12, 13, 15, 16, 17, 18, 19, 20, 21, 22, 30, 31], $Vn = [5, 11, 12, 13, 15, 16, 17, 18, 19, 20, 21, 22, 30, 31, 33], $Vo = [1, 38], $Vp = [5, 11, 12, 13, 15, 16, 17, 18, 19, 20, 21, 22, 30, 31, 35], $Vq = [5, 12, 13, 15, 16, 17, 18, 19, 30, 31], $Vr = [5, 12, 15, 16, 17, 18, 30, 31], $Vs = [5, 12, 13, 15, 16, 17, 18, 19, 20, 21, 30, 31], $Vt = [15, 30, 31], $Vu = [5, 11, 12, 13, 15, 16, 17, 18, 19, 20, 21, 22, 30, 31, 32, 36];
1518- var parser = {
1519- trace: function trace() {
1520- },
1521- yy: {},
1522- symbols_: {
1523- "error": 2,
1524- "expressions": 3,
1525- "expression": 4,
1526- "EOF": 5,
1527- "variableSequence": 6,
1528- "TIME_AMPM": 7,
1529- "TIME_24": 8,
1530- "number": 9,
1531- "STRING": 10,
1532- "&": 11,
1533- "=": 12,
1534- "+": 13,
1535- "(": 14,
1536- ")": 15,
1537- "<": 16,
1538- ">": 17,
1539- "NOT": 18,
1540- "-": 19,
1541- "*": 20,
1542- "/": 21,
1543- "^": 22,
1544- "FUNCTION": 23,
1545- "expseq": 24,
1546- "cell": 25,
1547- "FIXEDCELL": 26,
1548- ":": 27,
1549- "CELL": 28,
1550- "ARRAY": 29,
1551- ";": 30,
1552- ",": 31,
1553- "VARIABLE": 32,
1554- "DECIMAL": 33,
1555- "NUMBER": 34,
1556- "%": 35,
1557- "#": 36,
1558- "!": 37,
1559- "$accept": 0,
1560- "$end": 1
1561- },
1562- terminals_: {
1563- 5: "EOF",
1564- 7: "TIME_AMPM",
1565- 8: "TIME_24",
1566- 10: "STRING",
1567- 11: "&",
1568- 12: "=",
1569- 13: "+",
1570- 14: "(",
1571- 15: ")",
1572- 16: "<",
1573- 17: ">",
1574- 18: "NOT",
1575- 19: "-",
1576- 20: "*",
1577- 21: "/",
1578- 22: "^",
1579- 23: "FUNCTION",
1580- 26: "FIXEDCELL",
1581- 27: ":",
1582- 28: "CELL",
1583- 29: "ARRAY",
1584- 30: ";",
1585- 31: ",",
1586- 32: "VARIABLE",
1587- 33: "DECIMAL",
1588- 34: "NUMBER",
1589- 35: "%",
1590- 36: "#",
1591- 37: "!"
1592- },
1593- productions_: [0, [3, 2], [4, 1], [4, 1], [4, 1], [4, 1], [4, 1], [4, 3], [4, 3], [4, 3], [4, 3], [4, 4], [4, 4], [4, 4], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 2], [4, 2], [4, 3], [4, 4], [4, 1], [4, 1], [4, 2], [25, 1], [25, 3], [25, 1], [25, 3], [24, 1], [24, 1], [24, 3], [24, 3], [6, 1], [6, 3], [9, 1], [9, 3], [9, 2], [2, 3], [2, 4]],
1594- performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
1595- /* this == yyval */
1596-
1597- var $0 = $$.length - 1;
1598- switch (yystate) {
1599- case 1:
1600-
1601- return $$[$0 - 1];
1602-
1603- break;
1604- case 2:
1605-
1606- this.$ = yy.handler.helper.callVariable.call(this, $$[$0]);
1607-
1608- break;
1609- case 3:
1610-
1611- this.$ = yy.handler.time.call(yy.obj, $$[$0], true);
1612-
1613- break;
1614- case 4:
1615-
1616- this.$ = yy.handler.time.call(yy.obj, $$[$0]);
1617-
1618- break;
1619- case 5:
1620-
1621- this.$ = yy.handler.helper.number($$[$0]);
1622-
1623- break;
1624- case 6:
1625-
1626- this.$ = yy.handler.helper.string($$[$0]);
1627-
1628- break;
1629- case 7:
1630-
1631- this.$ = yy.handler.helper.specialMatch('&', $$[$0 - 2], $$[$0]);
1632-
1633- break;
1634- case 8:
1635-
1636- this.$ = yy.handler.helper.logicMatch('=', $$[$0 - 2], $$[$0]);
1637-
1638- break;
1639- case 9:
1640-
1641- this.$ = yy.handler.helper.mathMatch('+', $$[$0 - 2], $$[$0]);
1642-
1643- break;
1644- case 10:
1645-
1646- this.$ = yy.handler.helper.number($$[$0 - 1]);
1647-
1648- break;
1649- case 11:
1650-
1651- this.$ = yy.handler.helper.logicMatch('<=', $$[$0 - 3], $$[$0]);
1652-
1653- break;
1654- case 12:
1655-
1656- this.$ = yy.handler.helper.logicMatch('>=', $$[$0 - 3], $$[$0]);
1657-
1658- break;
1659- case 13:
1660-
1661- this.$ = yy.handler.helper.logicMatch('<>', $$[$0 - 3], $$[$0]);
1662-
1663- break;
1664- case 14:
1665-
1666- this.$ = yy.handler.helper.logicMatch('NOT', $$[$0 - 2], $$[$0]);
1667-
1668- break;
1669- case 15:
1670-
1671- this.$ = yy.handler.helper.logicMatch('>', $$[$0 - 2], $$[$0]);
1672-
1673- break;
1674- case 16:
1675-
1676- this.$ = yy.handler.helper.logicMatch('<', $$[$0 - 2], $$[$0]);
1677-
1678- break;
1679- case 17:
1680-
1681- this.$ = yy.handler.helper.mathMatch('-', $$[$0 - 2], $$[$0]);
1682-
1683- break;
1684- case 18:
1685-
1686- this.$ = yy.handler.helper.mathMatch('*', $$[$0 - 2], $$[$0]);
1687-
1688- break;
1689- case 19:
1690-
1691- this.$ = yy.handler.helper.mathMatch('/', $$[$0 - 2], $$[$0]);
1692-
1693- break;
1694- case 20:
1695-
1696- this.$ = yy.handler.helper.mathMatch('^', $$[$0 - 2], $$[$0]);
1697-
1698- break;
1699- case 21:
1700-
1701- var n1 = yy.handler.helper.numberInverted($$[$0]);
1702- this.$ = n1;
1703- if (isNaN(this.$)) {
1704- this.$ = 0;
1705- }
1706-
1707- break;
1708- case 22:
1709-
1710- var n1 = yy.handler.helper.number($$[$0]);
1711- this.$ = n1;
1712- if (isNaN(this.$)) {
1713- this.$ = 0;
1714- }
1715-
1716- break;
1717- case 23:
1718-
1719- this.$ = yy.handler.helper.callFunction.call(this, $$[$0 - 2], '');
1720-
1721- break;
1722- case 24:
1723-
1724- this.$ = yy.handler.helper.callFunction.call(this, $$[$0 - 3], $$[$0 - 1]);
1725-
1726- break;
1727- case 28:
1728-
1729- this.$ = yy.handler.helper.fixedCellValue.call(yy.obj, $$[$0]);
1730-
1731- break;
1732- case 29:
1733-
1734- this.$ = yy.handler.helper.fixedCellRangeValue.call(yy.obj, $$[$0 - 2], $$[$0]);
1735-
1736- break;
1737- case 30:
1738-
1739- this.$ = yy.handler.helper.cellValue.call(yy.obj, $$[$0]);
1740-
1741- break;
1742- case 31:
1743-
1744- this.$ = yy.handler.helper.cellRangeValue.call(yy.obj, $$[$0 - 2], $$[$0]);
1745-
1746- break;
1747- case 32:
1748-
1749- if (yy.handler.utils.isArray($$[$0])) {
1750- this.$ = $$[$0];
1751- } else {
1752- this.$ = [$$[$0]];
1753- }
1754-
1755- break;
1756- case 33:
1757-
1758- var result = [],
1759- arr = eval("[" + yytext + "]");
1760-
1761- arr.forEach(function (item) {
1762- result.push(item);
1763- });
1764-
1765- this.$ = result;
1766-
1767- break;
1768- case 34:
1769- case 35:
1770-
1771- $$[$0 - 2].push($$[$0]);
1772- this.$ = $$[$0 - 2];
1773-
1774- break;
1775- case 36:
1776-
1777- this.$ = [$$[$0]];
1778-
1779- break;
1780- case 37:
1781-
1782- this.$ = (yy.handler.utils.isArray($$[$0 - 2]) ? $$[$0 - 2] : [$$[$0 - 2]]);
1783- this.$.push($$[$0]);
1784-
1785- break;
1786- case 38:
1787-
1788- this.$ = $$[$0];
1789-
1790- break;
1791- case 39:
1792-
1793- this.$ = ($$[$0 - 2] + '.' + $$[$0]) * 1;
1794-
1795- break;
1796- case 40:
1797-
1798- this.$ = $$[$0 - 1] * 0.01;
1799-
1800- break;
1801- case 41:
1802- case 42:
1803-
1804- this.$ = $$[$0 - 2] + $$[$0 - 1] + $$[$0];
1805-
1806- break;
1807- }
1808- },
1809- table: [{
1810- 2: 13,
1811- 3: 1,
1812- 4: 2,
1813- 6: 3,
1814- 7: $V0,
1815- 8: $V1,
1816- 9: 6,
1817- 10: $V2,
1818- 13: $V3,
1819- 14: $V4,
1820- 19: $V5,
1821- 23: $V6,
1822- 25: 12,
1823- 26: $V7,
1824- 28: $V8,
1825- 32: $V9,
1826- 34: $Va,
1827- 36: $Vb
1828- }, {1: [3]}, {
1829- 5: [1, 19],
1830- 11: $Vc,
1831- 12: $Vd,
1832- 13: $Ve,
1833- 16: $Vf,
1834- 17: $Vg,
1835- 18: $Vh,
1836- 19: $Vi,
1837- 20: $Vj,
1838- 21: $Vk,
1839- 22: $Vl
1840- }, o($Vm, [2, 2], {33: [1, 30]}), o($Vm, [2, 3]), o($Vm, [2, 4]), o($Vm, [2, 5], {35: [1, 31]}), o($Vm, [2, 6]), {
1841- 2: 13,
1842- 4: 32,
1843- 6: 3,
1844- 7: $V0,
1845- 8: $V1,
1846- 9: 6,
1847- 10: $V2,
1848- 13: $V3,
1849- 14: $V4,
1850- 19: $V5,
1851- 23: $V6,
1852- 25: 12,
1853- 26: $V7,
1854- 28: $V8,
1855- 32: $V9,
1856- 34: $Va,
1857- 36: $Vb
1858- }, {
1859- 2: 13,
1860- 4: 33,
1861- 6: 3,
1862- 7: $V0,
1863- 8: $V1,
1864- 9: 6,
1865- 10: $V2,
1866- 13: $V3,
1867- 14: $V4,
1868- 19: $V5,
1869- 23: $V6,
1870- 25: 12,
1871- 26: $V7,
1872- 28: $V8,
1873- 32: $V9,
1874- 34: $Va,
1875- 36: $Vb
1876- }, {
1877- 2: 13,
1878- 4: 34,
1879- 6: 3,
1880- 7: $V0,
1881- 8: $V1,
1882- 9: 6,
1883- 10: $V2,
1884- 13: $V3,
1885- 14: $V4,
1886- 19: $V5,
1887- 23: $V6,
1888- 25: 12,
1889- 26: $V7,
1890- 28: $V8,
1891- 32: $V9,
1892- 34: $Va,
1893- 36: $Vb
1894- }, {14: [1, 35]}, o($Vm, [2, 25]), o($Vm, [2, 26], {
1895- 2: 36,
1896- 32: [1, 37],
1897- 36: $Vb
1898- }), o($Vn, [2, 36], {36: $Vo}), o($Vp, [2, 38], {33: [1, 39]}), o($Vm, [2, 28], {27: [1, 40]}), o($Vm, [2, 30], {27: [1, 41]}), {32: [1, 42]}, {1: [2, 1]}, {
1899- 2: 13,
1900- 4: 43,
1901- 6: 3,
1902- 7: $V0,
1903- 8: $V1,
1904- 9: 6,
1905- 10: $V2,
1906- 13: $V3,
1907- 14: $V4,
1908- 19: $V5,
1909- 23: $V6,
1910- 25: 12,
1911- 26: $V7,
1912- 28: $V8,
1913- 32: $V9,
1914- 34: $Va,
1915- 36: $Vb
1916- }, {
1917- 2: 13,
1918- 4: 44,
1919- 6: 3,
1920- 7: $V0,
1921- 8: $V1,
1922- 9: 6,
1923- 10: $V2,
1924- 13: $V3,
1925- 14: $V4,
1926- 19: $V5,
1927- 23: $V6,
1928- 25: 12,
1929- 26: $V7,
1930- 28: $V8,
1931- 32: $V9,
1932- 34: $Va,
1933- 36: $Vb
1934- }, {
1935- 2: 13,
1936- 4: 45,
1937- 6: 3,
1938- 7: $V0,
1939- 8: $V1,
1940- 9: 6,
1941- 10: $V2,
1942- 13: $V3,
1943- 14: $V4,
1944- 19: $V5,
1945- 23: $V6,
1946- 25: 12,
1947- 26: $V7,
1948- 28: $V8,
1949- 32: $V9,
1950- 34: $Va,
1951- 36: $Vb
1952- }, {
1953- 2: 13,
1954- 4: 48,
1955- 6: 3,
1956- 7: $V0,
1957- 8: $V1,
1958- 9: 6,
1959- 10: $V2,
1960- 12: [1, 46],
1961- 13: $V3,
1962- 14: $V4,
1963- 17: [1, 47],
1964- 19: $V5,
1965- 23: $V6,
1966- 25: 12,
1967- 26: $V7,
1968- 28: $V8,
1969- 32: $V9,
1970- 34: $Va,
1971- 36: $Vb
1972- }, {
1973- 2: 13,
1974- 4: 50,
1975- 6: 3,
1976- 7: $V0,
1977- 8: $V1,
1978- 9: 6,
1979- 10: $V2,
1980- 12: [1, 49],
1981- 13: $V3,
1982- 14: $V4,
1983- 19: $V5,
1984- 23: $V6,
1985- 25: 12,
1986- 26: $V7,
1987- 28: $V8,
1988- 32: $V9,
1989- 34: $Va,
1990- 36: $Vb
1991- }, {
1992- 2: 13,
1993- 4: 51,
1994- 6: 3,
1995- 7: $V0,
1996- 8: $V1,
1997- 9: 6,
1998- 10: $V2,
1999- 13: $V3,
2000- 14: $V4,
2001- 19: $V5,
2002- 23: $V6,
2003- 25: 12,
2004- 26: $V7,
2005- 28: $V8,
2006- 32: $V9,
2007- 34: $Va,
2008- 36: $Vb
2009- }, {
2010- 2: 13,
2011- 4: 52,
2012- 6: 3,
2013- 7: $V0,
2014- 8: $V1,
2015- 9: 6,
2016- 10: $V2,
2017- 13: $V3,
2018- 14: $V4,
2019- 19: $V5,
2020- 23: $V6,
2021- 25: 12,
2022- 26: $V7,
2023- 28: $V8,
2024- 32: $V9,
2025- 34: $Va,
2026- 36: $Vb
2027- }, {
2028- 2: 13,
2029- 4: 53,
2030- 6: 3,
2031- 7: $V0,
2032- 8: $V1,
2033- 9: 6,
2034- 10: $V2,
2035- 13: $V3,
2036- 14: $V4,
2037- 19: $V5,
2038- 23: $V6,
2039- 25: 12,
2040- 26: $V7,
2041- 28: $V8,
2042- 32: $V9,
2043- 34: $Va,
2044- 36: $Vb
2045- }, {
2046- 2: 13,
2047- 4: 54,
2048- 6: 3,
2049- 7: $V0,
2050- 8: $V1,
2051- 9: 6,
2052- 10: $V2,
2053- 13: $V3,
2054- 14: $V4,
2055- 19: $V5,
2056- 23: $V6,
2057- 25: 12,
2058- 26: $V7,
2059- 28: $V8,
2060- 32: $V9,
2061- 34: $Va,
2062- 36: $Vb
2063- }, {
2064- 2: 13,
2065- 4: 55,
2066- 6: 3,
2067- 7: $V0,
2068- 8: $V1,
2069- 9: 6,
2070- 10: $V2,
2071- 13: $V3,
2072- 14: $V4,
2073- 19: $V5,
2074- 23: $V6,
2075- 25: 12,
2076- 26: $V7,
2077- 28: $V8,
2078- 32: $V9,
2079- 34: $Va,
2080- 36: $Vb
2081- }, {32: [1, 56]}, o($Vp, [2, 40]), {
2082- 11: $Vc,
2083- 12: $Vd,
2084- 13: $Ve,
2085- 15: [1, 57],
2086- 16: $Vf,
2087- 17: $Vg,
2088- 18: $Vh,
2089- 19: $Vi,
2090- 20: $Vj,
2091- 21: $Vk,
2092- 22: $Vl
2093- }, o($Vq, [2, 21], {11: $Vc, 20: $Vj, 21: $Vk, 22: $Vl}), o($Vq, [2, 22], {
2094- 11: $Vc,
2095- 20: $Vj,
2096- 21: $Vk,
2097- 22: $Vl
2098- }), {
2099- 2: 13,
2100- 4: 60,
2101- 6: 3,
2102- 7: $V0,
2103- 8: $V1,
2104- 9: 6,
2105- 10: $V2,
2106- 13: $V3,
2107- 14: $V4,
2108- 15: [1, 58],
2109- 19: $V5,
2110- 23: $V6,
2111- 24: 59,
2112- 25: 12,
2113- 26: $V7,
2114- 28: $V8,
2115- 29: [1, 61],
2116- 32: $V9,
2117- 34: $Va,
2118- 36: $Vb
2119- }, o($Vm, [2, 27]), {36: $Vo}, {32: [1, 62]}, {34: [1, 63]}, {26: [1, 64]}, {28: [1, 65]}, {37: [1, 66]}, o($Vm, [2, 7]), o([5, 12, 15, 30, 31], [2, 8], {
2120- 11: $Vc,
2121- 13: $Ve,
2122- 16: $Vf,
2123- 17: $Vg,
2124- 18: $Vh,
2125- 19: $Vi,
2126- 20: $Vj,
2127- 21: $Vk,
2128- 22: $Vl
2129- }), o($Vq, [2, 9], {11: $Vc, 20: $Vj, 21: $Vk, 22: $Vl}), {
2130- 2: 13,
2131- 4: 67,
2132- 6: 3,
2133- 7: $V0,
2134- 8: $V1,
2135- 9: 6,
2136- 10: $V2,
2137- 13: $V3,
2138- 14: $V4,
2139- 19: $V5,
2140- 23: $V6,
2141- 25: 12,
2142- 26: $V7,
2143- 28: $V8,
2144- 32: $V9,
2145- 34: $Va,
2146- 36: $Vb
2147- }, {
2148- 2: 13,
2149- 4: 68,
2150- 6: 3,
2151- 7: $V0,
2152- 8: $V1,
2153- 9: 6,
2154- 10: $V2,
2155- 13: $V3,
2156- 14: $V4,
2157- 19: $V5,
2158- 23: $V6,
2159- 25: 12,
2160- 26: $V7,
2161- 28: $V8,
2162- 32: $V9,
2163- 34: $Va,
2164- 36: $Vb
2165- }, o($Vr, [2, 16], {11: $Vc, 13: $Ve, 19: $Vi, 20: $Vj, 21: $Vk, 22: $Vl}), {
2166- 2: 13,
2167- 4: 69,
2168- 6: 3,
2169- 7: $V0,
2170- 8: $V1,
2171- 9: 6,
2172- 10: $V2,
2173- 13: $V3,
2174- 14: $V4,
2175- 19: $V5,
2176- 23: $V6,
2177- 25: 12,
2178- 26: $V7,
2179- 28: $V8,
2180- 32: $V9,
2181- 34: $Va,
2182- 36: $Vb
2183- }, o($Vr, [2, 15], {
2184- 11: $Vc,
2185- 13: $Ve,
2186- 19: $Vi,
2187- 20: $Vj,
2188- 21: $Vk,
2189- 22: $Vl
2190- }), o([5, 12, 15, 18, 30, 31], [2, 14], {
2191- 11: $Vc,
2192- 13: $Ve,
2193- 16: $Vf,
2194- 17: $Vg,
2195- 19: $Vi,
2196- 20: $Vj,
2197- 21: $Vk,
2198- 22: $Vl
2199- }), o($Vq, [2, 17], {11: $Vc, 20: $Vj, 21: $Vk, 22: $Vl}), o($Vs, [2, 18], {
2200- 11: $Vc,
2201- 22: $Vl
2202- }), o($Vs, [2, 19], {
2203- 11: $Vc,
2204- 22: $Vl
2205- }), o([5, 12, 13, 15, 16, 17, 18, 19, 20, 21, 22, 30, 31], [2, 20], {11: $Vc}), o($Vn, [2, 37]), o($Vm, [2, 10]), o($Vm, [2, 23]), {
2206- 15: [1, 70],
2207- 30: [1, 71],
2208- 31: [1, 72]
2209- }, o($Vt, [2, 32], {
2210- 11: $Vc,
2211- 12: $Vd,
2212- 13: $Ve,
2213- 16: $Vf,
2214- 17: $Vg,
2215- 18: $Vh,
2216- 19: $Vi,
2217- 20: $Vj,
2218- 21: $Vk,
2219- 22: $Vl
2220- }), o($Vt, [2, 33]), {37: [1, 73]}, o($Vp, [2, 39]), o($Vm, [2, 29]), o($Vm, [2, 31]), o($Vu, [2, 41]), o($Vr, [2, 11], {
2221- 11: $Vc,
2222- 13: $Ve,
2223- 19: $Vi,
2224- 20: $Vj,
2225- 21: $Vk,
2226- 22: $Vl
2227- }), o($Vr, [2, 13], {11: $Vc, 13: $Ve, 19: $Vi, 20: $Vj, 21: $Vk, 22: $Vl}), o($Vr, [2, 12], {
2228- 11: $Vc,
2229- 13: $Ve,
2230- 19: $Vi,
2231- 20: $Vj,
2232- 21: $Vk,
2233- 22: $Vl
2234- }), o($Vm, [2, 24]), {
2235- 2: 13,
2236- 4: 74,
2237- 6: 3,
2238- 7: $V0,
2239- 8: $V1,
2240- 9: 6,
2241- 10: $V2,
2242- 13: $V3,
2243- 14: $V4,
2244- 19: $V5,
2245- 23: $V6,
2246- 25: 12,
2247- 26: $V7,
2248- 28: $V8,
2249- 32: $V9,
2250- 34: $Va,
2251- 36: $Vb
2252- }, {
2253- 2: 13,
2254- 4: 75,
2255- 6: 3,
2256- 7: $V0,
2257- 8: $V1,
2258- 9: 6,
2259- 10: $V2,
2260- 13: $V3,
2261- 14: $V4,
2262- 19: $V5,
2263- 23: $V6,
2264- 25: 12,
2265- 26: $V7,
2266- 28: $V8,
2267- 32: $V9,
2268- 34: $Va,
2269- 36: $Vb
2270- }, o($Vu, [2, 42]), o($Vt, [2, 34], {
2271- 11: $Vc,
2272- 12: $Vd,
2273- 13: $Ve,
2274- 16: $Vf,
2275- 17: $Vg,
2276- 18: $Vh,
2277- 19: $Vi,
2278- 20: $Vj,
2279- 21: $Vk,
2280- 22: $Vl
2281- }), o($Vt, [2, 35], {11: $Vc, 12: $Vd, 13: $Ve, 16: $Vf, 17: $Vg, 18: $Vh, 19: $Vi, 20: $Vj, 21: $Vk, 22: $Vl})],
2282- defaultActions: {19: [2, 1]},
2283- parseError: function parseError(str, hash) {
2284- if (hash.recoverable) {
2285- this.trace(str);
2286- } else {
2287- throw new Error(str);
2288- }
2289- },
2290- parse: function parse(input) {
2291- var self = this,
2292- stack = [0],
2293- tstack = [], // token stack
2294- vstack = [null], // semantic value stack
2295- lstack = [], // location stack
2296- table = this.table,
2297- yytext = '',
2298- yylineno = 0,
2299- yyleng = 0,
2300- recovering = 0,
2301- TERROR = 2,
2302- EOF = 1;
2303-
2304- var args = lstack.slice.call(arguments, 1);
2305-
2306- //this.reductionCount = this.shiftCount = 0;
2307-
2308- var lexer = Object.create(this.lexer);
2309- var sharedState = {yy: {}};
2310- // copy state
2311- for (var k in this.yy) {
2312- if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
2313- sharedState.yy[k] = this.yy[k];
2314+ var o = function (k, v, o, l) {
2315+ for (o = o || {}, l = k.length; l--; o[k[l]] = v) {
2316 }
2317- }
2318-
2319- lexer.setInput(input, sharedState.yy);
2320- sharedState.yy.lexer = lexer;
2321- sharedState.yy.parser = this;
2322- if (typeof lexer.yylloc == 'undefined') {
2323- lexer.yylloc = {};
2324- }
2325- var yyloc = lexer.yylloc;
2326- lstack.push(yyloc);
2327-
2328- var ranges = lexer.options && lexer.options.ranges;
2329-
2330- if (typeof sharedState.yy.parseError === 'function') {
2331- this.parseError = sharedState.yy.parseError;
2332- } else {
2333- this.parseError = Object.getPrototypeOf(this).parseError;
2334- }
2335-
2336- function popStack(n) {
2337- stack.length = stack.length - 2 * n;
2338- vstack.length = vstack.length - n;
2339- lstack.length = lstack.length - n;
2340- }
2341-
2342- _token_stack:
2343- function lex() {
2344- var token;
2345- token = lexer.lex() || EOF;
2346- // if token isn't its numeric value, convert
2347- if (typeof token !== 'number') {
2348- token = self.symbols_[token] || token;
2349- }
2350- return token;
2351- }
2352-
2353- var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
2354- while (true) {
2355- // retreive state number from top of stack
2356- state = stack[stack.length - 1];
2357-
2358- // use default actions if available
2359- if (this.defaultActions[state]) {
2360- action = this.defaultActions[state];
2361- } else {
2362- if (symbol === null || typeof symbol == 'undefined') {
2363- symbol = lex();
2364- }
2365- // read action for current state and first input
2366- action = table[state] && table[state][symbol];
2367- }
2368-
2369- _handle_error:
2370- // handle parse error
2371- if (typeof action === 'undefined' || !action.length || !action[0]) {
2372- var error_rule_depth;
2373- var errStr = '';
2374-
2375- // Return the rule stack depth where the nearest error rule can be found.
2376- // Return FALSE when no error recovery rule was found.
2377- function locateNearestErrorRecoveryRule(state) {
2378- var stack_probe = stack.length - 1;
2379- var depth = 0;
2380-
2381- // try to recover from error
2382- for (; ;) {
2383- // check for error recovery rule in this state
2384- if ((TERROR.toString()) in table[state]) {
2385- return depth;
2386- }
2387- if (state === 0 || stack_probe < 2) {
2388- return false; // No suitable error recovery rule available.
2389- }
2390- stack_probe -= 2; // popStack(1): [symbol, action]
2391- state = stack[stack_probe];
2392- ++depth;
2393- }
2394+ return o;
2395+ }, $V0 = [1, 4], $V1 = [1, 5], $V2 = [1, 7], $V3 = [1, 10], $V4 = [1, 8], $V5 = [1, 9], $V6 = [1, 11], $V7 = [1, 16], $V8 = [1, 17], $V9 = [1, 14], $Va = [1, 15], $Vb = [1, 18], $Vc = [1, 20], $Vd = [1, 21], $Ve = [1, 22], $Vf = [1, 23], $Vg = [1, 24], $Vh = [1, 25], $Vi = [1, 26], $Vj = [1, 27], $Vk = [1, 28], $Vl = [1, 29], $Vm = [5, 11, 12, 13, 15, 16, 17, 18, 19, 20, 21, 22, 30, 31], $Vn = [5, 11, 12, 13, 15, 16, 17, 18, 19, 20, 21, 22, 30, 31, 33], $Vo = [1, 38], $Vp = [5, 11, 12, 13, 15, 16, 17, 18, 19, 20, 21, 22, 30, 31, 35], $Vq = [5, 12, 13, 15, 16, 17, 18, 19, 30, 31], $Vr = [5, 12, 15, 16, 17, 18, 30, 31], $Vs = [5, 12, 13, 15, 16, 17, 18, 19, 20, 21, 30, 31], $Vt = [15, 30, 31], $Vu = [5, 11, 12, 13, 15, 16, 17, 18, 19, 20, 21, 22, 30, 31, 32, 36];
2396+ var parser = {
2397+ lexer: undefined,
2398+ Parser: undefined,
2399+ trace: function trace() {
2400+ },
2401+ yy: {},
2402+ symbols_: {
2403+ "error": 2,
2404+ "expressions": 3,
2405+ "expression": 4,
2406+ "EOF": 5,
2407+ "variableSequence": 6,
2408+ "TIME_AMPM": 7,
2409+ "TIME_24": 8,
2410+ "number": 9,
2411+ "STRING": 10,
2412+ "&": 11,
2413+ "=": 12,
2414+ "+": 13,
2415+ "(": 14,
2416+ ")": 15,
2417+ "<": 16,
2418+ ">": 17,
2419+ "NOT": 18,
2420+ "-": 19,
2421+ "*": 20,
2422+ "/": 21,
2423+ "^": 22,
2424+ "FUNCTION": 23,
2425+ "expseq": 24,
2426+ "cell": 25,
2427+ "FIXEDCELL": 26,
2428+ ":": 27,
2429+ "CELL": 28,
2430+ "ARRAY": 29,
2431+ ";": 30,
2432+ ",": 31,
2433+ "VARIABLE": 32,
2434+ "DECIMAL": 33,
2435+ "NUMBER": 34,
2436+ "%": 35,
2437+ "#": 36,
2438+ "!": 37,
2439+ "$accept": 0,
2440+ "$end": 1
2441+ },
2442+ terminals_: {
2443+ 5: "EOF",
2444+ 7: "TIME_AMPM",
2445+ 8: "TIME_24",
2446+ 10: "STRING",
2447+ 11: "&",
2448+ 12: "=",
2449+ 13: "+",
2450+ 14: "(",
2451+ 15: ")",
2452+ 16: "<",
2453+ 17: ">",
2454+ 18: "NOT",
2455+ 19: "-",
2456+ 20: "*",
2457+ 21: "/",
2458+ 22: "^",
2459+ 23: "FUNCTION",
2460+ 26: "FIXEDCELL",
2461+ 27: ":",
2462+ 28: "CELL",
2463+ 29: "ARRAY",
2464+ 30: ";",
2465+ 31: ",",
2466+ 32: "VARIABLE",
2467+ 33: "DECIMAL",
2468+ 34: "NUMBER",
2469+ 35: "%",
2470+ 36: "#",
2471+ 37: "!"
2472+ },
2473+ productions_: [0, [3, 2], [4, 1], [4, 1], [4, 1], [4, 1], [4, 1], [4, 3], [4, 3], [4, 3], [4, 3], [4, 4], [4, 4], [4, 4], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 2], [4, 2], [4, 3], [4, 4], [4, 1], [4, 1], [4, 2], [25, 1], [25, 3], [25, 1], [25, 3], [24, 1], [24, 1], [24, 3], [24, 3], [6, 1], [6, 3], [9, 1], [9, 3], [9, 2], [2, 3], [2, 4]],
2474+ performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
2475+ /* this == yyval */
2476+ var $0 = $$.length - 1;
2477+ switch (yystate) {
2478+ case 1:
2479+ return $$[$0 - 1];
2480+ case 2:
2481+ this.$ = yy.handler.helper.callVariable.call(this, $$[$0]);
2482+ break;
2483+ case 3:
2484+ this.$ = yy.handler.time.call(yy.obj, $$[$0], true);
2485+ break;
2486+ case 4:
2487+ this.$ = yy.handler.time.call(yy.obj, $$[$0]);
2488+ break;
2489+ case 5:
2490+ this.$ = yy.handler.helper.number($$[$0]);
2491+ break;
2492+ case 6:
2493+ this.$ = yy.handler.helper.string($$[$0]);
2494+ break;
2495+ case 7:
2496+ this.$ = yy.handler.helper.specialMatch('&', $$[$0 - 2], $$[$0]);
2497+ break;
2498+ case 8:
2499+ this.$ = yy.handler.helper.logicMatch('=', $$[$0 - 2], $$[$0]);
2500+ break;
2501+ case 9:
2502+ this.$ = yy.handler.helper.mathMatch('+', $$[$0 - 2], $$[$0]);
2503+ break;
2504+ case 10:
2505+ this.$ = yy.handler.helper.number($$[$0 - 1]);
2506+ break;
2507+ case 11:
2508+ this.$ = yy.handler.helper.logicMatch('<=', $$[$0 - 3], $$[$0]);
2509+ break;
2510+ case 12:
2511+ this.$ = yy.handler.helper.logicMatch('>=', $$[$0 - 3], $$[$0]);
2512+ break;
2513+ case 13:
2514+ this.$ = yy.handler.helper.logicMatch('<>', $$[$0 - 3], $$[$0]);
2515+ break;
2516+ case 14:
2517+ this.$ = yy.handler.helper.logicMatch('NOT', $$[$0 - 2], $$[$0]);
2518+ break;
2519+ case 15:
2520+ this.$ = yy.handler.helper.logicMatch('>', $$[$0 - 2], $$[$0]);
2521+ break;
2522+ case 16:
2523+ this.$ = yy.handler.helper.logicMatch('<', $$[$0 - 2], $$[$0]);
2524+ break;
2525+ case 17:
2526+ this.$ = yy.handler.helper.mathMatch('-', $$[$0 - 2], $$[$0]);
2527+ break;
2528+ case 18:
2529+ this.$ = yy.handler.helper.mathMatch('*', $$[$0 - 2], $$[$0]);
2530+ break;
2531+ case 19:
2532+ this.$ = yy.handler.helper.mathMatch('/', $$[$0 - 2], $$[$0]);
2533+ break;
2534+ case 20:
2535+ this.$ = yy.handler.helper.mathMatch('^', $$[$0 - 2], $$[$0]);
2536+ break;
2537+ case 21:
2538+ var n1 = yy.handler.helper.numberInverted($$[$0]);
2539+ this.$ = n1;
2540+ if (isNaN(this.$)) {
2541+ this.$ = 0;
2542+ }
2543+ break;
2544+ case 22:
2545+ var n1 = yy.handler.helper.number($$[$0]);
2546+ this.$ = n1;
2547+ if (isNaN(this.$)) {
2548+ this.$ = 0;
2549+ }
2550+ break;
2551+ case 23:
2552+ this.$ = yy.handler.helper.callFunction.call(this, $$[$0 - 2], '');
2553+ break;
2554+ case 24:
2555+ this.$ = yy.handler.helper.callFunction.call(this, $$[$0 - 3], $$[$0 - 1]);
2556+ break;
2557+ case 28:
2558+ this.$ = yy.handler.helper.fixedCellValue.call(yy.obj, $$[$0]);
2559+ break;
2560+ case 29:
2561+ this.$ = yy.handler.helper.fixedCellRangeValue.call(yy.obj, $$[$0 - 2], $$[$0]);
2562+ break;
2563+ case 30:
2564+ this.$ = yy.handler.helper.cellValue.call(yy.obj, $$[$0]);
2565+ break;
2566+ case 31:
2567+ this.$ = yy.handler.helper.cellRangeValue.call(yy.obj, $$[$0 - 2], $$[$0]);
2568+ break;
2569+ case 32:
2570+ if (yy.handler.utils.isArray($$[$0])) {
2571+ this.$ = $$[$0];
2572+ }
2573+ else {
2574+ this.$ = [$$[$0]];
2575+ }
2576+ break;
2577+ case 33:
2578+ var result = [], arr = eval("[" + yytext + "]");
2579+ arr.forEach(function (item) {
2580+ result.push(item);
2581+ });
2582+ this.$ = result;
2583+ break;
2584+ case 34:
2585+ case 35:
2586+ $$[$0 - 2].push($$[$0]);
2587+ this.$ = $$[$0 - 2];
2588+ break;
2589+ case 36:
2590+ this.$ = [$$[$0]];
2591+ break;
2592+ case 37:
2593+ this.$ = (yy.handler.utils.isArray($$[$0 - 2]) ? $$[$0 - 2] : [$$[$0 - 2]]);
2594+ this.$.push($$[$0]);
2595+ break;
2596+ case 38:
2597+ this.$ = $$[$0];
2598+ break;
2599+ case 39:
2600+ this.$ = parseFloat($$[$0 - 2] + '.' + $$[$0]) * 1;
2601+ break;
2602+ case 40:
2603+ this.$ = $$[$0 - 1] * 0.01;
2604+ break;
2605+ case 41:
2606+ case 42:
2607+ this.$ = $$[$0 - 2] + $$[$0 - 1] + $$[$0];
2608+ break;
2609 }
2610-
2611- if (!recovering) {
2612- // first see if there's any chance at hitting an error recovery rule:
2613- error_rule_depth = locateNearestErrorRecoveryRule(state);
2614-
2615- // Report error
2616- expected = [];
2617- for (p in table[state]) {
2618- if (this.terminals_[p] && p > TERROR) {
2619- expected.push("'" + this.terminals_[p] + "'");
2620+ },
2621+ table: [{
2622+ 2: 13,
2623+ 3: 1,
2624+ 4: 2,
2625+ 6: 3,
2626+ 7: $V0,
2627+ 8: $V1,
2628+ 9: 6,
2629+ 10: $V2,
2630+ 13: $V3,
2631+ 14: $V4,
2632+ 19: $V5,
2633+ 23: $V6,
2634+ 25: 12,
2635+ 26: $V7,
2636+ 28: $V8,
2637+ 32: $V9,
2638+ 34: $Va,
2639+ 36: $Vb
2640+ }, { 1: [3] }, {
2641+ 5: [1, 19],
2642+ 11: $Vc,
2643+ 12: $Vd,
2644+ 13: $Ve,
2645+ 16: $Vf,
2646+ 17: $Vg,
2647+ 18: $Vh,
2648+ 19: $Vi,
2649+ 20: $Vj,
2650+ 21: $Vk,
2651+ 22: $Vl
2652+ }, o($Vm, [2, 2], { 33: [1, 30] }), o($Vm, [2, 3]), o($Vm, [2, 4]), o($Vm, [2, 5], { 35: [1, 31] }), o($Vm, [2, 6]), {
2653+ 2: 13,
2654+ 4: 32,
2655+ 6: 3,
2656+ 7: $V0,
2657+ 8: $V1,
2658+ 9: 6,
2659+ 10: $V2,
2660+ 13: $V3,
2661+ 14: $V4,
2662+ 19: $V5,
2663+ 23: $V6,
2664+ 25: 12,
2665+ 26: $V7,
2666+ 28: $V8,
2667+ 32: $V9,
2668+ 34: $Va,
2669+ 36: $Vb
2670+ }, {
2671+ 2: 13,
2672+ 4: 33,
2673+ 6: 3,
2674+ 7: $V0,
2675+ 8: $V1,
2676+ 9: 6,
2677+ 10: $V2,
2678+ 13: $V3,
2679+ 14: $V4,
2680+ 19: $V5,
2681+ 23: $V6,
2682+ 25: 12,
2683+ 26: $V7,
2684+ 28: $V8,
2685+ 32: $V9,
2686+ 34: $Va,
2687+ 36: $Vb
2688+ }, {
2689+ 2: 13,
2690+ 4: 34,
2691+ 6: 3,
2692+ 7: $V0,
2693+ 8: $V1,
2694+ 9: 6,
2695+ 10: $V2,
2696+ 13: $V3,
2697+ 14: $V4,
2698+ 19: $V5,
2699+ 23: $V6,
2700+ 25: 12,
2701+ 26: $V7,
2702+ 28: $V8,
2703+ 32: $V9,
2704+ 34: $Va,
2705+ 36: $Vb
2706+ }, { 14: [1, 35] }, o($Vm, [2, 25]), o($Vm, [2, 26], {
2707+ 2: 36,
2708+ 32: [1, 37],
2709+ 36: $Vb
2710+ }), o($Vn, [2, 36], { 36: $Vo }), o($Vp, [2, 38], { 33: [1, 39] }), o($Vm, [2, 28], { 27: [1, 40] }), o($Vm, [2, 30], { 27: [1, 41] }), { 32: [1, 42] }, { 1: [2, 1] }, {
2711+ 2: 13,
2712+ 4: 43,
2713+ 6: 3,
2714+ 7: $V0,
2715+ 8: $V1,
2716+ 9: 6,
2717+ 10: $V2,
2718+ 13: $V3,
2719+ 14: $V4,
2720+ 19: $V5,
2721+ 23: $V6,
2722+ 25: 12,
2723+ 26: $V7,
2724+ 28: $V8,
2725+ 32: $V9,
2726+ 34: $Va,
2727+ 36: $Vb
2728+ }, {
2729+ 2: 13,
2730+ 4: 44,
2731+ 6: 3,
2732+ 7: $V0,
2733+ 8: $V1,
2734+ 9: 6,
2735+ 10: $V2,
2736+ 13: $V3,
2737+ 14: $V4,
2738+ 19: $V5,
2739+ 23: $V6,
2740+ 25: 12,
2741+ 26: $V7,
2742+ 28: $V8,
2743+ 32: $V9,
2744+ 34: $Va,
2745+ 36: $Vb
2746+ }, {
2747+ 2: 13,
2748+ 4: 45,
2749+ 6: 3,
2750+ 7: $V0,
2751+ 8: $V1,
2752+ 9: 6,
2753+ 10: $V2,
2754+ 13: $V3,
2755+ 14: $V4,
2756+ 19: $V5,
2757+ 23: $V6,
2758+ 25: 12,
2759+ 26: $V7,
2760+ 28: $V8,
2761+ 32: $V9,
2762+ 34: $Va,
2763+ 36: $Vb
2764+ }, {
2765+ 2: 13,
2766+ 4: 48,
2767+ 6: 3,
2768+ 7: $V0,
2769+ 8: $V1,
2770+ 9: 6,
2771+ 10: $V2,
2772+ 12: [1, 46],
2773+ 13: $V3,
2774+ 14: $V4,
2775+ 17: [1, 47],
2776+ 19: $V5,
2777+ 23: $V6,
2778+ 25: 12,
2779+ 26: $V7,
2780+ 28: $V8,
2781+ 32: $V9,
2782+ 34: $Va,
2783+ 36: $Vb
2784+ }, {
2785+ 2: 13,
2786+ 4: 50,
2787+ 6: 3,
2788+ 7: $V0,
2789+ 8: $V1,
2790+ 9: 6,
2791+ 10: $V2,
2792+ 12: [1, 49],
2793+ 13: $V3,
2794+ 14: $V4,
2795+ 19: $V5,
2796+ 23: $V6,
2797+ 25: 12,
2798+ 26: $V7,
2799+ 28: $V8,
2800+ 32: $V9,
2801+ 34: $Va,
2802+ 36: $Vb
2803+ }, {
2804+ 2: 13,
2805+ 4: 51,
2806+ 6: 3,
2807+ 7: $V0,
2808+ 8: $V1,
2809+ 9: 6,
2810+ 10: $V2,
2811+ 13: $V3,
2812+ 14: $V4,
2813+ 19: $V5,
2814+ 23: $V6,
2815+ 25: 12,
2816+ 26: $V7,
2817+ 28: $V8,
2818+ 32: $V9,
2819+ 34: $Va,
2820+ 36: $Vb
2821+ }, {
2822+ 2: 13,
2823+ 4: 52,
2824+ 6: 3,
2825+ 7: $V0,
2826+ 8: $V1,
2827+ 9: 6,
2828+ 10: $V2,
2829+ 13: $V3,
2830+ 14: $V4,
2831+ 19: $V5,
2832+ 23: $V6,
2833+ 25: 12,
2834+ 26: $V7,
2835+ 28: $V8,
2836+ 32: $V9,
2837+ 34: $Va,
2838+ 36: $Vb
2839+ }, {
2840+ 2: 13,
2841+ 4: 53,
2842+ 6: 3,
2843+ 7: $V0,
2844+ 8: $V1,
2845+ 9: 6,
2846+ 10: $V2,
2847+ 13: $V3,
2848+ 14: $V4,
2849+ 19: $V5,
2850+ 23: $V6,
2851+ 25: 12,
2852+ 26: $V7,
2853+ 28: $V8,
2854+ 32: $V9,
2855+ 34: $Va,
2856+ 36: $Vb
2857+ }, {
2858+ 2: 13,
2859+ 4: 54,
2860+ 6: 3,
2861+ 7: $V0,
2862+ 8: $V1,
2863+ 9: 6,
2864+ 10: $V2,
2865+ 13: $V3,
2866+ 14: $V4,
2867+ 19: $V5,
2868+ 23: $V6,
2869+ 25: 12,
2870+ 26: $V7,
2871+ 28: $V8,
2872+ 32: $V9,
2873+ 34: $Va,
2874+ 36: $Vb
2875+ }, {
2876+ 2: 13,
2877+ 4: 55,
2878+ 6: 3,
2879+ 7: $V0,
2880+ 8: $V1,
2881+ 9: 6,
2882+ 10: $V2,
2883+ 13: $V3,
2884+ 14: $V4,
2885+ 19: $V5,
2886+ 23: $V6,
2887+ 25: 12,
2888+ 26: $V7,
2889+ 28: $V8,
2890+ 32: $V9,
2891+ 34: $Va,
2892+ 36: $Vb
2893+ }, { 32: [1, 56] }, o($Vp, [2, 40]), {
2894+ 11: $Vc,
2895+ 12: $Vd,
2896+ 13: $Ve,
2897+ 15: [1, 57],
2898+ 16: $Vf,
2899+ 17: $Vg,
2900+ 18: $Vh,
2901+ 19: $Vi,
2902+ 20: $Vj,
2903+ 21: $Vk,
2904+ 22: $Vl
2905+ }, o($Vq, [2, 21], { 11: $Vc, 20: $Vj, 21: $Vk, 22: $Vl }), o($Vq, [2, 22], {
2906+ 11: $Vc,
2907+ 20: $Vj,
2908+ 21: $Vk,
2909+ 22: $Vl
2910+ }), {
2911+ 2: 13,
2912+ 4: 60,
2913+ 6: 3,
2914+ 7: $V0,
2915+ 8: $V1,
2916+ 9: 6,
2917+ 10: $V2,
2918+ 13: $V3,
2919+ 14: $V4,
2920+ 15: [1, 58],
2921+ 19: $V5,
2922+ 23: $V6,
2923+ 24: 59,
2924+ 25: 12,
2925+ 26: $V7,
2926+ 28: $V8,
2927+ 29: [1, 61],
2928+ 32: $V9,
2929+ 34: $Va,
2930+ 36: $Vb
2931+ }, o($Vm, [2, 27]), { 36: $Vo }, { 32: [1, 62] }, { 34: [1, 63] }, { 26: [1, 64] }, { 28: [1, 65] }, { 37: [1, 66] }, o($Vm, [2, 7]), o([5, 12, 15, 30, 31], [2, 8], {
2932+ 11: $Vc,
2933+ 13: $Ve,
2934+ 16: $Vf,
2935+ 17: $Vg,
2936+ 18: $Vh,
2937+ 19: $Vi,
2938+ 20: $Vj,
2939+ 21: $Vk,
2940+ 22: $Vl
2941+ }), o($Vq, [2, 9], { 11: $Vc, 20: $Vj, 21: $Vk, 22: $Vl }), {
2942+ 2: 13,
2943+ 4: 67,
2944+ 6: 3,
2945+ 7: $V0,
2946+ 8: $V1,
2947+ 9: 6,
2948+ 10: $V2,
2949+ 13: $V3,
2950+ 14: $V4,
2951+ 19: $V5,
2952+ 23: $V6,
2953+ 25: 12,
2954+ 26: $V7,
2955+ 28: $V8,
2956+ 32: $V9,
2957+ 34: $Va,
2958+ 36: $Vb
2959+ }, {
2960+ 2: 13,
2961+ 4: 68,
2962+ 6: 3,
2963+ 7: $V0,
2964+ 8: $V1,
2965+ 9: 6,
2966+ 10: $V2,
2967+ 13: $V3,
2968+ 14: $V4,
2969+ 19: $V5,
2970+ 23: $V6,
2971+ 25: 12,
2972+ 26: $V7,
2973+ 28: $V8,
2974+ 32: $V9,
2975+ 34: $Va,
2976+ 36: $Vb
2977+ }, o($Vr, [2, 16], { 11: $Vc, 13: $Ve, 19: $Vi, 20: $Vj, 21: $Vk, 22: $Vl }), {
2978+ 2: 13,
2979+ 4: 69,
2980+ 6: 3,
2981+ 7: $V0,
2982+ 8: $V1,
2983+ 9: 6,
2984+ 10: $V2,
2985+ 13: $V3,
2986+ 14: $V4,
2987+ 19: $V5,
2988+ 23: $V6,
2989+ 25: 12,
2990+ 26: $V7,
2991+ 28: $V8,
2992+ 32: $V9,
2993+ 34: $Va,
2994+ 36: $Vb
2995+ }, o($Vr, [2, 15], {
2996+ 11: $Vc,
2997+ 13: $Ve,
2998+ 19: $Vi,
2999+ 20: $Vj,
3000+ 21: $Vk,
3001+ 22: $Vl
3002+ }), o([5, 12, 15, 18, 30, 31], [2, 14], {
3003+ 11: $Vc,
3004+ 13: $Ve,
3005+ 16: $Vf,
3006+ 17: $Vg,
3007+ 19: $Vi,
3008+ 20: $Vj,
3009+ 21: $Vk,
3010+ 22: $Vl
3011+ }), o($Vq, [2, 17], { 11: $Vc, 20: $Vj, 21: $Vk, 22: $Vl }), o($Vs, [2, 18], {
3012+ 11: $Vc,
3013+ 22: $Vl
3014+ }), o($Vs, [2, 19], {
3015+ 11: $Vc,
3016+ 22: $Vl
3017+ }), o([5, 12, 13, 15, 16, 17, 18, 19, 20, 21, 22, 30, 31], [2, 20], { 11: $Vc }), o($Vn, [2, 37]), o($Vm, [2, 10]), o($Vm, [2, 23]), {
3018+ 15: [1, 70],
3019+ 30: [1, 71],
3020+ 31: [1, 72]
3021+ }, o($Vt, [2, 32], {
3022+ 11: $Vc,
3023+ 12: $Vd,
3024+ 13: $Ve,
3025+ 16: $Vf,
3026+ 17: $Vg,
3027+ 18: $Vh,
3028+ 19: $Vi,
3029+ 20: $Vj,
3030+ 21: $Vk,
3031+ 22: $Vl
3032+ }), o($Vt, [2, 33]), { 37: [1, 73] }, o($Vp, [2, 39]), o($Vm, [2, 29]), o($Vm, [2, 31]), o($Vu, [2, 41]), o($Vr, [2, 11], {
3033+ 11: $Vc,
3034+ 13: $Ve,
3035+ 19: $Vi,
3036+ 20: $Vj,
3037+ 21: $Vk,
3038+ 22: $Vl
3039+ }), o($Vr, [2, 13], { 11: $Vc, 13: $Ve, 19: $Vi, 20: $Vj, 21: $Vk, 22: $Vl }), o($Vr, [2, 12], {
3040+ 11: $Vc,
3041+ 13: $Ve,
3042+ 19: $Vi,
3043+ 20: $Vj,
3044+ 21: $Vk,
3045+ 22: $Vl
3046+ }), o($Vm, [2, 24]), {
3047+ 2: 13,
3048+ 4: 74,
3049+ 6: 3,
3050+ 7: $V0,
3051+ 8: $V1,
3052+ 9: 6,
3053+ 10: $V2,
3054+ 13: $V3,
3055+ 14: $V4,
3056+ 19: $V5,
3057+ 23: $V6,
3058+ 25: 12,
3059+ 26: $V7,
3060+ 28: $V8,
3061+ 32: $V9,
3062+ 34: $Va,
3063+ 36: $Vb
3064+ }, {
3065+ 2: 13,
3066+ 4: 75,
3067+ 6: 3,
3068+ 7: $V0,
3069+ 8: $V1,
3070+ 9: 6,
3071+ 10: $V2,
3072+ 13: $V3,
3073+ 14: $V4,
3074+ 19: $V5,
3075+ 23: $V6,
3076+ 25: 12,
3077+ 26: $V7,
3078+ 28: $V8,
3079+ 32: $V9,
3080+ 34: $Va,
3081+ 36: $Vb
3082+ }, o($Vu, [2, 42]), o($Vt, [2, 34], {
3083+ 11: $Vc,
3084+ 12: $Vd,
3085+ 13: $Ve,
3086+ 16: $Vf,
3087+ 17: $Vg,
3088+ 18: $Vh,
3089+ 19: $Vi,
3090+ 20: $Vj,
3091+ 21: $Vk,
3092+ 22: $Vl
3093+ }), o($Vt, [2, 35], { 11: $Vc, 12: $Vd, 13: $Ve, 16: $Vf, 17: $Vg, 18: $Vh, 19: $Vi, 20: $Vj, 21: $Vk, 22: $Vl })],
3094+ defaultActions: { 19: [2, 1] },
3095+ parseError: function parseError(str, hash) {
3096+ if (hash.recoverable) {
3097+ this.trace(str);
3098+ }
3099+ else {
3100+ throw new Error(str);
3101+ }
3102+ },
3103+ parse: function parse(input) {
3104+ var self = this, stack = [0], tstack = [], // token stack
3105+ vstack = [null], // semantic value stack
3106+ lstack = [], // location stack
3107+ table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
3108+ var args = lstack.slice.call(arguments, 1);
3109+ //this.reductionCount = this.shiftCount = 0;
3110+ var lexer = Object.create(this.lexer);
3111+ var sharedState = { yy: { parseError: undefined, lexer: { parseError: undefined }, parser: { parseError: undefined } } };
3112+ // copy state
3113+ for (var k in this.yy) {
3114+ if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
3115+ sharedState.yy[k] = this.yy[k];
3116 }
3117- }
3118- if (lexer.showPosition) {
3119- errStr = 'Parse error on line ' + (yylineno + 1) + ":\n" + lexer.showPosition() + "\nExpecting " + expected.join(', ') + ", got '" + (this.terminals_[symbol] || symbol) + "'";
3120- } else {
3121- errStr = 'Parse error on line ' + (yylineno + 1) + ": Unexpected " +
3122- (symbol == EOF ? "end of input" :
3123- ("'" + (this.terminals_[symbol] || symbol) + "'"));
3124- }
3125- this.parseError(errStr, {
3126- text: lexer.match,
3127- token: this.terminals_[symbol] || symbol,
3128- line: lexer.yylineno,
3129- loc: yyloc,
3130- expected: expected,
3131- recoverable: (error_rule_depth !== false)
3132- });
3133- } else if (preErrorSymbol !== EOF) {
3134- error_rule_depth = locateNearestErrorRecoveryRule(state);
3135 }
3136-
3137- // just recovered from another error
3138- if (recovering == 3) {
3139- if (symbol === EOF || preErrorSymbol === EOF) {
3140- throw new Error(errStr || 'Parsing halted while starting to recover from another error.');
3141- }
3142-
3143- // discard current lookahead and grab another
3144- yyleng = lexer.yyleng;
3145- yytext = lexer.yytext;
3146- yylineno = lexer.yylineno;
3147- yyloc = lexer.yylloc;
3148- symbol = lex();
3149+ lexer.setInput(input, sharedState.yy);
3150+ sharedState.yy.lexer = lexer;
3151+ sharedState.yy.parser = this;
3152+ if (typeof lexer.yylloc == 'undefined') {
3153+ lexer.yylloc = {};
3154 }
3155-
3156- // try to recover from error
3157- if (error_rule_depth === false) {
3158- throw new Error(errStr || 'Parsing halted. No suitable error recovery rule available.');
3159+ var yyloc = lexer.yylloc;
3160+ lstack.push(yyloc);
3161+ var ranges = lexer.options && lexer.options.ranges;
3162+ if (typeof sharedState.yy.parseError === 'function') {
3163+ this.parseError = sharedState.yy.parseError;
3164 }
3165- popStack(error_rule_depth);
3166-
3167- preErrorSymbol = (symbol == TERROR ? null : symbol); // save the lookahead token
3168- symbol = TERROR; // insert generic error symbol as new lookahead
3169- state = stack[stack.length - 1];
3170- action = table[state] && table[state][TERROR];
3171- recovering = 3; // allow 3 real symbols to be shifted before reporting a new error
3172- }
3173-
3174- // this shouldn't happen, unless resolve defaults are off
3175- if (action[0] instanceof Array && action.length > 1) {
3176- throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
3177- }
3178-
3179- switch (action[0]) {
3180- case 1: // shift
3181- //this.shiftCount++;
3182-
3183- stack.push(symbol);
3184- vstack.push(lexer.yytext);
3185- lstack.push(lexer.yylloc);
3186- stack.push(action[1]); // push state
3187- symbol = null;
3188- if (!preErrorSymbol) { // normal execution/no error
3189- yyleng = lexer.yyleng;
3190- yytext = lexer.yytext;
3191- yylineno = lexer.yylineno;
3192- yyloc = lexer.yylloc;
3193- if (recovering > 0) {
3194- recovering--;
3195- }
3196- } else {
3197- // error just occurred, resume old lookahead f/ before error
3198- symbol = preErrorSymbol;
3199- preErrorSymbol = null;
3200+ else {
3201+ this.parseError = Object.getPrototypeOf(this).parseError;
3202 }
3203- break;
3204-
3205- case 2:
3206- // reduce
3207- //this.reductionCount++;
3208-
3209- len = this.productions_[action[1]][1];
3210-
3211- // perform semantic action
3212- yyval.$ = vstack[vstack.length - len]; // default to $$ = $1
3213- // default location, uses first token for firsts, last for lasts
3214- yyval._$ = {
3215- first_line: lstack[lstack.length - (len || 1)].first_line,
3216- last_line: lstack[lstack.length - 1].last_line,
3217- first_column: lstack[lstack.length - (len || 1)].first_column,
3218- last_column: lstack[lstack.length - 1].last_column
3219- };
3220- if (ranges) {
3221- yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]];
3222+ function popStack(n) {
3223+ stack.length = stack.length - 2 * n;
3224+ vstack.length = vstack.length - n;
3225+ lstack.length = lstack.length - n;
3226 }
3227- r = this.performAction.apply(yyval, [yytext, yyleng, yylineno, sharedState.yy, action[1], vstack, lstack].concat(args));
3228-
3229- if (typeof r !== 'undefined') {
3230- return r;
3231+ function lex() {
3232+ var token;
3233+ token = lexer.lex() || EOF;
3234+ // if token isn't its numeric value, convert
3235+ if (typeof token !== 'number') {
3236+ token = self.symbols_[token] || token;
3237+ }
3238+ return token;
3239 }
3240-
3241- // pop off stack
3242- if (len) {
3243- stack = stack.slice(0, -1 * len * 2);
3244- vstack = vstack.slice(0, -1 * len);
3245- lstack = lstack.slice(0, -1 * len);
3246+ var symbol, preErrorSymbol, state, action, a, r, yyval = {
3247+ $: undefined,
3248+ _$: undefined
3249+ }, p, len, newState, expected;
3250+ while (true) {
3251+ // retreive state number from top of stack
3252+ state = stack[stack.length - 1];
3253+ // use default actions if available
3254+ if (this.defaultActions[state]) {
3255+ action = this.defaultActions[state];
3256+ }
3257+ else {
3258+ if (symbol === null || typeof symbol == 'undefined') {
3259+ symbol = lex();
3260+ }
3261+ // read action for current state and first input
3262+ action = table[state] && table[state][symbol];
3263+ }
3264+ // handle parse error
3265+ if (typeof action === 'undefined' || !action.length || !action[0]) {
3266+ var error_rule_depth;
3267+ var errStr = '';
3268+ // Return the rule stack depth where the nearest error rule can be found.
3269+ // Return FALSE when no error recovery rule was found.
3270+ this.locateNearestErrorRecoveryRule = function (state) {
3271+ var stack_probe = stack.length - 1;
3272+ var depth = 0;
3273+ // try to recover from error
3274+ for (;;) {
3275+ // check for error recovery rule in this state
3276+ if ((TERROR.toString()) in table[state]) {
3277+ return depth;
3278+ }
3279+ if (state === 0 || stack_probe < 2) {
3280+ return false; // No suitable error recovery rule available.
3281+ }
3282+ stack_probe -= 2; // popStack(1): [symbol, action]
3283+ state = stack[stack_probe];
3284+ ++depth;
3285+ }
3286+ };
3287+ if (!recovering) {
3288+ // first see if there's any chance at hitting an error recovery rule:
3289+ error_rule_depth = this.locateNearestErrorRecoveryRule(state);
3290+ // Report error
3291+ expected = [];
3292+ for (p in table[state]) {
3293+ if (this.terminals_[p] && p > TERROR) {
3294+ expected.push("'" + this.terminals_[p] + "'");
3295+ }
3296+ }
3297+ if (lexer.showPosition) {
3298+ errStr = 'Parse error on line ' + (yylineno + 1) + ":\n" + lexer.showPosition() + "\nExpecting " + expected.join(', ') + ", got '" + (this.terminals_[symbol] || symbol) + "'";
3299+ }
3300+ else {
3301+ errStr = 'Parse error on line ' + (yylineno + 1) + ": Unexpected " +
3302+ (symbol == EOF ? "end of input" :
3303+ ("'" + (this.terminals_[symbol] || symbol) + "'"));
3304+ }
3305+ this.parseError(errStr, {
3306+ text: lexer.match,
3307+ token: this.terminals_[symbol] || symbol,
3308+ line: lexer.yylineno,
3309+ loc: yyloc,
3310+ expected: expected,
3311+ recoverable: (error_rule_depth !== false)
3312+ });
3313+ }
3314+ else if (preErrorSymbol !== EOF) {
3315+ error_rule_depth = this.locateNearestErrorRecoveryRule(state);
3316+ }
3317+ // just recovered from another error
3318+ if (recovering == 3) {
3319+ if (symbol === EOF || preErrorSymbol === EOF) {
3320+ throw new Error(errStr || 'Parsing halted while starting to recover from another error.');
3321+ }
3322+ // discard current lookahead and grab another
3323+ yyleng = lexer.yyleng;
3324+ yytext = lexer.yytext;
3325+ yylineno = lexer.yylineno;
3326+ yyloc = lexer.yylloc;
3327+ symbol = lex();
3328+ }
3329+ // try to recover from error
3330+ if (error_rule_depth === false) {
3331+ throw new Error(errStr || 'Parsing halted. No suitable error recovery rule available.');
3332+ }
3333+ popStack(error_rule_depth);
3334+ preErrorSymbol = (symbol == TERROR ? null : symbol); // save the lookahead token
3335+ symbol = TERROR; // insert generic error symbol as new lookahead
3336+ state = stack[stack.length - 1];
3337+ action = table[state] && table[state][TERROR];
3338+ recovering = 3; // allow 3 real symbols to be shifted before reporting a new error
3339+ }
3340+ // this shouldn't happen, unless resolve defaults are off
3341+ if (action[0] instanceof Array && action.length > 1) {
3342+ throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
3343+ }
3344+ switch (action[0]) {
3345+ case 1:
3346+ //this.shiftCount++;
3347+ stack.push(symbol);
3348+ vstack.push(lexer.yytext);
3349+ lstack.push(lexer.yylloc);
3350+ stack.push(action[1]); // push state
3351+ symbol = null;
3352+ if (!preErrorSymbol) {
3353+ yyleng = lexer.yyleng;
3354+ yytext = lexer.yytext;
3355+ yylineno = lexer.yylineno;
3356+ yyloc = lexer.yylloc;
3357+ if (recovering > 0) {
3358+ recovering--;
3359+ }
3360+ }
3361+ else {
3362+ // error just occurred, resume old lookahead f/ before error
3363+ symbol = preErrorSymbol;
3364+ preErrorSymbol = null;
3365+ }
3366+ break;
3367+ case 2:
3368+ // reduce
3369+ //this.reductionCount++;
3370+ len = this.productions_[action[1]][1];
3371+ // perform semantic action
3372+ yyval.$ = vstack[vstack.length - len]; // default to $$ = $1
3373+ // default location, uses first token for firsts, last for lasts
3374+ yyval._$ = {
3375+ first_line: lstack[lstack.length - (len || 1)].first_line,
3376+ last_line: lstack[lstack.length - 1].last_line,
3377+ first_column: lstack[lstack.length - (len || 1)].first_column,
3378+ last_column: lstack[lstack.length - 1].last_column
3379+ };
3380+ if (ranges) {
3381+ yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]];
3382+ }
3383+ r = this.performAction.apply(yyval, [yytext, yyleng, yylineno, sharedState.yy, action[1], vstack, lstack].concat(args));
3384+ if (typeof r !== 'undefined') {
3385+ return r;
3386+ }
3387+ // pop off stack
3388+ if (len) {
3389+ stack = stack.slice(0, -1 * len * 2);
3390+ vstack = vstack.slice(0, -1 * len);
3391+ lstack = lstack.slice(0, -1 * len);
3392+ }
3393+ stack.push(this.productions_[action[1]][0]); // push nonterminal (reduce)
3394+ vstack.push(yyval.$);
3395+ lstack.push(yyval._$);
3396+ // goto new state = table[STATE][NONTERMINAL]
3397+ newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
3398+ stack.push(newState);
3399+ break;
3400+ case 3:
3401+ // accept
3402+ return true;
3403+ }
3404 }
3405-
3406- stack.push(this.productions_[action[1]][0]); // push nonterminal (reduce)
3407- vstack.push(yyval.$);
3408- lstack.push(yyval._$);
3409- // goto new state = table[STATE][NONTERMINAL]
3410- newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
3411- stack.push(newState);
3412- break;
3413-
3414- case 3:
3415- // accept
3416- return true;
3417- }
3418-
3419- }
3420-
3421- return true;
3422- }
3423- };
3424-
3425- /* generated by jison-lex 0.3.4 */
3426- var lexer = (function () {
3427- var lexer = ({
3428-
3429- EOF: 1,
3430-
3431- parseError: function parseError(str, hash) {
3432- if (this.yy.parser) {
3433- this.yy.parser.parseError(str, hash);
3434- } else {
3435- throw new Error(str);
3436- }
3437- },
3438-
3439-// resets the lexer, sets new input
3440- setInput: function (input, yy) {
3441- this.yy = yy || this.yy || {};
3442- this._input = input;
3443- this._more = this._backtrack = this.done = false;
3444- this.yylineno = this.yyleng = 0;
3445- this.yytext = this.matched = this.match = '';
3446- this.conditionStack = ['INITIAL'];
3447- this.yylloc = {
3448- first_line: 1,
3449- first_column: 0,
3450- last_line: 1,
3451- last_column: 0
3452- };
3453- if (this.options.ranges) {
3454- this.yylloc.range = [0, 0];
3455- }
3456- this.offset = 0;
3457- return this;
3458- },
3459-
3460-// consumes and returns one char from the input
3461- input: function () {
3462- var ch = this._input[0];
3463- this.yytext += ch;
3464- this.yyleng++;
3465- this.offset++;
3466- this.match += ch;
3467- this.matched += ch;
3468- var lines = ch.match(/(?:\r\n?|\n).*/g);
3469- if (lines) {
3470- this.yylineno++;
3471- this.yylloc.last_line++;
3472- } else {
3473- this.yylloc.last_column++;
3474- }
3475- if (this.options.ranges) {
3476- this.yylloc.range[1]++;
3477- }
3478-
3479- this._input = this._input.slice(1);
3480- return ch;
3481- },
3482-
3483-// unshifts one char (or a string) into the input
3484- unput: function (ch) {
3485- var len = ch.length;
3486- var lines = ch.split(/(?:\r\n?|\n)/g);
3487-
3488- this._input = ch + this._input;
3489- this.yytext = this.yytext.substr(0, this.yytext.length - len);
3490- //this.yyleng -= len;
3491- this.offset -= len;
3492- var oldLines = this.match.split(/(?:\r\n?|\n)/g);
3493- this.match = this.match.substr(0, this.match.length - 1);
3494- this.matched = this.matched.substr(0, this.matched.length - 1);
3495-
3496- if (lines.length - 1) {
3497- this.yylineno -= lines.length - 1;
3498- }
3499- var r = this.yylloc.range;
3500-
3501- this.yylloc = {
3502- first_line: this.yylloc.first_line,
3503- last_line: this.yylineno + 1,
3504- first_column: this.yylloc.first_column,
3505- last_column: lines ?
3506- (lines.length === oldLines.length ? this.yylloc.first_column : 0)
3507- + oldLines[oldLines.length - lines.length].length - lines[0].length :
3508- this.yylloc.first_column - len
3509- };
3510-
3511- if (this.options.ranges) {
3512- this.yylloc.range = [r[0], r[0] + this.yyleng - len];
3513 }
3514- this.yyleng = this.yytext.length;
3515- return this;
3516- },
3517-
3518-// When called from action, caches matched text and appends it on next action
3519- more: function () {
3520- this._more = true;
3521- return this;
3522- },
3523-
3524-// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
3525- reject: function () {
3526- if (this.options.backtrack_lexer) {
3527- this._backtrack = true;
3528- } else {
3529- return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), {
3530- text: "",
3531- token: null,
3532- line: this.yylineno
3533- });
3534-
3535- }
3536- return this;
3537- },
3538-
3539-// retain first n characters of the match
3540- less: function (n) {
3541- this.unput(this.match.slice(n));
3542- },
3543-
3544-// displays already matched input, i.e. for error messages
3545- pastInput: function () {
3546- var past = this.matched.substr(0, this.matched.length - this.match.length);
3547- return (past.length > 20 ? '...' : '') + past.substr(-20).replace(/\n/g, "");
3548- },
3549-
3550-// displays upcoming input, i.e. for error messages
3551- upcomingInput: function () {
3552- var next = this.match;
3553- if (next.length < 20) {
3554- next += this._input.substr(0, 20 - next.length);
3555- }
3556- return (next.substr(0, 20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
3557- },
3558-
3559-// displays the character position where the lexing error occurred, i.e. for error messages
3560- showPosition: function () {
3561- var pre = this.pastInput();
3562- var c = new Array(pre.length + 1).join("-");
3563- return pre + this.upcomingInput() + "\n" + c + "^";
3564- },
3565-
3566-// test the lexed token: return FALSE when not a match, otherwise return token
3567- test_match: function (match, indexed_rule) {
3568- var token,
3569- lines,
3570- backup;
3571-
3572- if (this.options.backtrack_lexer) {
3573- // save context
3574- backup = {
3575- yylineno: this.yylineno,
3576- yylloc: {
3577- first_line: this.yylloc.first_line,
3578- last_line: this.last_line,
3579- first_column: this.yylloc.first_column,
3580- last_column: this.yylloc.last_column
3581+ };
3582+ /* generated by jison-lex 0.3.4 */
3583+ var lexer = (function () {
3584+ var lexer = ({
3585+ EOF: 1,
3586+ parseError: function parseError(str, hash) {
3587+ if (this.yy.parser) {
3588+ this.yy.parser.parseError(str, hash);
3589+ }
3590+ else {
3591+ throw new Error(str);
3592+ }
3593 },
3594- yytext: this.yytext,
3595- match: this.match,
3596- matches: this.matches,
3597- matched: this.matched,
3598- yyleng: this.yyleng,
3599- offset: this.offset,
3600- _more: this._more,
3601- _input: this._input,
3602- yy: this.yy,
3603- conditionStack: this.conditionStack.slice(0),
3604- done: this.done
3605- };
3606- if (this.options.ranges) {
3607- backup.yylloc.range = this.yylloc.range.slice(0);
3608- }
3609- }
3610-
3611- lines = match[0].match(/(?:\r\n?|\n).*/g);
3612- if (lines) {
3613- this.yylineno += lines.length;
3614- }
3615- this.yylloc = {
3616- first_line: this.yylloc.last_line,
3617- last_line: this.yylineno + 1,
3618- first_column: this.yylloc.last_column,
3619- last_column: lines ?
3620- lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
3621- this.yylloc.last_column + match[0].length
3622- };
3623- this.yytext += match[0];
3624- this.match += match[0];
3625- this.matches = match;
3626- this.yyleng = this.yytext.length;
3627- if (this.options.ranges) {
3628- this.yylloc.range = [this.offset, this.offset += this.yyleng];
3629- }
3630- this._more = false;
3631- this._backtrack = false;
3632- this._input = this._input.slice(match[0].length);
3633- this.matched += match[0];
3634- token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
3635- if (this.done && this._input) {
3636- this.done = false;
3637- }
3638- if (token) {
3639- return token;
3640- } else if (this._backtrack) {
3641- // recover context
3642- for (var k in backup) {
3643- this[k] = backup[k];
3644- }
3645- return false; // rule action called reject() implying the next rule should be tested instead.
3646- }
3647- return false;
3648- },
3649-
3650-// return next match in input
3651- next: function () {
3652- if (this.done) {
3653- return this.EOF;
3654- }
3655- if (!this._input) {
3656- this.done = true;
3657- }
3658-
3659- var token,
3660- match,
3661- tempMatch,
3662- index;
3663- if (!this._more) {
3664- this.yytext = '';
3665- this.match = '';
3666- }
3667- var rules = this._currentRules();
3668- for (var i = 0; i < rules.length; i++) {
3669- tempMatch = this._input.match(this.rules[rules[i]]);
3670- if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
3671- match = tempMatch;
3672- index = i;
3673- if (this.options.backtrack_lexer) {
3674- token = this.test_match(tempMatch, rules[i]);
3675- if (token !== false) {
3676- return token;
3677- } else if (this._backtrack) {
3678- match = false;
3679- continue; // rule action called reject() implying a rule MISmatch.
3680- } else {
3681- // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
3682+ // resets the lexer, sets new input
3683+ setInput: function (input, yy) {
3684+ this.yy = yy || this.yy || {};
3685+ this._input = input;
3686+ this._more = this._backtrack = this.done = false;
3687+ this.yylineno = this.yyleng = 0;
3688+ this.yytext = this.matched = this.match = '';
3689+ this.conditionStack = ['INITIAL'];
3690+ this.yylloc = {
3691+ first_line: 1,
3692+ first_column: 0,
3693+ last_line: 1,
3694+ last_column: 0
3695+ };
3696+ if (this.options.ranges) {
3697+ this.yylloc.range = [0, 0];
3698+ }
3699+ this.offset = 0;
3700+ return this;
3701+ },
3702+ // consumes and returns one char from the input
3703+ input: function () {
3704+ var ch = this._input[0];
3705+ this.yytext += ch;
3706+ this.yyleng++;
3707+ this.offset++;
3708+ this.match += ch;
3709+ this.matched += ch;
3710+ var lines = ch.match(/(?:\r\n?|\n).*/g);
3711+ if (lines) {
3712+ this.yylineno++;
3713+ this.yylloc.last_line++;
3714+ }
3715+ else {
3716+ this.yylloc.last_column++;
3717+ }
3718+ if (this.options.ranges) {
3719+ this.yylloc.range[1]++;
3720+ }
3721+ this._input = this._input.slice(1);
3722+ return ch;
3723+ },
3724+ // unshifts one char (or a string) into the input
3725+ unput: function (ch) {
3726+ var len = ch.length;
3727+ var lines = ch.split(/(?:\r\n?|\n)/g);
3728+ this._input = ch + this._input;
3729+ this.yytext = this.yytext.substr(0, this.yytext.length - len);
3730+ //this.yyleng -= len;
3731+ this.offset -= len;
3732+ var oldLines = this.match.split(/(?:\r\n?|\n)/g);
3733+ this.match = this.match.substr(0, this.match.length - 1);
3734+ this.matched = this.matched.substr(0, this.matched.length - 1);
3735+ if (lines.length - 1) {
3736+ this.yylineno -= lines.length - 1;
3737+ }
3738+ var r = this.yylloc.range;
3739+ this.yylloc = {
3740+ first_line: this.yylloc.first_line,
3741+ last_line: this.yylineno + 1,
3742+ first_column: this.yylloc.first_column,
3743+ last_column: lines ?
3744+ (lines.length === oldLines.length ? this.yylloc.first_column : 0)
3745+ + oldLines[oldLines.length - lines.length].length - lines[0].length :
3746+ this.yylloc.first_column - len
3747+ };
3748+ if (this.options.ranges) {
3749+ this.yylloc.range = [r[0], r[0] + this.yyleng - len];
3750+ }
3751+ this.yyleng = this.yytext.length;
3752+ return this;
3753+ },
3754+ // When called from action, caches matched text and appends it on next action
3755+ more: function () {
3756+ this._more = true;
3757+ return this;
3758+ },
3759+ // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
3760+ reject: function () {
3761+ if (this.options.backtrack_lexer) {
3762+ this._backtrack = true;
3763+ }
3764+ else {
3765+ return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), {
3766+ text: "",
3767+ token: null,
3768+ line: this.yylineno
3769+ });
3770+ }
3771+ return this;
3772+ },
3773+ // retain first n characters of the match
3774+ less: function (n) {
3775+ this.unput(this.match.slice(n));
3776+ },
3777+ // displays already matched input, i.e. for error messages
3778+ pastInput: function () {
3779+ var past = this.matched.substr(0, this.matched.length - this.match.length);
3780+ return (past.length > 20 ? '...' : '') + past.substr(-20).replace(/\n/g, "");
3781+ },
3782+ // displays upcoming input, i.e. for error messages
3783+ upcomingInput: function () {
3784+ var next = this.match;
3785+ if (next.length < 20) {
3786+ next += this._input.substr(0, 20 - next.length);
3787+ }
3788+ return (next.substr(0, 20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
3789+ },
3790+ // displays the character position where the lexing error occurred, i.e. for error messages
3791+ showPosition: function () {
3792+ var pre = this.pastInput();
3793+ var c = new Array(pre.length + 1).join("-");
3794+ return pre + this.upcomingInput() + "\n" + c + "^";
3795+ },
3796+ // test the lexed token: return FALSE when not a match, otherwise return token
3797+ test_match: function (match, indexed_rule) {
3798+ var token, lines, backup;
3799+ if (this.options.backtrack_lexer) {
3800+ // save context
3801+ backup = {
3802+ yylineno: this.yylineno,
3803+ yylloc: {
3804+ first_line: this.yylloc.first_line,
3805+ last_line: this.last_line,
3806+ first_column: this.yylloc.first_column,
3807+ last_column: this.yylloc.last_column
3808+ },
3809+ yytext: this.yytext,
3810+ match: this.match,
3811+ matches: this.matches,
3812+ matched: this.matched,
3813+ yyleng: this.yyleng,
3814+ offset: this.offset,
3815+ _more: this._more,
3816+ _input: this._input,
3817+ yy: this.yy,
3818+ conditionStack: this.conditionStack.slice(0),
3819+ done: this.done
3820+ };
3821+ if (this.options.ranges) {
3822+ backup.yylloc.range = this.yylloc.range.slice(0);
3823+ }
3824+ }
3825+ lines = match[0].match(/(?:\r\n?|\n).*/g);
3826+ if (lines) {
3827+ this.yylineno += lines.length;
3828+ }
3829+ this.yylloc = {
3830+ first_line: this.yylloc.last_line,
3831+ last_line: this.yylineno + 1,
3832+ first_column: this.yylloc.last_column,
3833+ last_column: lines ?
3834+ lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
3835+ this.yylloc.last_column + match[0].length
3836+ };
3837+ this.yytext += match[0];
3838+ this.match += match[0];
3839+ this.matches = match;
3840+ this.yyleng = this.yytext.length;
3841+ if (this.options.ranges) {
3842+ this.yylloc.range = [this.offset, this.offset += this.yyleng];
3843+ }
3844+ this._more = false;
3845+ this._backtrack = false;
3846+ this._input = this._input.slice(match[0].length);
3847+ this.matched += match[0];
3848+ token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
3849+ if (this.done && this._input) {
3850+ this.done = false;
3851+ }
3852+ if (token) {
3853+ return token;
3854+ }
3855+ else if (this._backtrack) {
3856+ // recover context
3857+ for (var k in backup) {
3858+ this[k] = backup[k];
3859+ }
3860+ return false; // rule action called reject() implying the next rule should be tested instead.
3861+ }
3862 return false;
3863- }
3864- } else if (!this.options.flex) {
3865- break;
3866+ },
3867+ // return next match in input
3868+ next: function () {
3869+ if (this.done) {
3870+ return this.EOF;
3871+ }
3872+ if (!this._input) {
3873+ this.done = true;
3874+ }
3875+ var token, match, tempMatch, index;
3876+ if (!this._more) {
3877+ this.yytext = '';
3878+ this.match = '';
3879+ }
3880+ var rules = this._currentRules();
3881+ for (var i = 0; i < rules.length; i++) {
3882+ tempMatch = this._input.match(this.rules[rules[i]]);
3883+ if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
3884+ match = tempMatch;
3885+ index = i;
3886+ if (this.options.backtrack_lexer) {
3887+ token = this.test_match(tempMatch, rules[i]);
3888+ if (token !== false) {
3889+ return token;
3890+ }
3891+ else if (this._backtrack) {
3892+ match = false;
3893+ continue; // rule action called reject() implying a rule MISmatch.
3894+ }
3895+ else {
3896+ // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
3897+ return false;
3898+ }
3899+ }
3900+ else if (!this.options.flex) {
3901+ break;
3902+ }
3903+ }
3904+ }
3905+ if (match) {
3906+ token = this.test_match(match, rules[index]);
3907+ if (token !== false) {
3908+ return token;
3909+ }
3910+ // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
3911+ return false;
3912+ }
3913+ if (this._input === "") {
3914+ return this.EOF;
3915+ }
3916+ else {
3917+ return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
3918+ text: "",
3919+ token: null,
3920+ line: this.yylineno
3921+ });
3922+ }
3923+ },
3924+ // return next match that has a token
3925+ lex: function lex() {
3926+ var r = this.next();
3927+ if (r) {
3928+ return r;
3929+ }
3930+ else {
3931+ return this.lex();
3932+ }
3933+ },
3934+ // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
3935+ begin: function begin(condition) {
3936+ this.conditionStack.push(condition);
3937+ },
3938+ // pop the previously active lexer condition state off the condition stack
3939+ popState: function popState() {
3940+ var n = this.conditionStack.length - 1;
3941+ if (n > 0) {
3942+ return this.conditionStack.pop();
3943+ }
3944+ else {
3945+ return this.conditionStack[0];
3946+ }
3947+ },
3948+ // produce the lexer rule set which is active for the currently active lexer condition state
3949+ _currentRules: function _currentRules() {
3950+ if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
3951+ return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
3952+ }
3953+ else {
3954+ return this.conditions["INITIAL"].rules;
3955+ }
3956+ },
3957+ // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
3958+ topState: function topState(n) {
3959+ n = this.conditionStack.length - 1 - Math.abs(n || 0);
3960+ if (n >= 0) {
3961+ return this.conditionStack[n];
3962+ }
3963+ else {
3964+ return "INITIAL";
3965+ }
3966+ },
3967+ // alias for begin(condition)
3968+ pushState: function pushState(condition) {
3969+ this.begin(condition);
3970+ },
3971+ // return the number of states currently on the stack
3972+ stateStackSize: function stateStackSize() {
3973+ return this.conditionStack.length;
3974+ },
3975+ options: {},
3976+ performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
3977+ var YYSTATE = YY_START;
3978+ switch ($avoiding_name_collisions) {
3979+ case 0:
3980+ break;
3981+ case 1:
3982+ return 10;
3983+ case 2:
3984+ return 10;
3985+ case 3:
3986+ return 23;
3987+ case 4:
3988+ return 7;
3989+ case 5:
3990+ return 8;
3991+ case 6:
3992+ //if (yy.obj.type == 'cell') return 26;
3993+ //return 32;
3994+ return 26;
3995+ case 7:
3996+ //if (yy.obj.type == 'cell') return 28;
3997+ //return 32;
3998+ return 28;
3999+ case 8:
4000+ return 23;
4001+ case 9:
4002+ return 32;
4003+ case 10:
4004+ return 32;
4005+ case 11:
4006+ return 34;
4007+ case 12:
4008+ return 29;
4009+ case 13:
4010+ break;
4011+ case 14:
4012+ return 11;
4013+ case 15:
4014+ return ' ';
4015+ case 16:
4016+ return 33;
4017+ case 17:
4018+ return 27;
4019+ case 18:
4020+ return 30;
4021+ case 19:
4022+ return 31;
4023+ case 20:
4024+ return 20;
4025+ case 21:
4026+ return 21;
4027+ case 22:
4028+ return 19;
4029+ case 23:
4030+ return 13;
4031+ case 24:
4032+ return 22;
4033+ case 25:
4034+ return 14;
4035+ case 26:
4036+ return 15;
4037+ case 27:
4038+ return 17;
4039+ case 28:
4040+ return 16;
4041+ case 29:
4042+ return 18;
4043+ case 30:
4044+ return '"';
4045+ case 31:
4046+ return "'";
4047+ case 32:
4048+ return "!";
4049+ case 33:
4050+ return 12;
4051+ case 34:
4052+ return 35;
4053+ case 35:
4054+ return 36;
4055+ case 36:
4056+ return 5;
4057+ }
4058+ },
4059+ // NOTE: Alterations made in some regular-expressions to allow for formulas containing dot-notation. Eg: F.INV
4060+ rules: [/^(?:\s+)/,
4061+ /^(?:"(\\["]|[^"])*")/,
4062+ /^(?:'(\\[']|[^'])*')/,
4063+ /^(?:[A-Za-z.]{1,}[A-Za-z_0-9]+(?=[(]))/,
4064+ /^(?:([0]?[1-9]|1[0-2])[:][0-5][0-9]([:][0-5][0-9])?[ ]?(AM|am|aM|Am|PM|pm|pM|Pm))/,
4065+ /^(?:([0]?[0-9]|1[0-9]|2[0-3])[:][0-5][0-9]([:][0-5][0-9])?)/,
4066+ /^(?:\$[A-Za-z]+\$[0-9]+)/,
4067+ /^(?:[A-Za-z]+[0-9]+)/,
4068+ /^(?:[A-Za-z.]+(?=[(]))/,
4069+ /^(?:[A-Za-z]{1,}[A-Za-z_0-9]+)/,
4070+ /^(?:[A-Za-z_]+)/,
4071+ /^(?:[0-9]+)/,
4072+ /^(?:\[(.*)?\])/,
4073+ /^(?:\$)/,
4074+ /^(?:&)/,
4075+ /^(?: )/,
4076+ /^(?:[.])/,
4077+ /^(?::)/,
4078+ /^(?:;)/,
4079+ /^(?:,)/,
4080+ /^(?:\*)/,
4081+ /^(?:\/)/,
4082+ /^(?:-)/,
4083+ /^(?:\+)/,
4084+ /^(?:\^)/,
4085+ /^(?:\()/,
4086+ /^(?:\))/,
4087+ /^(?:>)/,
4088+ /^(?:<)/,
4089+ /^(?:NOT\b)/,
4090+ /^(?:")/,
4091+ /^(?:')/,
4092+ /^(?:!)/,
4093+ /^(?:=)/,
4094+ /^(?:%)/,
4095+ /^(?:[#])/,
4096+ /^(?:$)/],
4097+ conditions: {
4098+ "INITIAL": {
4099+ "rules": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36],
4100+ "inclusive": true
4101+ }
4102 }
4103- }
4104- }
4105- if (match) {
4106- token = this.test_match(match, rules[index]);
4107- if (token !== false) {
4108- return token;
4109- }
4110- // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
4111- return false;
4112- }
4113- if (this._input === "") {
4114- return this.EOF;
4115- } else {
4116- return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
4117- text: "",
4118- token: null,
4119- line: this.yylineno
4120- });
4121- }
4122- },
4123-
4124-// return next match that has a token
4125- lex: function lex() {
4126- var r = this.next();
4127- if (r) {
4128- return r;
4129- } else {
4130- return this.lex();
4131- }
4132- },
4133-
4134-// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
4135- begin: function begin(condition) {
4136- this.conditionStack.push(condition);
4137- },
4138-
4139-// pop the previously active lexer condition state off the condition stack
4140- popState: function popState() {
4141- var n = this.conditionStack.length - 1;
4142- if (n > 0) {
4143- return this.conditionStack.pop();
4144- } else {
4145- return this.conditionStack[0];
4146- }
4147- },
4148-
4149-// produce the lexer rule set which is active for the currently active lexer condition state
4150- _currentRules: function _currentRules() {
4151- if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
4152- return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
4153- } else {
4154- return this.conditions["INITIAL"].rules;
4155- }
4156- },
4157-
4158-// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
4159- topState: function topState(n) {
4160- n = this.conditionStack.length - 1 - Math.abs(n || 0);
4161- if (n >= 0) {
4162- return this.conditionStack[n];
4163- } else {
4164- return "INITIAL";
4165- }
4166- },
4167-
4168-// alias for begin(condition)
4169- pushState: function pushState(condition) {
4170- this.begin(condition);
4171- },
4172-
4173-// return the number of states currently on the stack
4174- stateStackSize: function stateStackSize() {
4175- return this.conditionStack.length;
4176- },
4177- options: {},
4178- performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
4179- var YYSTATE = YY_START;
4180- switch ($avoiding_name_collisions) {
4181- case 0:/* skip whitespace */
4182- break;
4183- case 1:
4184- return 10;
4185- break;
4186- case 2:
4187- return 10;
4188- break;
4189- case 3:
4190- return 23;
4191- break;
4192- case 4:
4193- return 7;
4194- break;
4195- case 5:
4196- return 8;
4197- break;
4198- case 6:
4199- //if (yy.obj.type == 'cell') return 26;
4200- //return 32;
4201- return 26
4202-
4203- break;
4204- case 7:
4205- //if (yy.obj.type == 'cell') return 28;
4206- //return 32;
4207- return 28;
4208-
4209- break;
4210- case 8:
4211- return 23;
4212- break;
4213- case 9:
4214- return 32;
4215- break;
4216- case 10:
4217- return 32;
4218- break;
4219- case 11:
4220- return 34;
4221- break;
4222- case 12:
4223- return 29;
4224- break;
4225- case 13:/* skip whitespace */
4226- break;
4227- case 14:
4228- return 11;
4229- break;
4230- case 15:
4231- return ' ';
4232- break;
4233- case 16:
4234- return 33;
4235- break;
4236- case 17:
4237- return 27;
4238- break;
4239- case 18:
4240- return 30;
4241- break;
4242- case 19:
4243- return 31;
4244- break;
4245- case 20:
4246- return 20;
4247- break;
4248- case 21:
4249- return 21;
4250- break;
4251- case 22:
4252- return 19;
4253- break;
4254- case 23:
4255- return 13;
4256- break;
4257- case 24:
4258- return 22;
4259- break;
4260- case 25:
4261- return 14;
4262- break;
4263- case 26:
4264- return 15;
4265- break;
4266- case 27:
4267- return 17;
4268- break;
4269- case 28:
4270- return 16;
4271- break;
4272- case 29:
4273- return 18;
4274- break;
4275- case 30:
4276- return '"';
4277- break;
4278- case 31:
4279- return "'";
4280- break;
4281- case 32:
4282- return "!";
4283- break;
4284- case 33:
4285- return 12;
4286- break;
4287- case 34:
4288- return 35;
4289- break;
4290- case 35:
4291- return 36;
4292- break;
4293- case 36:
4294- return 5;
4295- break;
4296- }
4297- },
4298- // NOTE: Alterations made in some regular-expressions to allow for formulas containing dot-notation. Eg: F.INV
4299- rules: [/^(?:\s+)/,
4300- /^(?:"(\\["]|[^"])*")/,
4301- /^(?:'(\\[']|[^'])*')/,
4302- /^(?:[A-Za-z.]{1,}[A-Za-z_0-9]+(?=[(]))/, // Changed from /^(?:[A-Za-z]{1,}[A-Za-z_0-9]+(?=[(]))/
4303- /^(?:([0]?[1-9]|1[0-2])[:][0-5][0-9]([:][0-5][0-9])?[ ]?(AM|am|aM|Am|PM|pm|pM|Pm))/,
4304- /^(?:([0]?[0-9]|1[0-9]|2[0-3])[:][0-5][0-9]([:][0-5][0-9])?)/,
4305- /^(?:\$[A-Za-z]+\$[0-9]+)/,
4306- /^(?:[A-Za-z]+[0-9]+)/,
4307- /^(?:[A-Za-z.]+(?=[(]))/, //Changed from /^(?:[A-Za-z.]+(?=[(]))/
4308- /^(?:[A-Za-z]{1,}[A-Za-z_0-9]+)/,
4309- /^(?:[A-Za-z_]+)/,
4310- /^(?:[0-9]+)/,
4311- /^(?:\[(.*)?\])/,
4312- /^(?:\$)/,
4313- /^(?:&)/,
4314- /^(?: )/,
4315- /^(?:[.])/,
4316- /^(?::)/,
4317- /^(?:;)/,
4318- /^(?:,)/,
4319- /^(?:\*)/,
4320- /^(?:\/)/,
4321- /^(?:-)/,
4322- /^(?:\+)/,
4323- /^(?:\^)/,
4324- /^(?:\()/,
4325- /^(?:\))/,
4326- /^(?:>)/,
4327- /^(?:<)/,
4328- /^(?:NOT\b)/,
4329- /^(?:")/,
4330- /^(?:')/,
4331- /^(?:!)/,
4332- /^(?:=)/,
4333- /^(?:%)/,
4334- /^(?:[#])/,
4335- /^(?:$)/],
4336- conditions: {
4337- "INITIAL": {
4338- "rules": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36],
4339- "inclusive": true
4340- }
4341- }
4342- });
4343- return lexer;
4344- })();
4345- parser.lexer = lexer;
4346- function Parser() {
4347- this.yy = {};
4348- }
4349-
4350- Parser.prototype = parser;
4351- parser.Parser = Parser;
4352- return new Parser;
4353+ });
4354+ return lexer;
4355+ })();
4356+ parser.lexer = lexer;
4357+ function Parser() {
4358+ this.yy = {};
4359+ }
4360+ Parser.prototype = parser;
4361+ parser.Parser = Parser;
4362+ return new Parser;
4363 })();
4364-
4365-module.exports = {
4366- Parser: Parser
4367-};
4368+exports.Parser = Parser;
4369diff --git a/package.json b/package.json
4370index ddb3057..833330c 100644
4371--- a/package.json
4372+++ b/package.json
4373@@ -4,7 +4,7 @@
4374 "description": "TypeScript/javascript implementation of a spreadsheet.",
4375 "scripts": {
4376 "clean": "rm -rf dist/* && rm -rf test_output/*",
4377- "build": "tsc && cp lib/parser.js dist/",
4378+ "build": "tsc",
4379 "docs": "./docs.sh src/Formulas",
4380 "test": "./tests.sh",
4381 "test:quiet": "./tests.sh | grep -v Test:"
4382diff --git a/src/Parser.d.ts b/src/Parser.d.ts
4383deleted file mode 100644
4384index ebf4c90..0000000
4385--- a/src/Parser.d.ts
4386+++ /dev/null
4387@@ -1,12 +0,0 @@
4388-interface P {
4389- yy: any;
4390- lexer: any;
4391- parse: any;
4392- parseError: any;
4393-}
4394-
4395-declare var Parser: P;
4396-
4397-export {
4398- Parser
4399-}
4400\ No newline at end of file
4401diff --git a/lib/parser.js b/src/Parser.ts
4402similarity index 88%
4403rename from lib/parser.js
4404rename to src/Parser.ts
4405index 7579d6c..8035127 100644
4406--- a/lib/parser.js
4407+++ b/src/Parser.ts
4408@@ -72,11 +72,14 @@
4409 }
4410 */
4411 var Parser = (function () {
4412- var o = function (k, v, o, l) {
4413- for (o = o || {}, l = k.length; l--; o[k[l]] = v);
4414+ var o = function (k, v, o?, l?) {
4415+ for (o = o || {}, l = k.length; l--; o[k[l]] = v) {
4416+ }
4417 return o
4418 }, $V0 = [1, 4], $V1 = [1, 5], $V2 = [1, 7], $V3 = [1, 10], $V4 = [1, 8], $V5 = [1, 9], $V6 = [1, 11], $V7 = [1, 16], $V8 = [1, 17], $V9 = [1, 14], $Va = [1, 15], $Vb = [1, 18], $Vc = [1, 20], $Vd = [1, 21], $Ve = [1, 22], $Vf = [1, 23], $Vg = [1, 24], $Vh = [1, 25], $Vi = [1, 26], $Vj = [1, 27], $Vk = [1, 28], $Vl = [1, 29], $Vm = [5, 11, 12, 13, 15, 16, 17, 18, 19, 20, 21, 22, 30, 31], $Vn = [5, 11, 12, 13, 15, 16, 17, 18, 19, 20, 21, 22, 30, 31, 33], $Vo = [1, 38], $Vp = [5, 11, 12, 13, 15, 16, 17, 18, 19, 20, 21, 22, 30, 31, 35], $Vq = [5, 12, 13, 15, 16, 17, 18, 19, 30, 31], $Vr = [5, 12, 15, 16, 17, 18, 30, 31], $Vs = [5, 12, 13, 15, 16, 17, 18, 19, 20, 21, 30, 31], $Vt = [15, 30, 31], $Vu = [5, 11, 12, 13, 15, 16, 17, 18, 19, 20, 21, 22, 30, 31, 32, 36];
4419 var parser = {
4420+ lexer: undefined,
4421+ Parser: undefined,
4422 trace: function trace() {
4423 },
4424 yy: {},
4425@@ -158,212 +161,135 @@ var Parser = (function () {
4426 var $0 = $$.length - 1;
4427 switch (yystate) {
4428 case 1:
4429-
4430 return $$[$0 - 1];
4431-
4432- break;
4433 case 2:
4434-
4435 this.$ = yy.handler.helper.callVariable.call(this, $$[$0]);
4436-
4437 break;
4438 case 3:
4439-
4440 this.$ = yy.handler.time.call(yy.obj, $$[$0], true);
4441-
4442 break;
4443 case 4:
4444-
4445 this.$ = yy.handler.time.call(yy.obj, $$[$0]);
4446-
4447 break;
4448 case 5:
4449-
4450 this.$ = yy.handler.helper.number($$[$0]);
4451-
4452 break;
4453 case 6:
4454-
4455 this.$ = yy.handler.helper.string($$[$0]);
4456-
4457 break;
4458 case 7:
4459-
4460 this.$ = yy.handler.helper.specialMatch('&', $$[$0 - 2], $$[$0]);
4461-
4462 break;
4463 case 8:
4464-
4465 this.$ = yy.handler.helper.logicMatch('=', $$[$0 - 2], $$[$0]);
4466-
4467 break;
4468 case 9:
4469-
4470 this.$ = yy.handler.helper.mathMatch('+', $$[$0 - 2], $$[$0]);
4471-
4472 break;
4473 case 10:
4474-
4475 this.$ = yy.handler.helper.number($$[$0 - 1]);
4476-
4477 break;
4478 case 11:
4479-
4480 this.$ = yy.handler.helper.logicMatch('<=', $$[$0 - 3], $$[$0]);
4481-
4482 break;
4483 case 12:
4484-
4485 this.$ = yy.handler.helper.logicMatch('>=', $$[$0 - 3], $$[$0]);
4486-
4487 break;
4488 case 13:
4489-
4490 this.$ = yy.handler.helper.logicMatch('<>', $$[$0 - 3], $$[$0]);
4491-
4492 break;
4493 case 14:
4494-
4495 this.$ = yy.handler.helper.logicMatch('NOT', $$[$0 - 2], $$[$0]);
4496-
4497 break;
4498 case 15:
4499-
4500 this.$ = yy.handler.helper.logicMatch('>', $$[$0 - 2], $$[$0]);
4501-
4502 break;
4503 case 16:
4504-
4505 this.$ = yy.handler.helper.logicMatch('<', $$[$0 - 2], $$[$0]);
4506-
4507 break;
4508 case 17:
4509-
4510 this.$ = yy.handler.helper.mathMatch('-', $$[$0 - 2], $$[$0]);
4511-
4512 break;
4513 case 18:
4514-
4515 this.$ = yy.handler.helper.mathMatch('*', $$[$0 - 2], $$[$0]);
4516-
4517 break;
4518 case 19:
4519-
4520 this.$ = yy.handler.helper.mathMatch('/', $$[$0 - 2], $$[$0]);
4521-
4522 break;
4523 case 20:
4524-
4525 this.$ = yy.handler.helper.mathMatch('^', $$[$0 - 2], $$[$0]);
4526-
4527 break;
4528 case 21:
4529-
4530 var n1 = yy.handler.helper.numberInverted($$[$0]);
4531 this.$ = n1;
4532 if (isNaN(this.$)) {
4533 this.$ = 0;
4534 }
4535-
4536 break;
4537 case 22:
4538-
4539 var n1 = yy.handler.helper.number($$[$0]);
4540 this.$ = n1;
4541 if (isNaN(this.$)) {
4542 this.$ = 0;
4543 }
4544-
4545 break;
4546 case 23:
4547-
4548 this.$ = yy.handler.helper.callFunction.call(this, $$[$0 - 2], '');
4549-
4550 break;
4551 case 24:
4552-
4553 this.$ = yy.handler.helper.callFunction.call(this, $$[$0 - 3], $$[$0 - 1]);
4554-
4555 break;
4556 case 28:
4557-
4558 this.$ = yy.handler.helper.fixedCellValue.call(yy.obj, $$[$0]);
4559-
4560 break;
4561 case 29:
4562-
4563 this.$ = yy.handler.helper.fixedCellRangeValue.call(yy.obj, $$[$0 - 2], $$[$0]);
4564-
4565 break;
4566 case 30:
4567-
4568 this.$ = yy.handler.helper.cellValue.call(yy.obj, $$[$0]);
4569-
4570 break;
4571 case 31:
4572-
4573 this.$ = yy.handler.helper.cellRangeValue.call(yy.obj, $$[$0 - 2], $$[$0]);
4574-
4575 break;
4576 case 32:
4577-
4578 if (yy.handler.utils.isArray($$[$0])) {
4579 this.$ = $$[$0];
4580 } else {
4581 this.$ = [$$[$0]];
4582 }
4583-
4584 break;
4585 case 33:
4586-
4587 var result = [],
4588 arr = eval("[" + yytext + "]");
4589-
4590 arr.forEach(function (item) {
4591 result.push(item);
4592 });
4593-
4594 this.$ = result;
4595-
4596 break;
4597 case 34:
4598 case 35:
4599-
4600 $$[$0 - 2].push($$[$0]);
4601 this.$ = $$[$0 - 2];
4602-
4603 break;
4604 case 36:
4605-
4606 this.$ = [$$[$0]];
4607-
4608 break;
4609 case 37:
4610-
4611 this.$ = (yy.handler.utils.isArray($$[$0 - 2]) ? $$[$0 - 2] : [$$[$0 - 2]]);
4612 this.$.push($$[$0]);
4613-
4614 break;
4615 case 38:
4616-
4617 this.$ = $$[$0];
4618-
4619 break;
4620 case 39:
4621-
4622- this.$ = ($$[$0 - 2] + '.' + $$[$0]) * 1;
4623-
4624+ this.$ = parseFloat($$[$0 - 2] + '.' + $$[$0]) * 1;
4625 break;
4626 case 40:
4627-
4628 this.$ = $$[$0 - 1] * 0.01;
4629-
4630 break;
4631 case 41:
4632 case 42:
4633-
4634 this.$ = $$[$0 - 2] + $$[$0 - 1] + $$[$0];
4635-
4636 break;
4637 }
4638 },
4639@@ -867,7 +793,7 @@ var Parser = (function () {
4640 //this.reductionCount = this.shiftCount = 0;
4641
4642 var lexer = Object.create(this.lexer);
4643- var sharedState = {yy: {}};
4644+ var sharedState = {yy: {parseError: undefined, lexer: {parseError: undefined}, parser: {parseError: undefined}}};
4645 // copy state
4646 for (var k in this.yy) {
4647 if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
4648@@ -898,18 +824,20 @@ var Parser = (function () {
4649 lstack.length = lstack.length - n;
4650 }
4651
4652- _token_stack:
4653- function lex() {
4654- var token;
4655- token = lexer.lex() || EOF;
4656- // if token isn't its numeric value, convert
4657- if (typeof token !== 'number') {
4658- token = self.symbols_[token] || token;
4659- }
4660- return token;
4661+ function lex() {
4662+ var token;
4663+ token = lexer.lex() || EOF;
4664+ // if token isn't its numeric value, convert
4665+ if (typeof token !== 'number') {
4666+ token = self.symbols_[token] || token;
4667 }
4668+ return token;
4669+ }
4670
4671- var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
4672+ var symbol, preErrorSymbol, state, action, a, r, yyval = {
4673+ $: undefined,
4674+ _$: undefined
4675+ }, p, len, newState, expected;
4676 while (true) {
4677 // retreive state number from top of stack
4678 state = stack[stack.length - 1];
4679@@ -925,90 +853,89 @@ var Parser = (function () {
4680 action = table[state] && table[state][symbol];
4681 }
4682
4683- _handle_error:
4684- // handle parse error
4685- if (typeof action === 'undefined' || !action.length || !action[0]) {
4686- var error_rule_depth;
4687- var errStr = '';
4688-
4689- // Return the rule stack depth where the nearest error rule can be found.
4690- // Return FALSE when no error recovery rule was found.
4691- function locateNearestErrorRecoveryRule(state) {
4692- var stack_probe = stack.length - 1;
4693- var depth = 0;
4694-
4695- // try to recover from error
4696- for (; ;) {
4697- // check for error recovery rule in this state
4698- if ((TERROR.toString()) in table[state]) {
4699- return depth;
4700- }
4701- if (state === 0 || stack_probe < 2) {
4702- return false; // No suitable error recovery rule available.
4703- }
4704- stack_probe -= 2; // popStack(1): [symbol, action]
4705- state = stack[stack_probe];
4706- ++depth;
4707- }
4708- }
4709+ // handle parse error
4710+ if (typeof action === 'undefined' || !action.length || !action[0]) {
4711+ var error_rule_depth;
4712+ var errStr = '';
4713
4714- if (!recovering) {
4715- // first see if there's any chance at hitting an error recovery rule:
4716- error_rule_depth = locateNearestErrorRecoveryRule(state);
4717+ // Return the rule stack depth where the nearest error rule can be found.
4718+ // Return FALSE when no error recovery rule was found.
4719+ this.locateNearestErrorRecoveryRule = function(state) {
4720+ var stack_probe = stack.length - 1;
4721+ var depth = 0;
4722
4723- // Report error
4724- expected = [];
4725- for (p in table[state]) {
4726- if (this.terminals_[p] && p > TERROR) {
4727- expected.push("'" + this.terminals_[p] + "'");
4728- }
4729+ // try to recover from error
4730+ for (; ;) {
4731+ // check for error recovery rule in this state
4732+ if ((TERROR.toString()) in table[state]) {
4733+ return depth;
4734 }
4735- if (lexer.showPosition) {
4736- errStr = 'Parse error on line ' + (yylineno + 1) + ":\n" + lexer.showPosition() + "\nExpecting " + expected.join(', ') + ", got '" + (this.terminals_[symbol] || symbol) + "'";
4737- } else {
4738- errStr = 'Parse error on line ' + (yylineno + 1) + ": Unexpected " +
4739- (symbol == EOF ? "end of input" :
4740- ("'" + (this.terminals_[symbol] || symbol) + "'"));
4741+ if (state === 0 || stack_probe < 2) {
4742+ return false; // No suitable error recovery rule available.
4743 }
4744- this.parseError(errStr, {
4745- text: lexer.match,
4746- token: this.terminals_[symbol] || symbol,
4747- line: lexer.yylineno,
4748- loc: yyloc,
4749- expected: expected,
4750- recoverable: (error_rule_depth !== false)
4751- });
4752- } else if (preErrorSymbol !== EOF) {
4753- error_rule_depth = locateNearestErrorRecoveryRule(state);
4754+ stack_probe -= 2; // popStack(1): [symbol, action]
4755+ state = stack[stack_probe];
4756+ ++depth;
4757 }
4758+ }
4759
4760- // just recovered from another error
4761- if (recovering == 3) {
4762- if (symbol === EOF || preErrorSymbol === EOF) {
4763- throw new Error(errStr || 'Parsing halted while starting to recover from another error.');
4764- }
4765+ if (!recovering) {
4766+ // first see if there's any chance at hitting an error recovery rule:
4767+ error_rule_depth = this.locateNearestErrorRecoveryRule(state);
4768
4769- // discard current lookahead and grab another
4770- yyleng = lexer.yyleng;
4771- yytext = lexer.yytext;
4772- yylineno = lexer.yylineno;
4773- yyloc = lexer.yylloc;
4774- symbol = lex();
4775+ // Report error
4776+ expected = [];
4777+ for (p in table[state]) {
4778+ if (this.terminals_[p] && p > TERROR) {
4779+ expected.push("'" + this.terminals_[p] + "'");
4780+ }
4781 }
4782+ if (lexer.showPosition) {
4783+ errStr = 'Parse error on line ' + (yylineno + 1) + ":\n" + lexer.showPosition() + "\nExpecting " + expected.join(', ') + ", got '" + (this.terminals_[symbol] || symbol) + "'";
4784+ } else {
4785+ errStr = 'Parse error on line ' + (yylineno + 1) + ": Unexpected " +
4786+ (symbol == EOF ? "end of input" :
4787+ ("'" + (this.terminals_[symbol] || symbol) + "'"));
4788+ }
4789+ this.parseError(errStr, {
4790+ text: lexer.match,
4791+ token: this.terminals_[symbol] || symbol,
4792+ line: lexer.yylineno,
4793+ loc: yyloc,
4794+ expected: expected,
4795+ recoverable: (error_rule_depth !== false)
4796+ });
4797+ } else if (preErrorSymbol !== EOF) {
4798+ error_rule_depth = this.locateNearestErrorRecoveryRule(state);
4799+ }
4800
4801- // try to recover from error
4802- if (error_rule_depth === false) {
4803- throw new Error(errStr || 'Parsing halted. No suitable error recovery rule available.');
4804+ // just recovered from another error
4805+ if (recovering == 3) {
4806+ if (symbol === EOF || preErrorSymbol === EOF) {
4807+ throw new Error(errStr || 'Parsing halted while starting to recover from another error.');
4808 }
4809- popStack(error_rule_depth);
4810
4811- preErrorSymbol = (symbol == TERROR ? null : symbol); // save the lookahead token
4812- symbol = TERROR; // insert generic error symbol as new lookahead
4813- state = stack[stack.length - 1];
4814- action = table[state] && table[state][TERROR];
4815- recovering = 3; // allow 3 real symbols to be shifted before reporting a new error
4816+ // discard current lookahead and grab another
4817+ yyleng = lexer.yyleng;
4818+ yytext = lexer.yytext;
4819+ yylineno = lexer.yylineno;
4820+ yyloc = lexer.yylloc;
4821+ symbol = lex();
4822 }
4823
4824+ // try to recover from error
4825+ if (error_rule_depth === false) {
4826+ throw new Error(errStr || 'Parsing halted. No suitable error recovery rule available.');
4827+ }
4828+ popStack(error_rule_depth);
4829+
4830+ preErrorSymbol = (symbol == TERROR ? null : symbol); // save the lookahead token
4831+ symbol = TERROR; // insert generic error symbol as new lookahead
4832+ state = stack[stack.length - 1];
4833+ action = table[state] && table[state][TERROR];
4834+ recovering = 3; // allow 3 real symbols to be shifted before reporting a new error
4835+ }
4836+
4837 // this shouldn't happen, unless resolve defaults are off
4838 if (action[0] instanceof Array && action.length > 1) {
4839 throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
4840@@ -1083,8 +1010,6 @@ var Parser = (function () {
4841 }
4842
4843 }
4844-
4845- return true;
4846 }
4847 };
4848
4849@@ -1420,117 +1345,80 @@ var Parser = (function () {
4850 break;
4851 case 1:
4852 return 10;
4853- break;
4854 case 2:
4855 return 10;
4856- break;
4857 case 3:
4858 return 23;
4859- break;
4860 case 4:
4861 return 7;
4862- break;
4863 case 5:
4864 return 8;
4865- break;
4866 case 6:
4867 //if (yy.obj.type == 'cell') return 26;
4868 //return 32;
4869- return 26
4870-
4871- break;
4872+ return 26;
4873 case 7:
4874 //if (yy.obj.type == 'cell') return 28;
4875 //return 32;
4876 return 28;
4877-
4878- break;
4879 case 8:
4880 return 23;
4881- break;
4882 case 9:
4883 return 32;
4884- break;
4885 case 10:
4886 return 32;
4887- break;
4888 case 11:
4889 return 34;
4890- break;
4891 case 12:
4892 return 29;
4893- break;
4894 case 13:/* skip whitespace */
4895 break;
4896 case 14:
4897 return 11;
4898- break;
4899 case 15:
4900 return ' ';
4901- break;
4902 case 16:
4903 return 33;
4904- break;
4905 case 17:
4906 return 27;
4907- break;
4908 case 18:
4909 return 30;
4910- break;
4911 case 19:
4912 return 31;
4913- break;
4914 case 20:
4915 return 20;
4916- break;
4917 case 21:
4918 return 21;
4919- break;
4920 case 22:
4921 return 19;
4922- break;
4923 case 23:
4924 return 13;
4925- break;
4926 case 24:
4927 return 22;
4928- break;
4929 case 25:
4930 return 14;
4931- break;
4932 case 26:
4933 return 15;
4934- break;
4935 case 27:
4936 return 17;
4937- break;
4938 case 28:
4939 return 16;
4940- break;
4941 case 29:
4942 return 18;
4943- break;
4944 case 30:
4945 return '"';
4946- break;
4947 case 31:
4948 return "'";
4949- break;
4950 case 32:
4951 return "!";
4952- break;
4953 case 33:
4954 return 12;
4955- break;
4956 case 34:
4957 return 35;
4958- break;
4959 case 35:
4960 return 36;
4961- break;
4962 case 36:
4963 return 5;
4964- break;
4965 }
4966 },
4967 // NOTE: Alterations made in some regular-expressions to allow for formulas containing dot-notation. Eg: F.INV
4968@@ -1590,6 +1478,6 @@ var Parser = (function () {
4969 return new Parser;
4970 })();
4971
4972-module.exports = {
4973- Parser: Parser
4974-};
4975+export {
4976+ Parser
4977+}
4978\ No newline at end of file
4979diff --git a/src/Sheet.ts b/src/Sheet.ts
4980index 59c2346..a299bd7 100644
4981--- a/src/Sheet.ts
4982+++ b/src/Sheet.ts
4983@@ -1,4 +1,3 @@
4984-/// <reference path="parser.d.ts"/>
4985 import {
4986 Parser
4987 } from "./Parser";
4988diff --git a/tests.sh b/tests.sh
4989index 54aeca8..bb2b4fc 100755
4990--- a/tests.sh
4991+++ b/tests.sh
4992@@ -3,7 +3,6 @@
4993 echo "$(date) Compiling Tests"
4994 tsc --outDir test_output tests/*.ts
4995 tsc --outDir test_output tests/*/*.ts
4996-cp lib/parser.js test_output/src/
4997
4998 echo "$(date) Running All Tests"
4999 for test_file in test_output/tests/*.js test_output/tests/*/*.js