spreadsheet
typeScript/javascript spreadsheet parser, with formulas.
git clone https://git.vogt.world/spreadsheet.git
Log | Files | README.md
← Commit log
commit
message
[ParseEngine] defining syntax tree, and reduction actions
author
Ben Vogt <[email protected]>
date
2017-12-09 04:56:56
stats
1 file(s) changed, 139 insertions(+), 136 deletions(-)
files
src/Parser/ParseEngine.ts
  1diff --git a/src/Parser/ParseEngine.ts b/src/Parser/ParseEngine.ts
  2index c10b62d..6d435b5 100644
  3--- a/src/Parser/ParseEngine.ts
  4+++ b/src/Parser/ParseEngine.ts
  5@@ -40,6 +40,7 @@ const Rules = {
  6   POUND:  /^(?:\#)/,
  7   ERROR : /^(?:#N\/A|#NUM\!|#NULL\!|#DIV\/0\!|#VALUE\!|#REF\!|#ERROR)/,
  8   END : /^(?:$)/
  9+  // TODO: Need boolean parsing rule, but needs to be listed after formula parsing rule.
 10 };
 11 
 12 
 13@@ -198,8 +199,10 @@ const enum ReduceActions {
 14   FIXED_CELL_RANGE_VAL = 23,
 15   CELL_VALUE = 24,
 16   CELL_RANGE_VALUE = 25,
 17-  PERCENT = 26
 18-}
 19+  PERCENT = 26,
 20+  START_ARRAY = 27,
 21+  INVERT_NUMBER = 28
 22+};
 23 
 24 /**
 25  * Represents the length to reduce the stack by, and the token index value that will replace those tokens in the stack.
 26@@ -229,6 +232,38 @@ class ReductionPair {
 27   }
 28 }
 29 
 30+const enum Tree {
 31+  START = 0,
 32+  NUMBER = 1,
 33+  STRING = 2,
 34+  BOOLEAN = 3,
 35+  VARIABLE = 4,
 36+  ERROR = 5,
 37+  FORMULA = 6,
 38+  PLUS = 7,
 39+  MINUS = 8,
 40+  ASTERISK = 9,
 41+  SLASH = 10,
 42+  CARROT = 11,
 43+  AMPERSAND = 12,
 44+  PERCENT = 13,
 45+  PERIOD = 14,
 46+  LESS_THAN = 15,
 47+  GREATER_THAN = 16,
 48+  EQUALS = 17,
 49+  COMMA = 18,
 50+  OPEN_PAREN = 19,
 51+  CLOSE_PAREN = 20,
 52+  CELL_REF = 21,
 53+  FIXED_CELL_REF = 22,
 54+  CELL_RANGE_REF = 23,
 55+  FIXED_CELL_RANGE_REF = 24,
 56+  OPEN_ARRAY = 25,
 57+  CLOSE_ARRAY = 26,
 58+  INVERT_NEXT = 27,
 59+  TERMINATE = 28
 60+}
 61+
 62 /**
 63  * Productions is used to look up both the number to use when reducing the stack (productions[x][1]) and the semantic
 64  * value that will replace the tokens in the stack (productions[x][0]).
 65@@ -239,64 +274,33 @@ class ReductionPair {
 66 let productions : Array<ReductionPair> = [];
 67 productions[ReduceActions.NO_ACTION] = null;
 68 productions[ReduceActions.RETURN_LAST] = new ReductionPair(3, 2);
 69-productions[ReduceActions.CALL_VARIABLE] = new ReductionPair(4, 1);
 70-productions[ReduceActions.AS_NUMBER] = new ReductionPair(4, 1);
 71-productions[ReduceActions.AS_STRING] = new ReductionPair(4, 1);
 72-productions[ReduceActions.AMPERSAND] = new ReductionPair(4, 3);
 73-productions[ReduceActions.EQUALS] = new ReductionPair(4, 3);
 74-productions[ReduceActions.PLUS] = new ReductionPair(4, 3);
 75-productions[ReduceActions.LAST_NUMBER] = new ReductionPair(4, 3);
 76-productions[ReduceActions.LTE] = new ReductionPair(4, 4);
 77-productions[ReduceActions.GTE] = new ReductionPair(4, 4);
 78-productions[ReduceActions.NOT_EQ] = new ReductionPair(4, 4);
 79-productions[ReduceActions.NOT] = new ReductionPair(4, 3);
 80-productions[ReduceActions.GT] = new ReductionPair(4, 3);
 81-productions[ReduceActions.LT] = new ReductionPair(4, 3);
 82-productions[ReduceActions.MINUS] = new ReductionPair(4, 3);
 83-productions[ReduceActions.MULTIPLY] = new ReductionPair(4, 3);
 84-productions[ReduceActions.DIVIDE] = new ReductionPair(4, 3);
 85-productions[ReduceActions.TO_POWER] = new ReductionPair(4, 3);
 86-productions[ReduceActions.TO_NUMBER_NAN_AS_ZERO] = new ReductionPair(4, 2);
 87-productions[ReduceActions.CALL_FUNCTION_LAST_BLANK] = new ReductionPair(4, 3);
 88-productions[ReduceActions.FIXED_CELL_VAL] = new ReductionPair(25, 1);
 89-productions[ReduceActions.FIXED_CELL_RANGE_VAL] = new ReductionPair(25, 3);
 90-productions[ReduceActions.CELL_VALUE] = new ReductionPair(25, 1);
 91-productions[ReduceActions.CELL_RANGE_VALUE] = new ReductionPair(25, 3);
 92-productions[ReduceActions.PERCENT] = new ReductionPair(24, 3);
 93-productions[ReduceActions.AS_ERROR] = new ReductionPair(4, 1);
 94+productions[ReduceActions.CALL_VARIABLE] = new ReductionPair(Tree.NUMBER, 1);
 95+productions[ReduceActions.AS_NUMBER] = new ReductionPair(Tree.NUMBER, 1);
 96+productions[ReduceActions.INVERT_NUMBER] = new ReductionPair(Tree.NUMBER, 1);
 97+productions[ReduceActions.AS_STRING] = new ReductionPair(Tree.STRING, 1);
 98+productions[ReduceActions.AMPERSAND] = new ReductionPair(Tree.AMPERSAND, 3);
 99+productions[ReduceActions.EQUALS] = new ReductionPair(Tree.EQUALS, 3);
100+productions[ReduceActions.PLUS] = new ReductionPair(Tree.PLUS, 3);
101+productions[ReduceActions.LAST_NUMBER] = new ReductionPair(Tree.NUMBER, 3);
102+productions[ReduceActions.LTE] = new ReductionPair(Tree.BOOLEAN, 4);
103+productions[ReduceActions.GTE] = new ReductionPair(Tree.BOOLEAN, 4);
104+productions[ReduceActions.NOT_EQ] = new ReductionPair(Tree.BOOLEAN, 4);
105+productions[ReduceActions.GT] = new ReductionPair(Tree.BOOLEAN, 3);
106+productions[ReduceActions.LT] = new ReductionPair(Tree.BOOLEAN, 3);
107+productions[ReduceActions.MINUS] = new ReductionPair(Tree.NUMBER, 3);
108+productions[ReduceActions.MULTIPLY] = new ReductionPair(Tree.NUMBER, 3);
109+productions[ReduceActions.DIVIDE] = new ReductionPair(Tree.NUMBER, 3);
110+productions[ReduceActions.TO_POWER] = new ReductionPair(Tree.NUMBER, 3);
111+productions[ReduceActions.TO_NUMBER_NAN_AS_ZERO] = new ReductionPair(Tree.NUMBER, 2);
112+productions[ReduceActions.FIXED_CELL_VAL] = new ReductionPair(Tree.VARIABLE, 1);
113+productions[ReduceActions.FIXED_CELL_RANGE_VAL] = new ReductionPair(Tree.VARIABLE, 3);
114+productions[ReduceActions.CELL_VALUE] = new ReductionPair(Tree.VARIABLE, 1);
115+productions[ReduceActions.CELL_RANGE_VALUE] = new ReductionPair(Tree.VARIABLE, 3);
116+productions[ReduceActions.PERCENT] = new ReductionPair(Tree.NUMBER, 3);
117+productions[ReduceActions.AS_ERROR] = new ReductionPair(Tree.ERROR, 1);
118 const PRODUCTIONS = productions;
119 
120 
121-const enum Tree {
122-  START = 0,
123-  FOLLOWS_NUMBER = 1,
124-  FOLLOWS_STRING = 2,
125-  FOLLOWS_BOOL = 3,
126-  FOLLOWS_ERROR = 4,
127-  FOLLOWS_FORMULA = 5,
128-  FOLLOWS_PLUS = 6,
129-  FOLLOWS_MINUS = 7,
130-  FOLLOWS_ASTERISK = 8,
131-  FOLLOWS_SLASH = 9,
132-  FOLLOWS_CARROT = 10,
133-  FOLLOWS_AMPERSAND = 11,
134-  FOLLOWS_PERCENT = 12,
135-  FOLLOWS_PERIOD = 13,
136-  FOLLOWS_LESS_THAN = 14,
137-  FOLLOWS_GREATER_THAN = 15,
138-  FOLLOWS_EQUALS = 16,
139-  FOLLOWS_COMMA = 17,
140-  FOLLOWS_OPEN_PAREN = 18,
141-  FOLLOWS_CLOSE_PAREN = 19,
142-  FOLLOWS_CELL_REF = 20,
143-  FOLLOWS_FIXED_CELL_REF = 21,
144-  FOLLOWS_CELL_RANGE_REF = 22,
145-  FOLLOWS_FIXED_CELL_RANGE_REF = 23,
146-  FOLLOWS_OPEN_ARRAY = 24,
147-  FOLLOWS_CLOSE_ARRAY = 25,
148-  TERMINATE = 26
149-}
150-
151 /**
152  * Array of to map rules to to LexActions and other rules. A single index in the object (e.g. `{2: 13}`) indicates the
153  * rule object to follow for the next token, while an array (e.g. `{23: [1, ReduceActions.LTE]}`) indicates the action to be taken,
154@@ -305,30 +309,29 @@ const enum Tree {
155 let table = [];
156 // All functions in the spreadsheet start with a 0-token.
157 table[Tree.START] = ObjectBuilder
158-  .add(Symbol.NUMBER, Tree.FOLLOWS_NUMBER)
159-  .add(Symbol.STRING, null)
160-  .add(Symbol.BOOLEAN, null)
161-  .add(Symbol.FORMULA, null)
162-  .add(Symbol.CELL_REF, null)
163-  .add(Symbol.FIXED_CELL_REF, null)
164-  .add(Symbol.POUND, null)
165-  .add(Symbol.OPEN_ARRAY, null)
166+  .add(Symbol.NUMBER, Tree.NUMBER)
167+  .add(Symbol.STRING, Tree.STRING)
168+  .add(Symbol.BOOLEAN, Tree.BOOLEAN)
169+  .add(Symbol.FORMULA, Tree.FORMULA)
170+  .add(Symbol.CELL_REF, [REDUCE, ReduceActions.CELL_VALUE])
171+  .add(Symbol.FIXED_CELL_REF, [REDUCE, ReduceActions.FIXED_CELL_VAL])
172+  .add(Symbol.OPEN_ARRAY, null) // Start array, push until done? Come back to this one.
173   .add(Symbol.OPEN_PAREN, null)
174-  .add(Symbol.PLUS, null)
175-  .add(Symbol.MINUS, null)
176-  .add(Symbol.PERIOD, null)
177-  .add(Symbol.WHITE_SPACE, null)
178-  .add(Symbol.END, null)
179+  .add(Symbol.PLUS, [SHIFT, ReduceActions.AS_NUMBER]) // If we're starting out, the operator is just the regular number.
180+  .add(Symbol.MINUS, [SHIFT, ReduceActions.INVERT_NUMBER]) // If we're starting out, the operator is inverting the next number
181+  // .add(Symbol.PERIOD, null) // removing for now, maybe we can capture this with numbers, idk.
182+  .add(Symbol.WHITE_SPACE, Tree.START) // loop back.
183+  .add(Symbol.END, Tree.TERMINATE)
184   .build();
185-table[Tree.FOLLOWS_NUMBER] = ObjectBuilder
186-  .add(Symbol.PLUS, null)
187-  .add(Symbol.MINUS, null)
188-  .add(Symbol.ASTERISK, null)
189-  .add(Symbol.DIVIDE, null)
190-  .add(Symbol.CARROT, null)
191-  .add(Symbol.PERCENT, null)
192-  .add(Symbol.AMPERSAND, null)
193-  .add(Symbol.GREATER_THAN, null)
194+table[Tree.NUMBER] = ObjectBuilder
195+  .add(Symbol.PLUS, [SHIFT, ReduceActions.PLUS])
196+  .add(Symbol.MINUS, [SHIFT, ReduceActions.MINUS])
197+  .add(Symbol.ASTERISK, [SHIFT, ReduceActions.AS_NUMBER]) // maybe
198+  .add(Symbol.DIVIDE, [SHIFT, ReduceActions.DIVIDE]) // At this poing in processing we have "X /" but we need the second variable
199+  .add(Symbol.CARROT, [SHIFT, ReduceActions.TO_POWER])
200+  .add(Symbol.PERCENT, [REDUCE, ReduceActions.PERCENT])
201+  .add(Symbol.AMPERSAND, [SHIFT, ReduceActions.AMPERSAND])
202+  .add(Symbol.GREATER_THAN, [SHIFT, ReduceActions.GT])
203   .add(Symbol.LESS_THAN, null)
204   .add(Symbol.EQUALS, null)
205   .add(Symbol.COMMA, null)
206@@ -337,7 +340,7 @@ table[Tree.FOLLOWS_NUMBER] = ObjectBuilder
207   .add(Symbol.WHITE_SPACE, null)
208   .add(Symbol.END, null)
209   .build();
210-table[Tree.FOLLOWS_STRING] = ObjectBuilder
211+table[Tree.STRING] = ObjectBuilder
212   .add(Symbol.PLUS, null)
213   .add(Symbol.MINUS, null)
214   .add(Symbol.ASTERISK, null)
215@@ -354,7 +357,7 @@ table[Tree.FOLLOWS_STRING] = ObjectBuilder
216   .add(Symbol.WHITE_SPACE, null)
217   .add(Symbol.END, null)
218   .build();
219-table[Tree.FOLLOWS_BOOL] = ObjectBuilder
220+table[Tree.BOOLEAN] = ObjectBuilder
221   .add(Symbol.PLUS, null)
222   .add(Symbol.MINUS, null)
223   .add(Symbol.ASTERISK, null)
224@@ -371,7 +374,7 @@ table[Tree.FOLLOWS_BOOL] = ObjectBuilder
225   .add(Symbol.WHITE_SPACE, null)
226   .add(Symbol.END, null)
227   .build();
228-table[Tree.FOLLOWS_ERROR] = ObjectBuilder
229+table[Tree.ERROR] = ObjectBuilder
230   .add(Symbol.PLUS, null)
231   .add(Symbol.MINUS, null)
232   .add(Symbol.ASTERISK, null)
233@@ -385,7 +388,7 @@ table[Tree.FOLLOWS_ERROR] = ObjectBuilder
234   .add(Symbol.WHITE_SPACE, null)
235   .add(Symbol.END, null)
236   .build();
237-table[Tree.FOLLOWS_FORMULA] = ObjectBuilder
238+table[Tree.FORMULA] = ObjectBuilder
239   .add(Symbol.NUMBER, null)
240   .add(Symbol.STRING, null)
241   .add(Symbol.BOOLEAN, null)
242@@ -402,7 +405,7 @@ table[Tree.FOLLOWS_FORMULA] = ObjectBuilder
243   .add(Symbol.WHITE_SPACE, null)
244   .add(Symbol.END, null)
245   .build();
246-table[Tree.FOLLOWS_PLUS] = ObjectBuilder
247+table[Tree.PLUS] = ObjectBuilder
248   .add(Symbol.NUMBER, null)
249   .add(Symbol.STRING, null)
250   .add(Symbol.BOOLEAN, null)
251@@ -417,7 +420,7 @@ table[Tree.FOLLOWS_PLUS] = ObjectBuilder
252   .add(Symbol.OPEN_ARRAY, null)
253   .add(Symbol.WHITE_SPACE, null)
254   .build();
255-table[Tree.FOLLOWS_MINUS] = ObjectBuilder
256+table[Tree.MINUS] = ObjectBuilder
257   .add(Symbol.NUMBER, null)
258   .add(Symbol.STRING, null)
259   .add(Symbol.BOOLEAN, null)
260@@ -432,7 +435,7 @@ table[Tree.FOLLOWS_MINUS] = ObjectBuilder
261   .add(Symbol.OPEN_ARRAY, null)
262   .add(Symbol.WHITE_SPACE, null)
263   .build();
264-table[Tree.FOLLOWS_ASTERISK] = ObjectBuilder
265+table[Tree.ASTERISK] = ObjectBuilder
266   .add(Symbol.NUMBER, null)
267   .add(Symbol.STRING, null)
268   .add(Symbol.BOOLEAN, null)
269@@ -447,7 +450,7 @@ table[Tree.FOLLOWS_ASTERISK] = ObjectBuilder
270   .add(Symbol.OPEN_ARRAY, null)
271   .add(Symbol.WHITE_SPACE, null)
272   .build();
273-table[Tree.FOLLOWS_SLASH] = ObjectBuilder
274+table[Tree.SLASH] = ObjectBuilder
275   .add(Symbol.NUMBER, null)
276   .add(Symbol.STRING, null)
277   .add(Symbol.BOOLEAN, null)
278@@ -462,7 +465,7 @@ table[Tree.FOLLOWS_SLASH] = ObjectBuilder
279   .add(Symbol.OPEN_ARRAY, null)
280   .add(Symbol.WHITE_SPACE, null)
281   .build();
282-table[Tree.FOLLOWS_CARROT] = ObjectBuilder
283+table[Tree.CARROT] = ObjectBuilder
284   .add(Symbol.NUMBER, null)
285   .add(Symbol.STRING, null)
286   .add(Symbol.BOOLEAN, null)
287@@ -477,7 +480,7 @@ table[Tree.FOLLOWS_CARROT] = ObjectBuilder
288   .add(Symbol.OPEN_ARRAY, null)
289   .add(Symbol.WHITE_SPACE, null)
290   .build();
291-table[Tree.FOLLOWS_AMPERSAND] = ObjectBuilder
292+table[Tree.AMPERSAND] = ObjectBuilder
293   .add(Symbol.NUMBER, null)
294   .add(Symbol.STRING, null)
295   .add(Symbol.BOOLEAN, null)
296@@ -492,7 +495,7 @@ table[Tree.FOLLOWS_AMPERSAND] = ObjectBuilder
297   .add(Symbol.OPEN_ARRAY, null)
298   .add(Symbol.WHITE_SPACE, null)
299   .build();
300-table[Tree.FOLLOWS_PERCENT] = ObjectBuilder
301+table[Tree.PERCENT] = ObjectBuilder
302   .add(Symbol.PLUS, null)
303   .add(Symbol.MINUS, null)
304   .add(Symbol.ASTERISK, null)
305@@ -505,7 +508,7 @@ table[Tree.FOLLOWS_PERCENT] = ObjectBuilder
306   .add(Symbol.WHITE_SPACE, null)
307   .add(Symbol.END, null)
308   .build();
309-table[Tree.FOLLOWS_PERIOD] = ObjectBuilder
310+table[Tree.PERIOD] = ObjectBuilder
311   .add(Symbol.PLUS, null)
312   .add(Symbol.MINUS, null)
313   .add(Symbol.ASTERISK, null)
314@@ -519,8 +522,8 @@ table[Tree.FOLLOWS_PERIOD] = ObjectBuilder
315   .add(Symbol.WHITE_SPACE, null)
316   .add(Symbol.END, null)
317   .build();
318-table[Tree.FOLLOWS_LESS_THAN] = ObjectBuilder
319-  .add(Symbol.NUMBER, Tree.FOLLOWS_NUMBER)
320+table[Tree.LESS_THAN] = ObjectBuilder
321+  .add(Symbol.NUMBER, Tree.NUMBER)
322   .add(Symbol.STRING, null)
323   .add(Symbol.BOOLEAN, null)
324   .add(Symbol.FORMULA, null)
325@@ -535,8 +538,8 @@ table[Tree.FOLLOWS_LESS_THAN] = ObjectBuilder
326   .add(Symbol.WHITE_SPACE, null)
327   .add(Symbol.END, null)
328   .build();
329-table[Tree.FOLLOWS_GREATER_THAN] = ObjectBuilder
330-  .add(Symbol.NUMBER, Tree.FOLLOWS_NUMBER)
331+table[Tree.GREATER_THAN] = ObjectBuilder
332+  .add(Symbol.NUMBER, Tree.NUMBER)
333   .add(Symbol.STRING, null)
334   .add(Symbol.BOOLEAN, null)
335   .add(Symbol.FORMULA, null)
336@@ -551,8 +554,8 @@ table[Tree.FOLLOWS_GREATER_THAN] = ObjectBuilder
337   .add(Symbol.WHITE_SPACE, null)
338   .add(Symbol.END, null)
339   .build();;
340-table[Tree.FOLLOWS_EQUALS] = ObjectBuilder
341-  .add(Symbol.NUMBER, Tree.FOLLOWS_NUMBER)
342+table[Tree.EQUALS] = ObjectBuilder
343+  .add(Symbol.NUMBER, Tree.NUMBER)
344   .add(Symbol.STRING, null)
345   .add(Symbol.BOOLEAN, null)
346   .add(Symbol.FORMULA, null)
347@@ -567,8 +570,8 @@ table[Tree.FOLLOWS_EQUALS] = ObjectBuilder
348   .add(Symbol.WHITE_SPACE, null)
349   .add(Symbol.END, null)
350   .build();;
351-table[Tree.FOLLOWS_COMMA] = ObjectBuilder
352-  .add(Symbol.NUMBER, Tree.FOLLOWS_NUMBER)
353+table[Tree.COMMA] = ObjectBuilder
354+  .add(Symbol.NUMBER, Tree.NUMBER)
355   .add(Symbol.STRING, null)
356   .add(Symbol.BOOLEAN, null)
357   .add(Symbol.FORMULA, null)
358@@ -583,8 +586,8 @@ table[Tree.FOLLOWS_COMMA] = ObjectBuilder
359   .add(Symbol.WHITE_SPACE, null)
360   .add(Symbol.END, null)
361   .build();
362-table[Tree.FOLLOWS_OPEN_PAREN] = ObjectBuilder
363-  .add(Symbol.NUMBER, Tree.FOLLOWS_NUMBER)
364+table[Tree.OPEN_PAREN] = ObjectBuilder
365+  .add(Symbol.NUMBER, Tree.NUMBER)
366   .add(Symbol.STRING, null)
367   .add(Symbol.BOOLEAN, null)
368   .add(Symbol.FORMULA, null)
369@@ -598,7 +601,7 @@ table[Tree.FOLLOWS_OPEN_PAREN] = ObjectBuilder
370   .add(Symbol.OPEN_ARRAY, null)
371   .add(Symbol.WHITE_SPACE, null)
372   .build();
373-table[Tree.FOLLOWS_CLOSE_PAREN] = ObjectBuilder
374+table[Tree.CLOSE_PAREN] = ObjectBuilder
375   .add(Symbol.PLUS, null)
376   .add(Symbol.MINUS, null)
377   .add(Symbol.ASTERISK, null)
378@@ -610,7 +613,7 @@ table[Tree.FOLLOWS_CLOSE_PAREN] = ObjectBuilder
379   .add(Symbol.WHITE_SPACE, null)
380   .add(Symbol.END, null)
381   .build();
382-table[Tree.FOLLOWS_CELL_REF] = ObjectBuilder
383+table[Tree.CELL_REF] = ObjectBuilder
384   .add(Symbol.PLUS, null)
385   .add(Symbol.MINUS, null)
386   .add(Symbol.ASTERISK, null)
387@@ -627,7 +630,7 @@ table[Tree.FOLLOWS_CELL_REF] = ObjectBuilder
388   .add(Symbol.WHITE_SPACE, null)
389   .add(Symbol.END, null)
390   .build();
391-table[Tree.FOLLOWS_FIXED_CELL_REF] = ObjectBuilder
392+table[Tree.FIXED_CELL_REF] = ObjectBuilder
393   .add(Symbol.PLUS, null)
394   .add(Symbol.MINUS, null)
395   .add(Symbol.ASTERISK, null)
396@@ -644,7 +647,7 @@ table[Tree.FOLLOWS_FIXED_CELL_REF] = ObjectBuilder
397   .add(Symbol.WHITE_SPACE, null)
398   .add(Symbol.END, null)
399   .build();
400-table[Tree.FOLLOWS_CELL_RANGE_REF] = ObjectBuilder
401+table[Tree.CELL_RANGE_REF] = ObjectBuilder
402   .add(Symbol.PLUS, null)
403   .add(Symbol.MINUS, null)
404   .add(Symbol.ASTERISK, null)
405@@ -661,7 +664,7 @@ table[Tree.FOLLOWS_CELL_RANGE_REF] = ObjectBuilder
406   .add(Symbol.WHITE_SPACE, null)
407   .add(Symbol.END, null)
408   .build();
409-table[Tree.FOLLOWS_FIXED_CELL_RANGE_REF] = ObjectBuilder
410+table[Tree.FIXED_CELL_RANGE_REF] = ObjectBuilder
411   .add(Symbol.PLUS, null)
412   .add(Symbol.MINUS, null)
413   .add(Symbol.ASTERISK, null)
414@@ -678,8 +681,8 @@ table[Tree.FOLLOWS_FIXED_CELL_RANGE_REF] = ObjectBuilder
415   .add(Symbol.WHITE_SPACE, null)
416   .add(Symbol.END, null)
417   .build();
418-table[Tree.FOLLOWS_OPEN_ARRAY] = ObjectBuilder
419-  .add(Symbol.NUMBER, Tree.FOLLOWS_NUMBER)
420+table[Tree.OPEN_ARRAY] = ObjectBuilder
421+  .add(Symbol.NUMBER, Tree.NUMBER)
422   .add(Symbol.STRING, null)
423   .add(Symbol.BOOLEAN, null)
424   .add(Symbol.FORMULA, null)
425@@ -694,7 +697,7 @@ table[Tree.FOLLOWS_OPEN_ARRAY] = ObjectBuilder
426   .add(Symbol.CLOSE_ARRAY, null)
427   .add(Symbol.WHITE_SPACE, null)
428   .build();
429-table[Tree.FOLLOWS_CLOSE_ARRAY] = ObjectBuilder
430+table[Tree.CLOSE_ARRAY] = ObjectBuilder
431   .add(Symbol.PLUS, null)
432   .add(Symbol.MINUS, null)
433   .add(Symbol.ASTERISK, null)
434@@ -707,6 +710,7 @@ table[Tree.FOLLOWS_CLOSE_ARRAY] = ObjectBuilder
435   .add(Symbol.WHITE_SPACE, null)
436   .add(Symbol.END, null)
437   .build();
438+table[Tree.INVERT_NEXT] = null;
439 
440 
441 table[Tree.TERMINATE] = undefined; // Terminate the end.
442\ No newline at end of file