commit
message
[Parser] adding documentation and cleaning up functions
author
Ben Vogt <[email protected]>
date
2017-08-19 16:03:41
stats
1 file(s) changed,
184 insertions(+),
206 deletions(-)
files
src/Parser/Parser.ts
1diff --git a/src/Parser/Parser.ts b/src/Parser/Parser.ts
2index e6eb517..98c6c41 100644
3--- a/src/Parser/Parser.ts
4+++ b/src/Parser/Parser.ts
5@@ -1,8 +1,8 @@
6 import {
7 RULES,
8
9- WHITE_SPACE_RULE_INDEX,
10- DOUBLE_QUOTES_RULE_INDEX,
11+ // WHITE_SPACE_RULE_INDEX,
12+ // DOUBLE_QUOTES_RULE_INDEX,
13 SINGLE_QUOTES_RULE_INDEX,
14 FORMULA_NAME_RULE_INDEX,
15 DATE_RULE_INDEX,
16@@ -28,20 +28,20 @@ import {
17 CARET_SIGN_RULE_INDEX,
18 OPEN_PAREN_RULE_INDEX,
19 CLOSE_PAREN_RULE_INDEX,
20- GREATER_THAN_SIGN_RULE_INDEX,
21+ // GREATER_THAN_SIGN_RULE_INDEX,
22 LESS_THAN_SIGN_RULE_INDEX,
23 NOT_RULE_INDEX,
24 OPEN_DOUBLE_QUOTE_INDEX,
25 OPEN_SINGLE_QUITE_INDEX,
26 EXCLAMATION_POINT_RULE_INDEX,
27- EQUALS_SIGN_RULE_INDEX,
28+ // EQUALS_SIGN_RULE_INDEX,
29 PERCENT_SIGN_RULE_INDEX,
30- HASH_SIGN_RULE_INDEX,
31+ // HASH_SIGN_RULE_INDEX,
32 END_OF_STRING_RULE_INDEX,
33- INDEX0,
34+ // INDEX0,
35 INDEX1,
36- INDEX2,
37- INDEX3,
38+ // INDEX2,
39+ // INDEX3,
40 INDEX4,
41 INDEX5,
42 INDEX6,
43@@ -81,89 +81,30 @@ import {
44 } from "../Utilities/ObjectFromPairs";
45
46
47-const enum Actions {
48+/**
49+ * Actions to take when processing tokens one by one. We're always either taking the next token, reducing our current
50+ * tokens, or accepting and returning.
51+ */
52+const enum LexActions {
53 SHIFT = 1,
54 REDUCE,
55 ACCEPT
56 }
57
58-/* parser generated by jison 0.4.15 */
59-/*
60- Returns a Parser object of the following structure:
61-
62- Parser: {
63- yy: {}
64- }
65-
66- Parser.prototype: {
67- yy: {},
68- trace: function(),
69- symbols_: {associative list: name ==> number},
70- terminals_: {associative list: number ==> name},
71- productions_: [...],
72- performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
73- table: [...],
74- defaultActions: {...},
75- parseError: function(str, hash),
76- parse: function(input),
77-
78- lexer: {
79- EOF: 1,
80- parseError: function(str, hash),
81- setInput: function(input),
82- input: function(),
83- unput: function(str),
84- more: function(),
85- less: function(n),
86- pastInput: function(),
87- upcomingInput: function(),
88- showPosition: function(),
89- test_match: function(regex_match_array, rule_index),
90- next: function(),
91- lex: function(),
92- begin: function(condition),
93- popState: function(),
94- _currentRules: function(),
95- topState: function(),
96- pushState: function(condition),
97-
98- options: {
99- ranges: boolean (optional: true ==> token location info will include a .range[] member)
100- flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
101- 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)
102- },
103-
104- performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
105- rules: [...],
106- conditions: {associative list: name ==> set},
107- }
108- }
109-
110-
111- token location info (@$, _$, etc.): {
112- first_line: n,
113- last_line: n,
114- first_column: n,
115- last_column: n,
116- range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
117- }
118-
119-
120- the parseError function receives a 'hash' object with these members for lexer and parser errors: {
121- text: (matched text)
122- token: (the produced terminal token, if any)
123- line: (yylineno)
124- }
125- while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
126- loc: (yylloc)
127- expected: (string describing the set of expected tokens)
128- recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
129- }
130+/**
131+ * Parser initially generated by jison 0.4.15, but modified for readability and extensibility.
132 */
133 let Parser = (function () {
134+ /**
135+ * Extend object obj by keys k, and values v for each k.
136+ * @param k - keys to extend object by.
137+ * @param v - value set for each key k.
138+ * @param obj - object to extend.
139+ * @param l
140+ * @returns {Object}
141+ */
142 const extendRules = function (k, v, obj?, l?) {
143- for (obj = obj || {}, l = k.length; l--; obj[k[l]] = v) {
144- }
145+ for (obj = obj || {}, l = k.length; l--; obj[k[l]] = v) {}
146 return obj;
147 };
148 const $V0 = [INDEX1, INDEX4];
149@@ -190,8 +131,8 @@ let Parser = (function () {
150 const $Vl = [INDEX1, INDEX29];
151 const $Vm = [INDEX5, INDEX11, INDEX12, INDEX13, INDEX15, INDEX16, INDEX17, INDEX18, INDEX19, INDEX20, INDEX21, INDEX22, INDEX30, INDEX31];
152 const $Vn = [INDEX5, INDEX11, INDEX12, INDEX13, INDEX15, INDEX16, INDEX17, INDEX18, INDEX19, INDEX20, INDEX21, INDEX22, INDEX30, INDEX31, INDEX33];
153- const $Vo = [INDEX1, 38];
154- const $Vp = [INDEX5, INDEX11, INDEX12, INDEX13, INDEX15, INDEX16, INDEX17, INDEX18, INDEX19, INDEX20, INDEX21, INDEX22, INDEX30, INDEX31, INDEX35, 38];
155+ const $Vo = [INDEX1, 38]; // index 38?
156+ const $Vp = [INDEX5, INDEX11, INDEX12, INDEX13, INDEX15, INDEX16, INDEX17, INDEX18, INDEX19, INDEX20, INDEX21, INDEX22, INDEX30, INDEX31, INDEX35, 38]; // index 38?
157 const $Vq = [INDEX5, INDEX12, INDEX13, INDEX15, INDEX16, INDEX17, INDEX18, INDEX19, INDEX30, INDEX31];
158 const $Vr = [INDEX5, INDEX12, INDEX15, INDEX16, INDEX17, INDEX18, INDEX30, INDEX31];
159 const $Vs = [INDEX5, INDEX12, INDEX13, INDEX15, INDEX16, INDEX17, INDEX18, INDEX19, INDEX20, INDEX21, INDEX30, INDEX31];
160@@ -384,8 +325,7 @@ let Parser = (function () {
161 this.$ = yy.handler.helper.mathMatch('^', $$[$0 - 2], $$[$0]);
162 break;
163 case 21:
164- var n1 = yy.handler.helper.numberInverted($$[$0]);
165- this.$ = n1;
166+ this.$ = yy.handler.helper.numberInverted($$[$0]);
167 if (isNaN(this.$)) {
168 this.$ = 0;
169 }
170@@ -458,6 +398,9 @@ let Parser = (function () {
171 break;
172 }
173 },
174+ /**
175+ * The `table` is an array of objects that map {@link RULES} to LexActions and tokens. Eg:
176+ */
177 table: [
178 ObjectFromPairs.of([
179 SINGLE_QUOTES_RULE_INDEX, 13,
180@@ -483,7 +426,7 @@ let Parser = (function () {
181 INDEX1, [3]
182 ]),
183 ObjectFromPairs.of([
184- TIME_RULE_INDEX, [Actions.SHIFT, 19],
185+ TIME_RULE_INDEX, [LexActions.SHIFT, 19],
186 INTEGER_RULE_INDEX, $Vc,
187 OPEN_AND_CLOSE_OF_ARRAY_RULE_INDEX, $Vd,
188 DOLLAR_SIGN_RULE_INDEX, $Ve,
189@@ -495,11 +438,11 @@ let Parser = (function () {
190 FORWARD_SLASH_RULE_INDEX, $Vk,
191 MINUS_SIGN_RULE_INDEX, $Vl
192 ]),
193- extendRules($Vm, [Actions.REDUCE, 2], ObjectFromPairs.of([INDEX33, [Actions.SHIFT, 30]])),
194- extendRules($Vm, [Actions.REDUCE, 3]),
195- extendRules($Vm, [Actions.REDUCE, 4]),
196- extendRules($Vm, [Actions.REDUCE, 5], ObjectFromPairs.of([INDEX35, [Actions.SHIFT, 31]])),
197- extendRules($Vm, [Actions.REDUCE, 6]),
198+ extendRules($Vm, [LexActions.REDUCE, 2], ObjectFromPairs.of([INDEX33, [LexActions.SHIFT, 30]])),
199+ extendRules($Vm, [LexActions.REDUCE, 3]),
200+ extendRules($Vm, [LexActions.REDUCE, 4]),
201+ extendRules($Vm, [LexActions.REDUCE, 5], ObjectFromPairs.of([INDEX35, [LexActions.SHIFT, 31]])),
202+ extendRules($Vm, [LexActions.REDUCE, 6]),
203 ObjectFromPairs.of([
204 SINGLE_QUOTES_RULE_INDEX, 13,
205 DATE_RULE_INDEX, 32,
206@@ -558,16 +501,16 @@ let Parser = (function () {
207 END_OF_STRING_RULE_INDEX, $Vb
208 ]),
209 ObjectFromPairs.of([
210- AMPERSAND_SIGN_RULE_INDEX, [Actions.SHIFT, 35]
211+ AMPERSAND_SIGN_RULE_INDEX, [LexActions.SHIFT, 35]
212 ]),
213- extendRules($Vm, [Actions.REDUCE, 25]),
214- extendRules($Vm, [Actions.REDUCE, 26], ObjectFromPairs.of([Actions.REDUCE, 36, 32, [Actions.SHIFT, 37], 36, $Vb])),
215- extendRules($Vn, [Actions.REDUCE, 36], ObjectFromPairs.of([INDEX36, $Vo])),
216- extendRules($Vp, [Actions.REDUCE, 38], ObjectFromPairs.of([INDEX33, [Actions.SHIFT, 39]])),
217- extendRules($Vm, [Actions.REDUCE, 28], ObjectFromPairs.of([INDEX27, [Actions.SHIFT, 40]])),
218- extendRules($Vm, [Actions.REDUCE, 30], ObjectFromPairs.of([INDEX27, [Actions.SHIFT, 41]])),
219- ObjectFromPairs.of([INDEX32, [Actions.SHIFT, 42]]),
220- ObjectFromPairs.of([INDEX1, [Actions.ACCEPT, 1]]),
221+ extendRules($Vm, [LexActions.REDUCE, 25]),
222+ extendRules($Vm, [LexActions.REDUCE, 26], ObjectFromPairs.of([LexActions.REDUCE, 36, 32, [LexActions.SHIFT, 37], 36, $Vb])),
223+ extendRules($Vn, [LexActions.REDUCE, 36], ObjectFromPairs.of([INDEX36, $Vo])),
224+ extendRules($Vp, [LexActions.REDUCE, 38], ObjectFromPairs.of([INDEX33, [LexActions.SHIFT, 39]])),
225+ extendRules($Vm, [LexActions.REDUCE, 28], ObjectFromPairs.of([INDEX27, [LexActions.SHIFT, 40]])),
226+ extendRules($Vm, [LexActions.REDUCE, 30], ObjectFromPairs.of([INDEX27, [LexActions.SHIFT, 41]])),
227+ ObjectFromPairs.of([INDEX32, [LexActions.SHIFT, 42]]),
228+ ObjectFromPairs.of([INDEX1, [LexActions.ACCEPT, 1]]),
229 ObjectFromPairs.of([
230 SINGLE_QUOTES_RULE_INDEX, 13,
231 DATE_RULE_INDEX, 43,
232@@ -761,13 +704,13 @@ let Parser = (function () {
233 PERCENT_SIGN_RULE_INDEX, $Va,
234 END_OF_STRING_RULE_INDEX, $Vb
235 ]),
236- ObjectFromPairs.of([ [Actions.SHIFT, 56]]),
237- extendRules($Vp, [Actions.REDUCE, 40]),
238+ ObjectFromPairs.of([ [LexActions.SHIFT, 56]]),
239+ extendRules($Vp, [LexActions.REDUCE, 40]),
240 ObjectFromPairs.of([
241 INTEGER_RULE_INDEX, $Vc,
242 OPEN_AND_CLOSE_OF_ARRAY_RULE_INDEX, $Vd,
243 DOLLAR_SIGN_RULE_INDEX, $Ve,
244- SINGLE_WHITESPACE_RULE_INDEX, [Actions.SHIFT, 57],
245+ SINGLE_WHITESPACE_RULE_INDEX, [LexActions.SHIFT, 57],
246 PERIOD_RULE_INDEX, $Vf,
247 COLON_RULE_INDEX, $Vg,
248 SEMI_COLON_RULE_INDEX, $Vh,
249@@ -776,13 +719,13 @@ let Parser = (function () {
250 FORWARD_SLASH_RULE_INDEX, $Vk,
251 MINUS_SIGN_RULE_INDEX, $Vl
252 ]),
253- extendRules($Vq, [Actions.REDUCE, 21], ObjectFromPairs.of([
254+ extendRules($Vq, [LexActions.REDUCE, 21], ObjectFromPairs.of([
255 INDEX11, $Vc,
256 INDEX20, $Vj,
257 INDEX21, $Vk,
258 INDEX22, $Vl
259 ])),
260- extendRules($Vq, [Actions.REDUCE, 22], ObjectFromPairs.of([
261+ extendRules($Vq, [LexActions.REDUCE, 22], ObjectFromPairs.of([
262 INDEX11, $Vc,
263 INDEX20, $Vj,
264 INDEX21, $Vk,
265@@ -810,15 +753,15 @@ let Parser = (function () {
266 PERCENT_SIGN_RULE_INDEX, $Va,
267 END_OF_STRING_RULE_INDEX, $Vb
268 ]),
269- extendRules($Vm, [Actions.REDUCE, 27]),
270+ extendRules($Vm, [LexActions.REDUCE, 27]),
271 ObjectFromPairs.of([INDEX36, $Vo]),
272- ObjectFromPairs.of([INDEX32, [Actions.SHIFT, 62]]),
273- ObjectFromPairs.of([INDEX34, [Actions.SHIFT, 63]]),
274- ObjectFromPairs.of([INDEX26, [Actions.SHIFT, 64]]),
275- ObjectFromPairs.of([INDEX28, [Actions.SHIFT, 65]]),
276- ObjectFromPairs.of([37, [Actions.SHIFT, 66]]),
277- extendRules($Vm, [Actions.REDUCE, 7]),
278- extendRules([5, 12, 15, 30, 31], [Actions.REDUCE, 8], ObjectFromPairs.of([
279+ ObjectFromPairs.of([INDEX32, [LexActions.SHIFT, 62]]),
280+ ObjectFromPairs.of([INDEX34, [LexActions.SHIFT, 63]]),
281+ ObjectFromPairs.of([INDEX26, [LexActions.SHIFT, 64]]),
282+ ObjectFromPairs.of([INDEX28, [LexActions.SHIFT, 65]]),
283+ ObjectFromPairs.of([37, [LexActions.SHIFT, 66]]),
284+ extendRules($Vm, [LexActions.REDUCE, 7]),
285+ extendRules([5, 12, 15, 30, 31], [LexActions.REDUCE, 8], ObjectFromPairs.of([
286 INTEGER_RULE_INDEX, $Vc,
287 DOLLAR_SIGN_RULE_INDEX, $Ve,
288 PERIOD_RULE_INDEX, $Vf,
289@@ -829,7 +772,7 @@ let Parser = (function () {
290 FORWARD_SLASH_RULE_INDEX, $Vk,
291 MINUS_SIGN_RULE_INDEX, $Vl
292 ])),
293- extendRules($Vq, [Actions.REDUCE, 9], ObjectFromPairs.of([
294+ extendRules($Vq, [LexActions.REDUCE, 9], ObjectFromPairs.of([
295 INDEX11, $Vc,
296 INDEX20, $Vj,
297 INDEX21, $Vk,
298@@ -873,7 +816,7 @@ let Parser = (function () {
299 PERCENT_SIGN_RULE_INDEX, $Va,
300 END_OF_STRING_RULE_INDEX, $Vb
301 ]),
302- extendRules($Vr, [Actions.REDUCE, 16], ObjectFromPairs.of([
303+ extendRules($Vr, [LexActions.REDUCE, 16], ObjectFromPairs.of([
304 INTEGER_RULE_INDEX, $Vc,
305 DOLLAR_SIGN_RULE_INDEX, $Ve,
306 COMMA_RULE_INDEX, $Vi,
307@@ -900,7 +843,7 @@ let Parser = (function () {
308 PERCENT_SIGN_RULE_INDEX, $Va,
309 END_OF_STRING_RULE_INDEX, $Vb
310 ]),
311- extendRules($Vr, [Actions.REDUCE, 15], ObjectFromPairs.of([
312+ extendRules($Vr, [LexActions.REDUCE, 15], ObjectFromPairs.of([
313 INTEGER_RULE_INDEX, $Vc,
314 DOLLAR_SIGN_RULE_INDEX, $Ve,
315 COMMA_RULE_INDEX, $Vi,
316@@ -908,7 +851,7 @@ let Parser = (function () {
317 FORWARD_SLASH_RULE_INDEX, $Vk,
318 MINUS_SIGN_RULE_INDEX, $Vl
319 ])),
320- extendRules([5, 12, 15, 18, 30, 31], [Actions.REDUCE, 14], ObjectFromPairs.of([
321+ extendRules([5, 12, 15, 18, 30, 31], [LexActions.REDUCE, 14], ObjectFromPairs.of([
322 INTEGER_RULE_INDEX, $Vc,
323 DOLLAR_SIGN_RULE_INDEX, $Ve,
324 PERIOD_RULE_INDEX, $Vf,
325@@ -918,30 +861,30 @@ let Parser = (function () {
326 FORWARD_SLASH_RULE_INDEX, $Vk,
327 MINUS_SIGN_RULE_INDEX, $Vl
328 ])),
329- extendRules($Vq, [Actions.REDUCE, 17], ObjectFromPairs.of([
330+ extendRules($Vq, [LexActions.REDUCE, 17], ObjectFromPairs.of([
331 INTEGER_RULE_INDEX, $Vc,
332 ASTERISK_RULE_INDEX, $Vj,
333 FORWARD_SLASH_RULE_INDEX, $Vk,
334 MINUS_SIGN_RULE_INDEX, $Vl
335 ])),
336- extendRules($Vs, [Actions.REDUCE, 18], ObjectFromPairs.of([
337+ extendRules($Vs, [LexActions.REDUCE, 18], ObjectFromPairs.of([
338 INTEGER_RULE_INDEX, $Vc,
339 MINUS_SIGN_RULE_INDEX, $Vl
340 ])),
341- extendRules($Vs, [Actions.REDUCE, 19], ObjectFromPairs.of([
342+ extendRules($Vs, [LexActions.REDUCE, 19], ObjectFromPairs.of([
343 INTEGER_RULE_INDEX, $Vc,
344 MINUS_SIGN_RULE_INDEX, $Vl
345 ])),
346- extendRules([5, 12, 13, 15, 16, 17, 18, 19, 20, 21, 22, 30, 31], [Actions.REDUCE, 20], ObjectFromPairs.of([INTEGER_RULE_INDEX, $Vc])),
347- extendRules($Vn, [Actions.REDUCE, 37]),
348- extendRules($Vm, [Actions.REDUCE, 10]),
349- extendRules($Vm, [Actions.REDUCE, 23]),
350+ extendRules([5, 12, 13, 15, 16, 17, 18, 19, 20, 21, 22, 30, 31], [LexActions.REDUCE, 20], ObjectFromPairs.of([INTEGER_RULE_INDEX, $Vc])),
351+ extendRules($Vn, [LexActions.REDUCE, 37]),
352+ extendRules($Vm, [LexActions.REDUCE, 10]),
353+ extendRules($Vm, [LexActions.REDUCE, 23]),
354 ObjectFromPairs.of([
355- SINGLE_WHITESPACE_RULE_INDEX, [Actions.SHIFT, 70],
356- OPEN_DOUBLE_QUOTE_INDEX, [Actions.SHIFT, 71],
357- OPEN_SINGLE_QUITE_INDEX, [Actions.SHIFT, 72]
358+ SINGLE_WHITESPACE_RULE_INDEX, [LexActions.SHIFT, 70],
359+ OPEN_DOUBLE_QUOTE_INDEX, [LexActions.SHIFT, 71],
360+ OPEN_SINGLE_QUITE_INDEX, [LexActions.SHIFT, 72]
361 ]),
362- extendRules($Vt, [Actions.REDUCE, 32], ObjectFromPairs.of([
363+ extendRules($Vt, [LexActions.REDUCE, 32], ObjectFromPairs.of([
364 INTEGER_RULE_INDEX, $Vc,
365 OPEN_AND_CLOSE_OF_ARRAY_RULE_INDEX, $Vd,
366 DOLLAR_SIGN_RULE_INDEX, $Ve,
367@@ -953,12 +896,12 @@ let Parser = (function () {
368 FORWARD_SLASH_RULE_INDEX, $Vk,
369 MINUS_SIGN_RULE_INDEX, $Vl
370 ])),
371- extendRules($Vt, [Actions.REDUCE, 33]), ObjectFromPairs.of([37, [Actions.SHIFT, 73]]), // index 37?
372- extendRules($Vp, [Actions.REDUCE, 39]),
373- extendRules($Vm, [Actions.REDUCE, 29]),
374- extendRules($Vm, [Actions.REDUCE, 31]),
375- extendRules($Vu, [Actions.REDUCE, 41]),
376- extendRules($Vr, [Actions.REDUCE, 11], ObjectFromPairs.of([
377+ extendRules($Vt, [LexActions.REDUCE, 33]), ObjectFromPairs.of([37, [LexActions.SHIFT, 73]]), // index 37?
378+ extendRules($Vp, [LexActions.REDUCE, 39]),
379+ extendRules($Vm, [LexActions.REDUCE, 29]),
380+ extendRules($Vm, [LexActions.REDUCE, 31]),
381+ extendRules($Vu, [LexActions.REDUCE, 41]),
382+ extendRules($Vr, [LexActions.REDUCE, 11], ObjectFromPairs.of([
383 INTEGER_RULE_INDEX, $Vc,
384 DOLLAR_SIGN_RULE_INDEX, $Ve,
385 COMMA_RULE_INDEX, $Vi,
386@@ -966,7 +909,7 @@ let Parser = (function () {
387 FORWARD_SLASH_RULE_INDEX, $Vk,
388 MINUS_SIGN_RULE_INDEX, $Vl
389 ])),
390- extendRules($Vr, [Actions.REDUCE, 13], ObjectFromPairs.of([
391+ extendRules($Vr, [LexActions.REDUCE, 13], ObjectFromPairs.of([
392 11, $Vc,
393 13, $Ve,
394 19, $Vi,
395@@ -974,7 +917,7 @@ let Parser = (function () {
396 21, $Vk,
397 22, $Vl
398 ])),
399- extendRules($Vr, [Actions.REDUCE, 12], ObjectFromPairs.of([
400+ extendRules($Vr, [LexActions.REDUCE, 12], ObjectFromPairs.of([
401 INTEGER_RULE_INDEX, $Vc,
402 DOLLAR_SIGN_RULE_INDEX, $Ve,
403 COMMA_RULE_INDEX, $Vi,
404@@ -982,7 +925,7 @@ let Parser = (function () {
405 FORWARD_SLASH_RULE_INDEX, $Vk,
406 MINUS_SIGN_RULE_INDEX, $Vl
407 ])),
408- extendRules($Vm, [Actions.REDUCE, 24]),
409+ extendRules($Vm, [LexActions.REDUCE, 24]),
410 ObjectFromPairs.of([
411 SINGLE_QUOTES_RULE_INDEX, 13,
412 DATE_RULE_INDEX, 74,
413@@ -1021,8 +964,8 @@ let Parser = (function () {
414 PERCENT_SIGN_RULE_INDEX, $Va,
415 END_OF_STRING_RULE_INDEX, $Vb
416 ]),
417- extendRules($Vu, [Actions.REDUCE, 42]),
418- extendRules($Vt, [Actions.REDUCE, 34], ObjectFromPairs.of([
419+ extendRules($Vu, [LexActions.REDUCE, 42]),
420+ extendRules($Vt, [LexActions.REDUCE, 34], ObjectFromPairs.of([
421 INTEGER_RULE_INDEX, $Vc,
422 OPEN_AND_CLOSE_OF_ARRAY_RULE_INDEX, $Vd,
423 DOLLAR_SIGN_RULE_INDEX, $Ve,
424@@ -1034,7 +977,7 @@ let Parser = (function () {
425 FORWARD_SLASH_RULE_INDEX, $Vk,
426 MINUS_SIGN_RULE_INDEX, $Vl
427 ])),
428- extendRules($Vt, [Actions.REDUCE, 35], ObjectFromPairs.of([
429+ extendRules($Vt, [LexActions.REDUCE, 35], ObjectFromPairs.of([
430 INTEGER_RULE_INDEX, $Vc,
431 OPEN_AND_CLOSE_OF_ARRAY_RULE_INDEX, $Vd,
432 DOLLAR_SIGN_RULE_INDEX, $Ve,
433@@ -1047,7 +990,7 @@ let Parser = (function () {
434 MINUS_SIGN_RULE_INDEX, $Vl
435 ]))
436 ],
437- defaultActions: ObjectFromPairs.of([COMMA_RULE_INDEX, [Actions.REDUCE, 1]]),
438+ defaultActions: ObjectFromPairs.of([COMMA_RULE_INDEX, [LexActions.REDUCE, 1]]),
439 parseError: function parseError(str, hash) {
440 if (hash.recoverable) {
441 this.trace(str);
442@@ -1058,8 +1001,8 @@ let Parser = (function () {
443 parse: function parse(input) {
444 let self = this,
445 stack = [0],
446- vstack = [null], // semantic value stack
447- lstack = [], // location stack
448+ semanticValueStack = [null], // semantic value stack
449+ locationStack = [], // location stack
450 table = this.table,
451 yytext = '',
452 yylineno = 0,
453@@ -1068,7 +1011,7 @@ let Parser = (function () {
454 TERROR = 2,
455 EOF = 1;
456
457- let args = lstack.slice.call(arguments, 1);
458+ let args = locationStack.slice.call(arguments, 1);
459
460 //this.reductionCount = this.shiftCount = 0;
461
462@@ -1098,7 +1041,7 @@ let Parser = (function () {
463 lexer.yylloc = {};
464 }
465 let yyloc = lexer.yylloc;
466- lstack.push(yyloc);
467+ locationStack.push(yyloc);
468
469 let ranges = lexer.options && lexer.options.ranges;
470
471@@ -1110,8 +1053,8 @@ let Parser = (function () {
472
473 function popStack(n) {
474 stack.length = stack.length - 2 * n;
475- vstack.length = vstack.length - n;
476- lstack.length = lstack.length - n;
477+ semanticValueStack.length = semanticValueStack.length - n;
478+ locationStack.length = locationStack.length - n;
479 }
480
481 function lex() {
482@@ -1232,17 +1175,15 @@ let Parser = (function () {
483 throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
484 }
485
486- // Actions are always:
487+ // LexActions are always:
488 // Shift: continue to process tokens.
489 // Reduce: enough tokens have been gathered for use to reduce input through evaluation.
490 // Accept: return.
491 switch (action[0]) {
492- case Actions.SHIFT: // Shift
493- //this.shiftCount++;
494-
495+ case LexActions.SHIFT: // Shift
496 stack.push(symbol);
497- vstack.push(lexer.yytext);
498- lstack.push(lexer.yylloc);
499+ semanticValueStack.push(lexer.yytext);
500+ locationStack.push(lexer.yylloc);
501 stack.push(action[1]); // push state
502 symbol = null;
503 if (!preErrorSymbol) { // normal execution/no error
504@@ -1260,25 +1201,22 @@ let Parser = (function () {
505 }
506 break;
507
508- case Actions.REDUCE:
509- // Reduce
510- //this.reductionCount++;
511-
512+ case LexActions.REDUCE: // Reduce
513 len = this.productions_[action[1]][1];
514
515 // perform semantic action
516- yyval.$ = vstack[vstack.length - len]; // default to $$ = $1
517+ yyval.$ = semanticValueStack[semanticValueStack.length - len]; // default to $$ = $1
518 // default location, uses first token for firsts, last for lasts
519 yyval._$ = {
520- first_line: lstack[lstack.length - (len || 1)].first_line,
521- last_line: lstack[lstack.length - 1].last_line,
522- first_column: lstack[lstack.length - (len || 1)].first_column,
523- last_column: lstack[lstack.length - 1].last_column
524+ first_line: locationStack[locationStack.length - (len || 1)].first_line,
525+ last_line: locationStack[locationStack.length - 1].last_line,
526+ first_column: locationStack[locationStack.length - (len || 1)].first_column,
527+ last_column: locationStack[locationStack.length - 1].last_column
528 };
529 if (ranges) {
530- yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]];
531+ yyval._$.range = [locationStack[locationStack.length - (len || 1)].range[0], locationStack[locationStack.length - 1].range[1]];
532 }
533- r = this.performAction.apply(yyval, [yytext, yyleng, yylineno, sharedState.yy, action[1], vstack, lstack].concat(args));
534+ r = this.performAction.apply(yyval, [yytext, yyleng, yylineno, sharedState.yy, action[1], semanticValueStack, locationStack].concat(args));
535
536 if (typeof r !== 'undefined') {
537 return r;
538@@ -1287,19 +1225,19 @@ let Parser = (function () {
539 // pop off stack
540 if (len) {
541 stack = stack.slice(0, -1 * len * 2);
542- vstack = vstack.slice(0, -1 * len);
543- lstack = lstack.slice(0, -1 * len);
544+ semanticValueStack = semanticValueStack.slice(0, -1 * len);
545+ locationStack = locationStack.slice(0, -1 * len);
546 }
547
548- stack.push(this.productions_[action[1]][0]); // push nonterminal (reduce)
549- vstack.push(yyval.$);
550- lstack.push(yyval._$);
551- // goto new state = table[STATE][NONTERMINAL]
552+ // push non-terminal (reduce)
553+ stack.push(this.productions_[action[1]][0]);
554+ semanticValueStack.push(yyval.$);
555+ locationStack.push(yyval._$);
556 newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
557 stack.push(newState);
558 break;
559
560- case Actions.ACCEPT:
561+ case LexActions.ACCEPT:
562 // Accept
563 return true;
564 }
565@@ -1308,9 +1246,9 @@ let Parser = (function () {
566 }
567 };
568
569- /* generated by jison-lex 0.3.4 */
570- var lexer = (function () {
571- var lexer = ({
572+
573+ let lexer = (function () {
574+ let lexer = ({
575
576 EOF: 1,
577
578@@ -1345,13 +1283,13 @@ let Parser = (function () {
579
580 // consumes and returns one char from the input
581 input: function () {
582- var ch = this._input[0];
583+ let ch = this._input[0];
584 this.yytext += ch;
585 this.yyleng++;
586 this.offset++;
587 this.match += ch;
588 this.matched += ch;
589- var lines = ch.match(/(?:\r\n?|\n).*/g);
590+ let lines = ch.match(/(?:\r\n?|\n).*/g);
591 if (lines) {
592 this.yylineno++;
593 this.yylloc.last_line++;
594@@ -1368,8 +1306,8 @@ let Parser = (function () {
595
596 // unshifts one char (or a string) into the input
597 unput: function (ch) {
598- var len = ch.length;
599- var lines = ch.split(/(?:\r\n?|\n)/g);
600+ let len = ch.length;
601+ let lines = ch.split(/(?:\r\n?|\n)/g);
602
603 this._input = ch + this._input;
604 this.yytext = this.yytext.substr(0, this.yytext.length - len);
605@@ -1634,9 +1572,9 @@ let Parser = (function () {
606 },
607 options: {},
608 performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
609- var YYSTATE = YY_START;
610 switch ($avoiding_name_collisions) {
611- case 0:/* skip whitespace */
612+ case 0:
613+ // skip whitespace
614 break;
615 case 1:
616 return 10;
617@@ -1719,7 +1657,46 @@ let Parser = (function () {
618 rules: RULES,
619 conditions: {
620 "INITIAL": {
621- "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, 37],
622+ "rules": [
623+ 0,
624+ 1,
625+ 2,
626+ 3,
627+ 4,
628+ 5,
629+ 6,
630+ 7,
631+ 8,
632+ 9,
633+ 10,
634+ 11,
635+ 12,
636+ 13,
637+ 14,
638+ 15,
639+ 16,
640+ 17,
641+ 18,
642+ 19,
643+ 20,
644+ 21,
645+ 22,
646+ 23,
647+ 24,
648+ 25,
649+ 26,
650+ 27,
651+ 28,
652+ 29,
653+ 30,
654+ 31,
655+ 32,
656+ 33,
657+ 34,
658+ 35,
659+ 36,
660+ 37
661+ ],
662 "inclusive": true
663 }
664 }