commit
message
[ParserConstants] more state enumerations
author
Ben Vogt <[email protected]>
date
2017-12-10 05:04:03
stats
2 file(s) changed,
97 insertions(+),
75 deletions(-)
files
src/Parser/ParserConstants.ts
tests/Parser/ParseEngineTest.ts
1diff --git a/src/Parser/ParserConstants.ts b/src/Parser/ParserConstants.ts
2index da018a5..7614a6e 100644
3--- a/src/Parser/ParserConstants.ts
4+++ b/src/Parser/ParserConstants.ts
5@@ -361,8 +361,17 @@ const SYMBOL_INDEX_TO_NAME = symbolIndexToName;
6 const enum State {
7 START = 0,
8 START_NUMBER = 6,
9+ START_STRING = 7,
10+ LEFT_PAREN = 8,
11+ START_EQUALS = 21,
12+ LESS_THAN = 23,
13+ GREATER_THAN = 24,
14 ADD_TWO_NUMBERS = 45,
15- SUBTRACT_TWO_NUMBERS = 52
16+ SUBTRACT_TWO_NUMBERS = 52,
17+ MULTIPLY_TWO_NUMBERS = 53,
18+ DIVIDE_TWO_NUMBERS = 54,
19+ NUMBER_TO_POWER_OF_OTHER = 55,
20+ CLOSE_PAREN_ON_EXPRESSION = 57
21 }
22
23
24@@ -379,9 +388,9 @@ table[State.START] = ObjectBuilder
25 .add(Symbol.EXPRESSION, 2)
26 .add(Symbol.VARIABLE_SEQUENCE, 3)
27 .add(Symbol.NUMBER, State.START_NUMBER)
28- .add(Symbol.STRING, [SHIFT, 7])
29+ .add(Symbol.STRING, [SHIFT, State.START_STRING])
30 .add(Symbol.PLUS, [SHIFT, 10])
31- .add(Symbol.LEFT_PAREN, [SHIFT, 8])
32+ .add(Symbol.LEFT_PAREN, [SHIFT, State.LEFT_PAREN])
33 .add(Symbol.MINUS, [SHIFT, 9])
34 .add(Symbol.FUNCTION, [SHIFT, 11])
35 .add(Symbol.CELL, 12)
36@@ -397,10 +406,10 @@ table[1] = ObjectBuilder
37 table[2] = ObjectBuilder
38 .add(Symbol.EOF, [SHIFT, 19])
39 .add(Symbol.AMPERSAND, [SHIFT, 20])
40- .add(Symbol.EQUALS, [SHIFT, 21])
41+ .add(Symbol.EQUALS, [SHIFT, State.START_EQUALS])
42 .add(Symbol.PLUS, [SHIFT, 22])
43- .add(Symbol.LESS_THAN, [SHIFT, 23])
44- .add(Symbol.GREATER_THAN, [SHIFT, 24])
45+ .add(Symbol.LESS_THAN, [SHIFT, State.LESS_THAN])
46+ .add(Symbol.GREATER_THAN, [SHIFT, State.GREATER_THAN])
47 .add(Symbol.NOT, [SHIFT, 25])
48 .add(Symbol.MINUS, [SHIFT, 26])
49 .add(Symbol.ASTERISK, [SHIFT, 27])
50@@ -441,7 +450,7 @@ table[State.START_NUMBER] = ObjectBuilder
51 .add(Symbol.COMMA, [REDUCE, ReduceActions.AS_NUMBER])
52 .add(Symbol.PERCENT, [SHIFT, ReduceActions.CELL_RANGE_VALUE])
53 .build();
54-table[7] = ObjectBuilder
55+table[State.START_STRING] = ObjectBuilder
56 .add(Symbol.EOF, [REDUCE, ReduceActions.AS_STRING])
57 .add(Symbol.AMPERSAND, [REDUCE, ReduceActions.AS_STRING])
58 .add(Symbol.EQUALS, [REDUCE, ReduceActions.AS_STRING])
59@@ -457,14 +466,14 @@ table[7] = ObjectBuilder
60 .add(Symbol.SEMI_COLON, [REDUCE, ReduceActions.AS_STRING])
61 .add(Symbol.COMMA, [REDUCE, ReduceActions.AS_STRING])
62 .build();
63-table[8] = ObjectBuilder
64+table[State.LEFT_PAREN] = ObjectBuilder
65 .add(Symbol.ERROR, 13)
66 .add(Symbol.EXPRESSION, 32)
67 .add(Symbol.VARIABLE_SEQUENCE, 3)
68 .add(Symbol.NUMBER, State.START_NUMBER)
69- .add(Symbol.STRING, [SHIFT, 7])
70+ .add(Symbol.STRING, [SHIFT, State.START_STRING])
71 .add(Symbol.PLUS, [SHIFT, 10])
72- .add(Symbol.LEFT_PAREN, [SHIFT, 8])
73+ .add(Symbol.LEFT_PAREN, [SHIFT, State.LEFT_PAREN])
74 .add(Symbol.MINUS, [SHIFT, 9])
75 .add(Symbol.FUNCTION, [SHIFT, 11])
76 .add(Symbol.CELL, 12)
77@@ -479,9 +488,9 @@ table[9] = ObjectBuilder
78 .add(Symbol.EXPRESSION, 33)
79 .add(Symbol.VARIABLE_SEQUENCE, 3)
80 .add(Symbol.NUMBER, State.START_NUMBER)
81- .add(Symbol.STRING, [SHIFT, 7])
82+ .add(Symbol.STRING, [SHIFT, State.START_STRING])
83 .add(Symbol.PLUS, [SHIFT, 10])
84- .add(Symbol.LEFT_PAREN, [SHIFT, 8])
85+ .add(Symbol.LEFT_PAREN, [SHIFT, State.LEFT_PAREN])
86 .add(Symbol.MINUS, [SHIFT, 9])
87 .add(Symbol.FUNCTION, [SHIFT, 11])
88 .add(Symbol.CELL, 12)
89@@ -496,9 +505,9 @@ table[10] = ObjectBuilder
90 .add(Symbol.EXPRESSION, 34)
91 .add(Symbol.VARIABLE_SEQUENCE, 3)
92 .add(Symbol.NUMBER, State.START_NUMBER)
93- .add(Symbol.STRING, [SHIFT, 7])
94+ .add(Symbol.STRING, [SHIFT, State.START_STRING])
95 .add(Symbol.PLUS, [SHIFT, 10])
96- .add(Symbol.LEFT_PAREN, [SHIFT, 8])
97+ .add(Symbol.LEFT_PAREN, [SHIFT, State.LEFT_PAREN])
98 .add(Symbol.MINUS, [SHIFT, 9])
99 .add(Symbol.FUNCTION, [SHIFT, 11])
100 .add(Symbol.CELL, 12)
101@@ -631,9 +640,9 @@ table[20] = ObjectBuilder
102 .add(Symbol.EXPRESSION, 43)
103 .add(Symbol.VARIABLE_SEQUENCE, 3)
104 .add(Symbol.NUMBER, State.START_NUMBER)
105- .add(Symbol.STRING, [SHIFT, 7])
106+ .add(Symbol.STRING, [SHIFT, State.START_STRING])
107 .add(Symbol.PLUS, [SHIFT, 10])
108- .add(Symbol.LEFT_PAREN, [SHIFT, 8])
109+ .add(Symbol.LEFT_PAREN, [SHIFT, State.LEFT_PAREN])
110 .add(Symbol.MINUS, [SHIFT, 9])
111 .add(Symbol.FUNCTION, [SHIFT, 11])
112 .add(Symbol.CELL, 12)
113@@ -643,14 +652,14 @@ table[20] = ObjectBuilder
114 .add(Symbol.NUMBER_UPPER, [SHIFT, 15])
115 .add(Symbol.POUND, [SHIFT, ReduceActions.MULTIPLY])
116 .build();
117-table[21] = ObjectBuilder
118+table[State.START_EQUALS] = ObjectBuilder
119 .add(Symbol.ERROR, 13)
120 .add(Symbol.EXPRESSION, 44)
121 .add(Symbol.VARIABLE_SEQUENCE, 3)
122 .add(Symbol.NUMBER, State.START_NUMBER)
123- .add(Symbol.STRING, [SHIFT, 7])
124+ .add(Symbol.STRING, [SHIFT, State.START_STRING])
125 .add(Symbol.PLUS, [SHIFT, 10])
126- .add(Symbol.LEFT_PAREN, [SHIFT, 8])
127+ .add(Symbol.LEFT_PAREN, [SHIFT, State.LEFT_PAREN])
128 .add(Symbol.MINUS, [SHIFT, 9])
129 .add(Symbol.FUNCTION, [SHIFT, 1])
130 .add(Symbol.CELL, 12)
131@@ -665,9 +674,9 @@ table[22] = ObjectBuilder
132 .add(Symbol.EXPRESSION, 45)
133 .add(Symbol.VARIABLE_SEQUENCE, 3)
134 .add(Symbol.NUMBER, State.START_NUMBER)
135- .add(Symbol.STRING, [SHIFT, 7])
136+ .add(Symbol.STRING, [SHIFT, State.START_STRING])
137 .add(Symbol.PLUS, [SHIFT, 10])
138- .add(Symbol.LEFT_PAREN, [SHIFT, 8])
139+ .add(Symbol.LEFT_PAREN, [SHIFT, State.LEFT_PAREN])
140 .add(Symbol.MINUS, [SHIFT, 9])
141 .add(Symbol.FUNCTION, [SHIFT, 11])
142 .add(Symbol.CELL, 12)
143@@ -677,15 +686,15 @@ table[22] = ObjectBuilder
144 .add(Symbol.NUMBER_UPPER, [SHIFT, 15])
145 .add(Symbol.POUND, [SHIFT, 18])
146 .build();
147-table[23] = ObjectBuilder
148+table[State.LESS_THAN] = ObjectBuilder
149 .add(Symbol.ERROR, 13)
150 .add(Symbol.EXPRESSION, 48)
151 .add(Symbol.VARIABLE_SEQUENCE, 3)
152 .add(Symbol.NUMBER, State.START_NUMBER)
153- .add(Symbol.STRING, [SHIFT, 7])
154+ .add(Symbol.STRING, [SHIFT, State.START_STRING])
155 .add(Symbol.EQUALS, [SHIFT, 46])
156 .add(Symbol.PLUS, [SHIFT, 10])
157- .add(Symbol.LEFT_PAREN, [SHIFT, 8])
158+ .add(Symbol.LEFT_PAREN, [SHIFT, State.LEFT_PAREN])
159 .add(Symbol.GREATER_THAN, [SHIFT, 47])
160 .add(Symbol.MINUS, [SHIFT, 9])
161 .add(Symbol.FUNCTION, [SHIFT, 11])
162@@ -696,15 +705,15 @@ table[23] = ObjectBuilder
163 .add(Symbol.NUMBER_UPPER, [SHIFT, 15])
164 .add(Symbol.POUND, [SHIFT, 18])
165 .build();
166-table[24] = ObjectBuilder
167+table[State.GREATER_THAN] = ObjectBuilder
168 .add(Symbol.ERROR, 13)
169 .add(Symbol.EXPRESSION, 50)
170 .add(Symbol.VARIABLE_SEQUENCE, 3)
171 .add(Symbol.NUMBER, State.START_NUMBER)
172- .add(Symbol.STRING, [SHIFT, 7])
173+ .add(Symbol.STRING, [SHIFT, State.START_STRING])
174 .add(Symbol.EQUALS, [SHIFT, 49])
175 .add(Symbol.PLUS, [SHIFT, 10])
176- .add(Symbol.LEFT_PAREN, [SHIFT, 8])
177+ .add(Symbol.LEFT_PAREN, [SHIFT, State.LEFT_PAREN])
178 .add(Symbol.MINUS, [SHIFT, 9])
179 .add(Symbol.FUNCTION, [SHIFT, 11])
180 .add(Symbol.CELL, 12)
181@@ -719,9 +728,9 @@ table[25] = ObjectBuilder
182 .add(Symbol.EXPRESSION, 51)
183 .add(Symbol.VARIABLE_SEQUENCE, 3)
184 .add(Symbol.NUMBER, State.START_NUMBER)
185- .add(Symbol.STRING, [SHIFT, 7])
186+ .add(Symbol.STRING, [SHIFT, State.START_STRING])
187 .add(Symbol.PLUS, [SHIFT, 10])
188- .add(Symbol.LEFT_PAREN, [SHIFT, 8])
189+ .add(Symbol.LEFT_PAREN, [SHIFT, State.LEFT_PAREN])
190 .add(Symbol.MINUS, [SHIFT, 9])
191 .add(Symbol.FUNCTION, [SHIFT, 11])
192 .add(Symbol.CELL, 12)
193@@ -736,9 +745,9 @@ table[26] = ObjectBuilder
194 .add(Symbol.EXPRESSION, State.SUBTRACT_TWO_NUMBERS)
195 .add(Symbol.VARIABLE_SEQUENCE, 3)
196 .add(Symbol.NUMBER, State.START_NUMBER)
197- .add(Symbol.STRING, [SHIFT, 7])
198+ .add(Symbol.STRING, [SHIFT, State.START_STRING])
199 .add(Symbol.PLUS, [SHIFT, 10])
200- .add(Symbol.LEFT_PAREN, [SHIFT, 8])
201+ .add(Symbol.LEFT_PAREN, [SHIFT, State.LEFT_PAREN])
202 .add(Symbol.MINUS, [SHIFT, 9])
203 .add(Symbol.FUNCTION, [SHIFT, 11])
204 .add(Symbol.CELL, 12)
205@@ -750,12 +759,12 @@ table[26] = ObjectBuilder
206 .build();
207 table[27] = ObjectBuilder
208 .add(Symbol.ERROR, 13)
209- .add(Symbol.EXPRESSION, 53)
210+ .add(Symbol.EXPRESSION, State.MULTIPLY_TWO_NUMBERS)
211 .add(Symbol.VARIABLE_SEQUENCE, 3)
212 .add(Symbol.NUMBER, State.START_NUMBER)
213- .add(Symbol.STRING, [SHIFT, 7])
214+ .add(Symbol.STRING, [SHIFT, State.START_STRING])
215 .add(Symbol.PLUS, [SHIFT, 10])
216- .add(Symbol.LEFT_PAREN, [SHIFT, 8])
217+ .add(Symbol.LEFT_PAREN, [SHIFT, State.LEFT_PAREN])
218 .add(Symbol.MINUS, [SHIFT, 9])
219 .add(Symbol.FUNCTION, [SHIFT, 11])
220 .add(Symbol.CELL, 12)
221@@ -767,12 +776,12 @@ table[27] = ObjectBuilder
222 .build();
223 table[28] = ObjectBuilder
224 .add(Symbol.ERROR, 13)
225- .add(Symbol.EXPRESSION, 54)
226+ .add(Symbol.EXPRESSION, State.DIVIDE_TWO_NUMBERS)
227 .add(Symbol.VARIABLE_SEQUENCE, 3)
228 .add(Symbol.NUMBER, State.START_NUMBER)
229- .add(Symbol.STRING, [SHIFT, 7])
230+ .add(Symbol.STRING, [SHIFT, State.START_STRING])
231 .add(Symbol.PLUS, [SHIFT, 10])
232- .add(Symbol.LEFT_PAREN, [SHIFT, 8])
233+ .add(Symbol.LEFT_PAREN, [SHIFT, State.LEFT_PAREN])
234 .add(Symbol.MINUS, [SHIFT, 9])
235 .add(Symbol.FUNCTION, [SHIFT, 11])
236 .add(Symbol.CELL, 12)
237@@ -784,12 +793,12 @@ table[28] = ObjectBuilder
238 .build();
239 table[29] = ObjectBuilder
240 .add(Symbol.ERROR, 13)
241- .add(Symbol.EXPRESSION, 55)
242+ .add(Symbol.EXPRESSION, State.NUMBER_TO_POWER_OF_OTHER)
243 .add(Symbol.VARIABLE_SEQUENCE, 3)
244 .add(Symbol.NUMBER, State.START_NUMBER)
245- .add(Symbol.STRING, [SHIFT, 7])
246+ .add(Symbol.STRING, [SHIFT, State.START_STRING])
247 .add(Symbol.PLUS, [SHIFT, 10])
248- .add(Symbol.LEFT_PAREN, [SHIFT, 8])
249+ .add(Symbol.LEFT_PAREN, [SHIFT, State.LEFT_PAREN])
250 .add(Symbol.MINUS, [SHIFT, 9])
251 .add(Symbol.FUNCTION, [SHIFT, 11])
252 .add(Symbol.CELL, 12)
253@@ -822,11 +831,11 @@ table[31] = ObjectBuilder
254 .build();
255 table[32] = ObjectBuilder
256 .add(Symbol.AMPERSAND, [SHIFT, 20])
257- .add(Symbol.EQUALS, [SHIFT, 21])
258+ .add(Symbol.EQUALS, [SHIFT, State.START_EQUALS])
259 .add(Symbol.PLUS, [SHIFT, 22])
260- .add(Symbol.RIGHT_PAREN, [SHIFT, 57])
261- .add(Symbol.LESS_THAN, [SHIFT, 23])
262- .add(Symbol.GREATER_THAN, [SHIFT, 24])
263+ .add(Symbol.RIGHT_PAREN, [SHIFT, State.CLOSE_PAREN_ON_EXPRESSION])
264+ .add(Symbol.LESS_THAN, [SHIFT, State.LESS_THAN])
265+ .add(Symbol.GREATER_THAN, [SHIFT, State.GREATER_THAN])
266 .add(Symbol.NOT, [SHIFT, 25])
267 .add(Symbol.MINUS, [SHIFT, 26])
268 .add(Symbol.ASTERISK, [SHIFT, 27])
269@@ -870,9 +879,9 @@ table[35] = ObjectBuilder
270 .add(Symbol.EXPRESSION, 60)
271 .add(Symbol.VARIABLE_SEQUENCE, 3)
272 .add(Symbol.NUMBER, State.START_NUMBER)
273- .add(Symbol.STRING, [SHIFT, 7])
274+ .add(Symbol.STRING, [SHIFT, State.START_STRING])
275 .add(Symbol.PLUS, [SHIFT, 10])
276- .add(Symbol.LEFT_PAREN, [SHIFT, 8])
277+ .add(Symbol.LEFT_PAREN, [SHIFT, State.LEFT_PAREN])
278 .add(Symbol.RIGHT_PAREN, [SHIFT, 58])
279 .add(Symbol.MINUS, [SHIFT, 9])
280 .add(Symbol.FUNCTION, [SHIFT, 11])
281@@ -941,8 +950,8 @@ table[44] = ObjectBuilder
282 .add(Symbol.EQUALS, [REDUCE, ReduceActions.EQUALS])
283 .add(Symbol.PLUS, [SHIFT, 22])
284 .add(Symbol.RIGHT_PAREN, [REDUCE, ReduceActions.EQUALS])
285- .add(Symbol.LESS_THAN, [SHIFT, 23])
286- .add(Symbol.GREATER_THAN, [SHIFT, 24])
287+ .add(Symbol.LESS_THAN, [SHIFT, State.LESS_THAN])
288+ .add(Symbol.GREATER_THAN, [SHIFT, State.GREATER_THAN])
289 .add(Symbol.NOT, [SHIFT, 25])
290 .add(Symbol.MINUS, [SHIFT, 26])
291 .add(Symbol.ASTERISK, [SHIFT, 27])
292@@ -972,9 +981,9 @@ table[46] = ObjectBuilder
293 .add(Symbol.EXPRESSION, 67)
294 .add(Symbol.VARIABLE_SEQUENCE, 3)
295 .add(Symbol.NUMBER, State.START_NUMBER)
296- .add(Symbol.STRING, [SHIFT, 7])
297+ .add(Symbol.STRING, [SHIFT, State.START_STRING])
298 .add(Symbol.PLUS, [SHIFT, 10])
299- .add(Symbol.LEFT_PAREN, [SHIFT, 8])
300+ .add(Symbol.LEFT_PAREN, [SHIFT, State.LEFT_PAREN])
301 .add(Symbol.MINUS, [SHIFT, 9])
302 .add(Symbol.FUNCTION, [SHIFT, 11])
303 .add(Symbol.CELL, 12)
304@@ -989,9 +998,9 @@ table[47] = ObjectBuilder
305 .add(Symbol.EXPRESSION, 68)
306 .add(Symbol.VARIABLE_SEQUENCE, 3)
307 .add(Symbol.NUMBER, State.START_NUMBER)
308- .add(Symbol.STRING, [SHIFT, 7])
309+ .add(Symbol.STRING, [SHIFT, State.START_STRING])
310 .add(Symbol.PLUS, [SHIFT, 10])
311- .add(Symbol.LEFT_PAREN, [SHIFT, 8])
312+ .add(Symbol.LEFT_PAREN, [SHIFT, State.LEFT_PAREN])
313 .add(Symbol.MINUS, [SHIFT, 9])
314 .add(Symbol.FUNCTION, [SHIFT, 11])
315 .add(Symbol.CELL, 12)
316@@ -1022,9 +1031,9 @@ table[49] = ObjectBuilder
317 .add(Symbol.EXPRESSION, 69)
318 .add(Symbol.VARIABLE_SEQUENCE, 3)
319 .add(Symbol.NUMBER, State.START_NUMBER)
320- .add(Symbol.STRING, [SHIFT, 7])
321+ .add(Symbol.STRING, [SHIFT, State.START_STRING])
322 .add(Symbol.PLUS, [SHIFT, 10])
323- .add(Symbol.LEFT_PAREN, [SHIFT, 8])
324+ .add(Symbol.LEFT_PAREN, [SHIFT, State.LEFT_PAREN])
325 .add(Symbol.MINUS, [SHIFT, 9])
326 .add(Symbol.FUNCTION, [SHIFT, 11])
327 .add(Symbol.CELL, 12)
328@@ -1082,7 +1091,7 @@ table[State.SUBTRACT_TWO_NUMBERS] = ObjectBuilder
329 .add(Symbol.SEMI_COLON, [REDUCE, ReduceActions.MINUS])
330 .add(Symbol.COMMA, [REDUCE, ReduceActions.MINUS])
331 .build();
332-table[53] = ObjectBuilder
333+table[State.MULTIPLY_TWO_NUMBERS] = ObjectBuilder
334 .add(Symbol.EOF, [REDUCE, ReduceActions.MULTIPLY])
335 .add(Symbol.AMPERSAND, [SHIFT, ReduceActions.TO_POWER])
336 .add(Symbol.EQUALS, [REDUCE, ReduceActions.MULTIPLY])
337@@ -1098,7 +1107,7 @@ table[53] = ObjectBuilder
338 .add(Symbol.SEMI_COLON, [REDUCE, ReduceActions.MULTIPLY])
339 .add(Symbol.COMMA, [REDUCE, ReduceActions.MULTIPLY])
340 .build();
341-table[54] = ObjectBuilder
342+table[State.DIVIDE_TWO_NUMBERS] = ObjectBuilder
343 .add(Symbol.EOF, [REDUCE, ReduceActions.DIVIDE])
344 .add(Symbol.AMPERSAND, [SHIFT, ReduceActions.TO_POWER])
345 .add(Symbol.EQUALS, [REDUCE, ReduceActions.DIVIDE])
346@@ -1114,7 +1123,7 @@ table[54] = ObjectBuilder
347 .add(Symbol.SEMI_COLON, [REDUCE, ReduceActions.DIVIDE])
348 .add(Symbol.COMMA, [REDUCE, ReduceActions.DIVIDE])
349 .build();
350-table[55] = ObjectBuilder
351+table[State.NUMBER_TO_POWER_OF_OTHER] = ObjectBuilder
352 .add(Symbol.EOF, [REDUCE, ReduceActions.TO_POWER])
353 .add(Symbol.AMPERSAND, [SHIFT, ReduceActions.TO_POWER])
354 .add(Symbol.EQUALS, [REDUCE, ReduceActions.TO_POWER])
355@@ -1147,7 +1156,7 @@ table[56] = ObjectBuilder
356 .add(Symbol.COMMA, [REDUCE, ReduceActions.ENSURE_LAST_TWO_IN_ARRAY_AND_PUSH])
357 .add(33, [REDUCE, ReduceActions.ENSURE_LAST_TWO_IN_ARRAY_AND_PUSH])
358 .build();
359-table[57] = ObjectBuilder
360+table[State.CLOSE_PAREN_ON_EXPRESSION] = ObjectBuilder
361 .add(Symbol.EOF, [REDUCE, ReduceActions.LAST_NUMBER])
362 .add(Symbol.AMPERSAND, [REDUCE, ReduceActions.LAST_NUMBER])
363 .add(Symbol.EQUALS, [REDUCE, ReduceActions.LAST_NUMBER])
364@@ -1186,11 +1195,11 @@ table[59] = ObjectBuilder
365 .build();
366 table[60] = ObjectBuilder
367 .add(Symbol.AMPERSAND, [SHIFT, 20])
368- .add(Symbol.EQUALS, [SHIFT, 21])
369+ .add(Symbol.EQUALS, [SHIFT, State.START_EQUALS])
370 .add(Symbol.PLUS, [SHIFT, 22])
371 .add(Symbol.RIGHT_PAREN, [REDUCE, ReduceActions.ENSURE_IS_ARRAY])
372- .add(Symbol.LESS_THAN, [SHIFT, 23])
373- .add(Symbol.GREATER_THAN, [SHIFT, 24])
374+ .add(Symbol.LESS_THAN, [SHIFT, State.LESS_THAN])
375+ .add(Symbol.GREATER_THAN, [SHIFT, State.GREATER_THAN])
376 .add(Symbol.NOT, [SHIFT, 25])
377 .add(Symbol.MINUS, [SHIFT, 26])
378 .add(Symbol.ASTERISK, [SHIFT, 27])
379@@ -1338,10 +1347,10 @@ table[71] = ObjectBuilder
380 .add(Symbol.EXPRESSION, 74)
381 .add(Symbol.VARIABLE_SEQUENCE, 3)
382 .add(Symbol.NUMBER, State.START_NUMBER)
383- .add(Symbol.STRING, [SHIFT, 7])
384- .add(Symbol.EQUALS, [SHIFT, 21])
385+ .add(Symbol.STRING, [SHIFT, State.START_STRING])
386+ .add(Symbol.EQUALS, [SHIFT, State.START_EQUALS])
387 .add(Symbol.PLUS, [SHIFT, 10])
388- .add(Symbol.LEFT_PAREN, [SHIFT, 8])
389+ .add(Symbol.LEFT_PAREN, [SHIFT, State.LEFT_PAREN])
390 .add(Symbol.MINUS, [SHIFT, 9])
391 .add(Symbol.FUNCTION, [SHIFT, 11])
392 .add(Symbol.CELL, 12)
393@@ -1356,10 +1365,10 @@ table[72] = ObjectBuilder
394 .add(Symbol.EXPRESSION, 75)
395 .add(Symbol.VARIABLE_SEQUENCE, 3)
396 .add(Symbol.NUMBER, State.START_NUMBER)
397- .add(Symbol.STRING, [SHIFT, 7])
398- .add(Symbol.EQUALS, [SHIFT, 21])
399+ .add(Symbol.STRING, [SHIFT, State.START_STRING])
400+ .add(Symbol.EQUALS, [SHIFT, State.START_EQUALS])
401 .add(Symbol.PLUS, [SHIFT, 10])
402- .add(Symbol.LEFT_PAREN, [SHIFT, 8])
403+ .add(Symbol.LEFT_PAREN, [SHIFT, State.LEFT_PAREN])
404 .add(Symbol.MINUS, [SHIFT, 9])
405 .add(Symbol.FUNCTION, [SHIFT, 11])
406 .add(Symbol.CELL, 12)
407@@ -1390,11 +1399,11 @@ table[73] = ObjectBuilder
408 .build();
409 table[74] = ObjectBuilder
410 .add(Symbol.AMPERSAND, [SHIFT, 20])
411- .add(Symbol.EQUALS, [SHIFT, 21])
412+ .add(Symbol.EQUALS, [SHIFT, State.START_EQUALS])
413 .add(Symbol.PLUS, [SHIFT, 22])
414 .add(Symbol.RIGHT_PAREN, [REDUCE, ReduceActions.REDUCE_INT])
415- .add(Symbol.LESS_THAN, [SHIFT, 23])
416- .add(Symbol.GREATER_THAN, [SHIFT, 24])
417+ .add(Symbol.LESS_THAN, [SHIFT, State.LESS_THAN])
418+ .add(Symbol.GREATER_THAN, [SHIFT, State.GREATER_THAN])
419 .add(Symbol.NOT, [SHIFT, 25])
420 .add(Symbol.MINUS, [SHIFT, 26])
421 .add(Symbol.ASTERISK, [SHIFT, 27])
422@@ -1404,11 +1413,11 @@ table[74] = ObjectBuilder
423 .add(Symbol.COMMA, [REDUCE, ReduceActions.REDUCE_INT]).build();
424 table[75] = ObjectBuilder
425 .add(Symbol.AMPERSAND, [SHIFT, 20])
426- .add(Symbol.EQUALS, [SHIFT, 21])
427+ .add(Symbol.EQUALS, [SHIFT, State.START_EQUALS])
428 .add(Symbol.PLUS, [SHIFT, 22])
429 .add(Symbol.RIGHT_PAREN, [REDUCE, ReduceActions.REDUCE_PERCENT])
430- .add(Symbol.LESS_THAN, [SHIFT, 23])
431- .add(Symbol.GREATER_THAN, [SHIFT, 24])
432+ .add(Symbol.LESS_THAN, [SHIFT, State.LESS_THAN])
433+ .add(Symbol.GREATER_THAN, [SHIFT, State.GREATER_THAN])
434 .add(Symbol.NOT, [SHIFT, 25])
435 .add(Symbol.MINUS, [SHIFT, 26])
436 .add(Symbol.ASTERISK, [SHIFT, 27])
437diff --git a/tests/Parser/ParseEngineTest.ts b/tests/Parser/ParseEngineTest.ts
438index cc8cc92..838c21b 100644
439--- a/tests/Parser/ParseEngineTest.ts
440+++ b/tests/Parser/ParseEngineTest.ts
441@@ -265,7 +265,11 @@ let helper = {
442 args = args || [];
443 let formulas = {
444 "SUM": function(...args) {
445- return 10;
446+ let result = 0;
447+ for (let i = 0; i < args.length; i++) {
448+ result = result + args[i];
449+ }
450+ return result;
451 }
452 };
453 if (fn in formulas) {
454@@ -514,3 +518,7 @@ test("Parse range following comma", function(){
455 });
456
457
458+
459+
460+
461+assertEquals(parser.parse('(1+2)'), 3);