]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.spreadsheet.common/src/org/simantics/spreadsheet/common/expression/parser/Parser.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.spreadsheet.common / src / org / simantics / spreadsheet / common / expression / parser / Parser.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management
3  * in Industry THTH ry.
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 /* This file was generated by SableCC (http://www.sablecc.org/). */
13
14 package org.simantics.spreadsheet.common.expression.parser;
15
16 import org.simantics.spreadsheet.common.expression.lexer.*;
17 import org.simantics.spreadsheet.common.expression.node.*;
18 import org.simantics.spreadsheet.common.expression.analysis.*;
19 import java.util.*;
20
21 import java.io.DataInputStream;
22 import java.io.BufferedInputStream;
23 import java.io.IOException;
24
25 @SuppressWarnings("nls")
26 public class Parser
27 {
28     public final Analysis ignoredTokens = new AnalysisAdapter();
29
30     protected ArrayList nodeList;
31
32     private final Lexer lexer;
33     private final ListIterator stack = new LinkedList().listIterator();
34     private int last_pos;
35     private int last_line;
36     private Token last_token;
37     private final TokenIndex converter = new TokenIndex();
38     private final int[] action = new int[2];
39
40     private final static int SHIFT = 0;
41     private final static int REDUCE = 1;
42     private final static int ACCEPT = 2;
43     private final static int ERROR = 3;
44
45     public Parser(@SuppressWarnings("hiding") Lexer lexer)
46     {
47         this.lexer = lexer;
48     }
49
50     protected void filter() throws ParserException, LexerException, IOException
51     {
52         // Empty body
53     }
54
55     private void push(int numstate, ArrayList listNode, boolean hidden) throws ParserException, LexerException, IOException
56     {
57         this.nodeList = listNode;
58
59         if(!hidden)
60         {
61             filter();
62         }
63
64         if(!this.stack.hasNext())
65         {
66             this.stack.add(new State(numstate, this.nodeList));
67             return;
68         }
69
70         State s = (State) this.stack.next();
71         s.state = numstate;
72         s.nodes = this.nodeList;
73     }
74
75     private int goTo(int index)
76     {
77         int state = state();
78         int low = 1;
79         int high = gotoTable[index].length - 1;
80         int value = gotoTable[index][0][1];
81
82         while(low <= high)
83         {
84             int middle = (low + high) / 2;
85
86             if(state < gotoTable[index][middle][0])
87             {
88                 high = middle - 1;
89             }
90             else if(state > gotoTable[index][middle][0])
91             {
92                 low = middle + 1;
93             }
94             else
95             {
96                 value = gotoTable[index][middle][1];
97                 break;
98             }
99         }
100
101         return value;
102     }
103
104     private int state()
105     {
106         State s = (State) this.stack.previous();
107         this.stack.next();
108         return s.state;
109     }
110
111     private ArrayList pop()
112     {
113         return ((State) this.stack.previous()).nodes;
114     }
115
116     private int index(Switchable token)
117     {
118         this.converter.index = -1;
119         token.apply(this.converter);
120         return this.converter.index;
121     }
122
123     @SuppressWarnings("unchecked")
124     public Start parse() throws ParserException, LexerException, IOException
125     {
126         push(0, null, true);
127         List<Node> ign = null;
128         while(true)
129         {
130             while(index(this.lexer.peek()) == -1)
131             {
132                 if(ign == null)
133                 {
134                     ign = new LinkedList<Node>();
135                 }
136
137                 ign.add(this.lexer.next());
138             }
139
140             if(ign != null)
141             {
142                 this.ignoredTokens.setIn(this.lexer.peek(), ign);
143                 ign = null;
144             }
145
146             this.last_pos = this.lexer.peek().getPos();
147             this.last_line = this.lexer.peek().getLine();
148             this.last_token = this.lexer.peek();
149
150             int index = index(this.lexer.peek());
151             this.action[0] = Parser.actionTable[state()][0][1];
152             this.action[1] = Parser.actionTable[state()][0][2];
153
154             int low = 1;
155             int high = Parser.actionTable[state()].length - 1;
156
157             while(low <= high)
158             {
159                 int middle = (low + high) / 2;
160
161                 if(index < Parser.actionTable[state()][middle][0])
162                 {
163                     high = middle - 1;
164                 }
165                 else if(index > Parser.actionTable[state()][middle][0])
166                 {
167                     low = middle + 1;
168                 }
169                 else
170                 {
171                     this.action[0] = Parser.actionTable[state()][middle][1];
172                     this.action[1] = Parser.actionTable[state()][middle][2];
173                     break;
174                 }
175             }
176
177             switch(this.action[0])
178             {
179                 case SHIFT:
180                     {
181                         ArrayList list = new ArrayList();
182                         list.add(this.lexer.next());
183                         push(this.action[1], list, false);
184                     }
185                     break;
186                 case REDUCE:
187                     switch(this.action[1])
188                     {
189                     case 0: /* reduce AMultExpression */
190                     {
191                         ArrayList list = new0();
192                         push(goTo(0), list, false);
193                     }
194                     break;
195                     case 1: /* reduce APlusExpression */
196                     {
197                         ArrayList list = new1();
198                         push(goTo(0), list, false);
199                     }
200                     break;
201                     case 2: /* reduce AMinusExpression */
202                     {
203                         ArrayList list = new2();
204                         push(goTo(0), list, false);
205                     }
206                     break;
207                     case 3: /* reduce AUnaryMultiplicative */
208                     {
209                         ArrayList list = new3();
210                         push(goTo(1), list, false);
211                     }
212                     break;
213                     case 4: /* reduce AMultMultiplicative */
214                     {
215                         ArrayList list = new4();
216                         push(goTo(1), list, false);
217                     }
218                     break;
219                     case 5: /* reduce ADivMultiplicative */
220                     {
221                         ArrayList list = new5();
222                         push(goTo(1), list, false);
223                     }
224                     break;
225                     case 6: /* reduce APrimaryUnary */
226                     {
227                         ArrayList list = new6();
228                         push(goTo(2), list, false);
229                     }
230                     break;
231                     case 7: /* reduce AUnaryplusUnary */
232                     {
233                         ArrayList list = new7();
234                         push(goTo(2), list, false);
235                     }
236                     break;
237                     case 8: /* reduce AUnaryminusUnary */
238                     {
239                         ArrayList list = new8();
240                         push(goTo(2), list, false);
241                     }
242                     break;
243                     case 9: /* reduce ASingleArgList */
244                     {
245                         ArrayList list = new9();
246                         push(goTo(3), list, false);
247                     }
248                     break;
249                     case 10: /* reduce ASequenceArgList */
250                     {
251                         ArrayList list = new10();
252                         push(goTo(3), list, false);
253                     }
254                     break;
255                     case 11: /* reduce AValuePrimary */
256                     {
257                         ArrayList list = new11();
258                         push(goTo(4), list, false);
259                     }
260                     break;
261                     case 12: /* reduce AAfunctionprimary1Primary */
262                     {
263                         ArrayList list = new12();
264                         push(goTo(4), list, false);
265                     }
266                     break;
267                     case 13: /* reduce AAfunctionprimary2Primary */
268                     {
269                         ArrayList list = new13();
270                         push(goTo(4), list, false);
271                     }
272                     break;
273                     case 14: /* reduce ASingleRange */
274                     {
275                         ArrayList list = new14();
276                         push(goTo(5), list, false);
277                     }
278                     break;
279                     case 15: /* reduce AMultiRange */
280                     {
281                         ArrayList list = new15();
282                         push(goTo(5), list, false);
283                     }
284                     break;
285                     case 16: /* reduce AStringValue */
286                     {
287                         ArrayList list = new16();
288                         push(goTo(6), list, false);
289                     }
290                     break;
291                     case 17: /* reduce AConstantValue */
292                     {
293                         ArrayList list = new17();
294                         push(goTo(6), list, false);
295                     }
296                     break;
297                     case 18: /* reduce ARangeValue */
298                     {
299                         ArrayList list = new18();
300                         push(goTo(6), list, false);
301                     }
302                     break;
303                     case 19: /* reduce AAddressValue */
304                     {
305                         ArrayList list = new19();
306                         push(goTo(6), list, false);
307                     }
308                     break;
309                     case 20: /* reduce AExprValue */
310                     {
311                         ArrayList list = new20();
312                         push(goTo(6), list, false);
313                     }
314                     break;
315                     }
316                     break;
317                 case ACCEPT:
318                     {
319                         EOF node2 = (EOF) this.lexer.next();
320                         PExpression node1 = (PExpression) pop().get(0);
321                         Start node = new Start(node1, node2);
322                         return node;
323                     }
324                 case ERROR:
325                     throw new ParserException(this.last_token,
326                         "[" + this.last_line + "," + this.last_pos + "] " +
327                         Parser.errorMessages[Parser.errors[this.action[1]]]);
328             }
329         }
330     }
331
332
333
334     @SuppressWarnings("unchecked")
335     ArrayList new0() /* reduce AMultExpression */
336     {
337         @SuppressWarnings("hiding") ArrayList nodeList = new ArrayList();
338
339         @SuppressWarnings("unused") ArrayList nodeArrayList1 = pop();
340         PExpression pexpressionNode1;
341         {
342             // Block
343         PMultiplicative pmultiplicativeNode2;
344         pmultiplicativeNode2 = (PMultiplicative)nodeArrayList1.get(0);
345
346         pexpressionNode1 = new AMultExpression(pmultiplicativeNode2);
347         }
348         nodeList.add(pexpressionNode1);
349         return nodeList;
350     }
351
352
353
354     @SuppressWarnings("unchecked")
355     ArrayList new1() /* reduce APlusExpression */
356     {
357         @SuppressWarnings("hiding") ArrayList nodeList = new ArrayList();
358
359         @SuppressWarnings("unused") ArrayList nodeArrayList3 = pop();
360         @SuppressWarnings("unused") ArrayList nodeArrayList2 = pop();
361         @SuppressWarnings("unused") ArrayList nodeArrayList1 = pop();
362         PExpression pexpressionNode1;
363         {
364             // Block
365         PExpression pexpressionNode2;
366         TPlus tplusNode3;
367         PMultiplicative pmultiplicativeNode4;
368         pexpressionNode2 = (PExpression)nodeArrayList1.get(0);
369         tplusNode3 = (TPlus)nodeArrayList2.get(0);
370         pmultiplicativeNode4 = (PMultiplicative)nodeArrayList3.get(0);
371
372         pexpressionNode1 = new APlusExpression(pexpressionNode2, tplusNode3, pmultiplicativeNode4);
373         }
374         nodeList.add(pexpressionNode1);
375         return nodeList;
376     }
377
378
379
380     @SuppressWarnings("unchecked")
381     ArrayList new2() /* reduce AMinusExpression */
382     {
383         @SuppressWarnings("hiding") ArrayList nodeList = new ArrayList();
384
385         @SuppressWarnings("unused") ArrayList nodeArrayList3 = pop();
386         @SuppressWarnings("unused") ArrayList nodeArrayList2 = pop();
387         @SuppressWarnings("unused") ArrayList nodeArrayList1 = pop();
388         PExpression pexpressionNode1;
389         {
390             // Block
391         PExpression pexpressionNode2;
392         TMinus tminusNode3;
393         PMultiplicative pmultiplicativeNode4;
394         pexpressionNode2 = (PExpression)nodeArrayList1.get(0);
395         tminusNode3 = (TMinus)nodeArrayList2.get(0);
396         pmultiplicativeNode4 = (PMultiplicative)nodeArrayList3.get(0);
397
398         pexpressionNode1 = new AMinusExpression(pexpressionNode2, tminusNode3, pmultiplicativeNode4);
399         }
400         nodeList.add(pexpressionNode1);
401         return nodeList;
402     }
403
404
405
406     @SuppressWarnings("unchecked")
407     ArrayList new3() /* reduce AUnaryMultiplicative */
408     {
409         @SuppressWarnings("hiding") ArrayList nodeList = new ArrayList();
410
411         @SuppressWarnings("unused") ArrayList nodeArrayList1 = pop();
412         PMultiplicative pmultiplicativeNode1;
413         {
414             // Block
415         PUnary punaryNode2;
416         punaryNode2 = (PUnary)nodeArrayList1.get(0);
417
418         pmultiplicativeNode1 = new AUnaryMultiplicative(punaryNode2);
419         }
420         nodeList.add(pmultiplicativeNode1);
421         return nodeList;
422     }
423
424
425
426     @SuppressWarnings("unchecked")
427     ArrayList new4() /* reduce AMultMultiplicative */
428     {
429         @SuppressWarnings("hiding") ArrayList nodeList = new ArrayList();
430
431         @SuppressWarnings("unused") ArrayList nodeArrayList3 = pop();
432         @SuppressWarnings("unused") ArrayList nodeArrayList2 = pop();
433         @SuppressWarnings("unused") ArrayList nodeArrayList1 = pop();
434         PMultiplicative pmultiplicativeNode1;
435         {
436             // Block
437         PMultiplicative pmultiplicativeNode2;
438         TMult tmultNode3;
439         PUnary punaryNode4;
440         pmultiplicativeNode2 = (PMultiplicative)nodeArrayList1.get(0);
441         tmultNode3 = (TMult)nodeArrayList2.get(0);
442         punaryNode4 = (PUnary)nodeArrayList3.get(0);
443
444         pmultiplicativeNode1 = new AMultMultiplicative(pmultiplicativeNode2, tmultNode3, punaryNode4);
445         }
446         nodeList.add(pmultiplicativeNode1);
447         return nodeList;
448     }
449
450
451
452     @SuppressWarnings("unchecked")
453     ArrayList new5() /* reduce ADivMultiplicative */
454     {
455         @SuppressWarnings("hiding") ArrayList nodeList = new ArrayList();
456
457         @SuppressWarnings("unused") ArrayList nodeArrayList3 = pop();
458         @SuppressWarnings("unused") ArrayList nodeArrayList2 = pop();
459         @SuppressWarnings("unused") ArrayList nodeArrayList1 = pop();
460         PMultiplicative pmultiplicativeNode1;
461         {
462             // Block
463         PMultiplicative pmultiplicativeNode2;
464         TDiv tdivNode3;
465         PUnary punaryNode4;
466         pmultiplicativeNode2 = (PMultiplicative)nodeArrayList1.get(0);
467         tdivNode3 = (TDiv)nodeArrayList2.get(0);
468         punaryNode4 = (PUnary)nodeArrayList3.get(0);
469
470         pmultiplicativeNode1 = new ADivMultiplicative(pmultiplicativeNode2, tdivNode3, punaryNode4);
471         }
472         nodeList.add(pmultiplicativeNode1);
473         return nodeList;
474     }
475
476
477
478     @SuppressWarnings("unchecked")
479     ArrayList new6() /* reduce APrimaryUnary */
480     {
481         @SuppressWarnings("hiding") ArrayList nodeList = new ArrayList();
482
483         @SuppressWarnings("unused") ArrayList nodeArrayList1 = pop();
484         PUnary punaryNode1;
485         {
486             // Block
487         PPrimary pprimaryNode2;
488         pprimaryNode2 = (PPrimary)nodeArrayList1.get(0);
489
490         punaryNode1 = new APrimaryUnary(pprimaryNode2);
491         }
492         nodeList.add(punaryNode1);
493         return nodeList;
494     }
495
496
497
498     @SuppressWarnings("unchecked")
499     ArrayList new7() /* reduce AUnaryplusUnary */
500     {
501         @SuppressWarnings("hiding") ArrayList nodeList = new ArrayList();
502
503         @SuppressWarnings("unused") ArrayList nodeArrayList2 = pop();
504         @SuppressWarnings("unused") ArrayList nodeArrayList1 = pop();
505         PUnary punaryNode1;
506         {
507             // Block
508         TPlus tplusNode2;
509         PUnary punaryNode3;
510         tplusNode2 = (TPlus)nodeArrayList1.get(0);
511         punaryNode3 = (PUnary)nodeArrayList2.get(0);
512
513         punaryNode1 = new AUnaryplusUnary(tplusNode2, punaryNode3);
514         }
515         nodeList.add(punaryNode1);
516         return nodeList;
517     }
518
519
520
521     @SuppressWarnings("unchecked")
522     ArrayList new8() /* reduce AUnaryminusUnary */
523     {
524         @SuppressWarnings("hiding") ArrayList nodeList = new ArrayList();
525
526         @SuppressWarnings("unused") ArrayList nodeArrayList2 = pop();
527         @SuppressWarnings("unused") ArrayList nodeArrayList1 = pop();
528         PUnary punaryNode1;
529         {
530             // Block
531         TMinus tminusNode2;
532         PUnary punaryNode3;
533         tminusNode2 = (TMinus)nodeArrayList1.get(0);
534         punaryNode3 = (PUnary)nodeArrayList2.get(0);
535
536         punaryNode1 = new AUnaryminusUnary(tminusNode2, punaryNode3);
537         }
538         nodeList.add(punaryNode1);
539         return nodeList;
540     }
541
542
543
544     @SuppressWarnings("unchecked")
545     ArrayList new9() /* reduce ASingleArgList */
546     {
547         @SuppressWarnings("hiding") ArrayList nodeList = new ArrayList();
548
549         @SuppressWarnings("unused") ArrayList nodeArrayList1 = pop();
550         PArgList parglistNode1;
551         {
552             // Block
553         PExpression pexpressionNode2;
554         pexpressionNode2 = (PExpression)nodeArrayList1.get(0);
555
556         parglistNode1 = new ASingleArgList(pexpressionNode2);
557         }
558         nodeList.add(parglistNode1);
559         return nodeList;
560     }
561
562
563
564     @SuppressWarnings("unchecked")
565     ArrayList new10() /* reduce ASequenceArgList */
566     {
567         @SuppressWarnings("hiding") ArrayList nodeList = new ArrayList();
568
569         @SuppressWarnings("unused") ArrayList nodeArrayList3 = pop();
570         @SuppressWarnings("unused") ArrayList nodeArrayList2 = pop();
571         @SuppressWarnings("unused") ArrayList nodeArrayList1 = pop();
572         PArgList parglistNode1;
573         {
574             // Block
575         PArgList parglistNode2;
576         TComma tcommaNode3;
577         PExpression pexpressionNode4;
578         parglistNode2 = (PArgList)nodeArrayList1.get(0);
579         tcommaNode3 = (TComma)nodeArrayList2.get(0);
580         pexpressionNode4 = (PExpression)nodeArrayList3.get(0);
581
582         parglistNode1 = new ASequenceArgList(parglistNode2, tcommaNode3, pexpressionNode4);
583         }
584         nodeList.add(parglistNode1);
585         return nodeList;
586     }
587
588
589
590     @SuppressWarnings("unchecked")
591     ArrayList new11() /* reduce AValuePrimary */
592     {
593         @SuppressWarnings("hiding") ArrayList nodeList = new ArrayList();
594
595         @SuppressWarnings("unused") ArrayList nodeArrayList1 = pop();
596         PPrimary pprimaryNode1;
597         {
598             // Block
599         PValue pvalueNode2;
600         pvalueNode2 = (PValue)nodeArrayList1.get(0);
601
602         pprimaryNode1 = new AValuePrimary(pvalueNode2);
603         }
604         nodeList.add(pprimaryNode1);
605         return nodeList;
606     }
607
608
609
610     @SuppressWarnings("unchecked")
611     ArrayList new12() /* reduce AAfunctionprimary1Primary */
612     {
613         @SuppressWarnings("hiding") ArrayList nodeList = new ArrayList();
614
615         @SuppressWarnings("unused") ArrayList nodeArrayList2 = pop();
616         @SuppressWarnings("unused") ArrayList nodeArrayList1 = pop();
617         PPrimary pprimaryNode1;
618         {
619             // Block
620         TFunc tfuncNode2;
621         @SuppressWarnings("unused") Object nullNode3 = null;
622         TRPar trparNode4;
623         tfuncNode2 = (TFunc)nodeArrayList1.get(0);
624         trparNode4 = (TRPar)nodeArrayList2.get(0);
625
626         pprimaryNode1 = new AFunctionPrimary(tfuncNode2, null, trparNode4);
627         }
628         nodeList.add(pprimaryNode1);
629         return nodeList;
630     }
631
632
633
634     @SuppressWarnings("unchecked")
635     ArrayList new13() /* reduce AAfunctionprimary2Primary */
636     {
637         @SuppressWarnings("hiding") ArrayList nodeList = new ArrayList();
638
639         @SuppressWarnings("unused") ArrayList nodeArrayList3 = pop();
640         @SuppressWarnings("unused") ArrayList nodeArrayList2 = pop();
641         @SuppressWarnings("unused") ArrayList nodeArrayList1 = pop();
642         PPrimary pprimaryNode1;
643         {
644             // Block
645         TFunc tfuncNode2;
646         PArgList parglistNode3;
647         TRPar trparNode4;
648         tfuncNode2 = (TFunc)nodeArrayList1.get(0);
649         parglistNode3 = (PArgList)nodeArrayList2.get(0);
650         trparNode4 = (TRPar)nodeArrayList3.get(0);
651
652         pprimaryNode1 = new AFunctionPrimary(tfuncNode2, parglistNode3, trparNode4);
653         }
654         nodeList.add(pprimaryNode1);
655         return nodeList;
656     }
657
658
659
660     @SuppressWarnings("unchecked")
661     ArrayList new14() /* reduce ASingleRange */
662     {
663         @SuppressWarnings("hiding") ArrayList nodeList = new ArrayList();
664
665         @SuppressWarnings("unused") ArrayList nodeArrayList1 = pop();
666         PRange prangeNode1;
667         {
668             // Block
669         TCell tcellNode2;
670         tcellNode2 = (TCell)nodeArrayList1.get(0);
671
672         prangeNode1 = new ASingleRange(tcellNode2);
673         }
674         nodeList.add(prangeNode1);
675         return nodeList;
676     }
677
678
679
680     @SuppressWarnings("unchecked")
681     ArrayList new15() /* reduce AMultiRange */
682     {
683         @SuppressWarnings("hiding") ArrayList nodeList = new ArrayList();
684
685         @SuppressWarnings("unused") ArrayList nodeArrayList3 = pop();
686         @SuppressWarnings("unused") ArrayList nodeArrayList2 = pop();
687         @SuppressWarnings("unused") ArrayList nodeArrayList1 = pop();
688         PRange prangeNode1;
689         {
690             // Block
691         TCell tcellNode2;
692         TColon tcolonNode3;
693         TCell tcellNode4;
694         tcellNode2 = (TCell)nodeArrayList1.get(0);
695         tcolonNode3 = (TColon)nodeArrayList2.get(0);
696         tcellNode4 = (TCell)nodeArrayList3.get(0);
697
698         prangeNode1 = new AMultiRange(tcellNode2, tcolonNode3, tcellNode4);
699         }
700         nodeList.add(prangeNode1);
701         return nodeList;
702     }
703
704
705
706     @SuppressWarnings("unchecked")
707     ArrayList new16() /* reduce AStringValue */
708     {
709         @SuppressWarnings("hiding") ArrayList nodeList = new ArrayList();
710
711         @SuppressWarnings("unused") ArrayList nodeArrayList1 = pop();
712         PValue pvalueNode1;
713         {
714             // Block
715         TString tstringNode2;
716         tstringNode2 = (TString)nodeArrayList1.get(0);
717
718         pvalueNode1 = new AStringValue(tstringNode2);
719         }
720         nodeList.add(pvalueNode1);
721         return nodeList;
722     }
723
724
725
726     @SuppressWarnings("unchecked")
727     ArrayList new17() /* reduce AConstantValue */
728     {
729         @SuppressWarnings("hiding") ArrayList nodeList = new ArrayList();
730
731         @SuppressWarnings("unused") ArrayList nodeArrayList1 = pop();
732         PValue pvalueNode1;
733         {
734             // Block
735         TNumber tnumberNode2;
736         tnumberNode2 = (TNumber)nodeArrayList1.get(0);
737
738         pvalueNode1 = new AConstantValue(tnumberNode2);
739         }
740         nodeList.add(pvalueNode1);
741         return nodeList;
742     }
743
744
745
746     @SuppressWarnings("unchecked")
747     ArrayList new18() /* reduce ARangeValue */
748     {
749         @SuppressWarnings("hiding") ArrayList nodeList = new ArrayList();
750
751         @SuppressWarnings("unused") ArrayList nodeArrayList1 = pop();
752         PValue pvalueNode1;
753         {
754             // Block
755         PRange prangeNode2;
756         prangeNode2 = (PRange)nodeArrayList1.get(0);
757
758         pvalueNode1 = new ARangeValue(prangeNode2);
759         }
760         nodeList.add(pvalueNode1);
761         return nodeList;
762     }
763
764
765
766     @SuppressWarnings("unchecked")
767     ArrayList new19() /* reduce AAddressValue */
768     {
769         @SuppressWarnings("hiding") ArrayList nodeList = new ArrayList();
770
771         @SuppressWarnings("unused") ArrayList nodeArrayList2 = pop();
772         @SuppressWarnings("unused") ArrayList nodeArrayList1 = pop();
773         PValue pvalueNode1;
774         {
775             // Block
776         TAmpersand tampersandNode2;
777         PRange prangeNode3;
778         tampersandNode2 = (TAmpersand)nodeArrayList1.get(0);
779         prangeNode3 = (PRange)nodeArrayList2.get(0);
780
781         pvalueNode1 = new AAddressValue(tampersandNode2, prangeNode3);
782         }
783         nodeList.add(pvalueNode1);
784         return nodeList;
785     }
786
787
788
789     @SuppressWarnings("unchecked")
790     ArrayList new20() /* reduce AExprValue */
791     {
792         @SuppressWarnings("hiding") ArrayList nodeList = new ArrayList();
793
794         @SuppressWarnings("unused") ArrayList nodeArrayList3 = pop();
795         @SuppressWarnings("unused") ArrayList nodeArrayList2 = pop();
796         @SuppressWarnings("unused") ArrayList nodeArrayList1 = pop();
797         PValue pvalueNode1;
798         {
799             // Block
800         TLPar tlparNode2;
801         PExpression pexpressionNode3;
802         TRPar trparNode4;
803         tlparNode2 = (TLPar)nodeArrayList1.get(0);
804         pexpressionNode3 = (PExpression)nodeArrayList2.get(0);
805         trparNode4 = (TRPar)nodeArrayList3.get(0);
806
807         pvalueNode1 = new AExprValue(tlparNode2, pexpressionNode3, trparNode4);
808         }
809         nodeList.add(pvalueNode1);
810         return nodeList;
811     }
812
813
814
815     private static int[][][] actionTable;
816 /*      {
817                         {{-1, ERROR, 0}, {3, SHIFT, 1}, {4, SHIFT, 2}, {7, SHIFT, 3}, {10, SHIFT, 4}, {12, SHIFT, 5}, {13, SHIFT, 6}, {14, SHIFT, 7}, {15, SHIFT, 8}, },
818                         {{-1, ERROR, 1}, {3, SHIFT, 1}, {4, SHIFT, 2}, {7, SHIFT, 3}, {10, SHIFT, 4}, {12, SHIFT, 5}, {13, SHIFT, 6}, {14, SHIFT, 7}, {15, SHIFT, 8}, },
819                         {{-1, ERROR, 2}, {3, SHIFT, 1}, {4, SHIFT, 2}, {7, SHIFT, 3}, {10, SHIFT, 4}, {12, SHIFT, 5}, {13, SHIFT, 6}, {14, SHIFT, 7}, {15, SHIFT, 8}, },
820                         {{-1, ERROR, 3}, {13, SHIFT, 6}, },
821                         {{-1, ERROR, 4}, {3, SHIFT, 1}, {4, SHIFT, 2}, {7, SHIFT, 3}, {10, SHIFT, 4}, {12, SHIFT, 5}, {13, SHIFT, 6}, {14, SHIFT, 7}, {15, SHIFT, 8}, },
822                         {{-1, ERROR, 5}, {3, SHIFT, 1}, {4, SHIFT, 2}, {7, SHIFT, 3}, {10, SHIFT, 4}, {11, SHIFT, 19}, {12, SHIFT, 5}, {13, SHIFT, 6}, {14, SHIFT, 7}, {15, SHIFT, 8}, },
823                         {{-1, REDUCE, 14}, {9, SHIFT, 22}, },
824                         {{-1, REDUCE, 17}, },
825                         {{-1, REDUCE, 16}, },
826                         {{-1, ERROR, 9}, {3, SHIFT, 23}, {4, SHIFT, 24}, {17, ACCEPT, -1}, },
827                         {{-1, REDUCE, 0}, {5, SHIFT, 25}, {6, SHIFT, 26}, },
828                         {{-1, REDUCE, 3}, },
829                         {{-1, REDUCE, 6}, },
830                         {{-1, REDUCE, 18}, },
831                         {{-1, REDUCE, 11}, },
832                         {{-1, REDUCE, 7}, },
833                         {{-1, REDUCE, 8}, },
834                         {{-1, REDUCE, 19}, },
835                         {{-1, ERROR, 18}, {3, SHIFT, 23}, {4, SHIFT, 24}, {11, SHIFT, 27}, },
836                         {{-1, REDUCE, 12}, },
837                         {{-1, REDUCE, 9}, {3, SHIFT, 23}, {4, SHIFT, 24}, },
838                         {{-1, ERROR, 21}, {8, SHIFT, 28}, {11, SHIFT, 29}, },
839                         {{-1, ERROR, 22}, {13, SHIFT, 30}, },
840                         {{-1, ERROR, 23}, {3, SHIFT, 1}, {4, SHIFT, 2}, {7, SHIFT, 3}, {10, SHIFT, 4}, {12, SHIFT, 5}, {13, SHIFT, 6}, {14, SHIFT, 7}, {15, SHIFT, 8}, },
841                         {{-1, ERROR, 24}, {3, SHIFT, 1}, {4, SHIFT, 2}, {7, SHIFT, 3}, {10, SHIFT, 4}, {12, SHIFT, 5}, {13, SHIFT, 6}, {14, SHIFT, 7}, {15, SHIFT, 8}, },
842                         {{-1, ERROR, 25}, {3, SHIFT, 1}, {4, SHIFT, 2}, {7, SHIFT, 3}, {10, SHIFT, 4}, {12, SHIFT, 5}, {13, SHIFT, 6}, {14, SHIFT, 7}, {15, SHIFT, 8}, },
843                         {{-1, ERROR, 26}, {3, SHIFT, 1}, {4, SHIFT, 2}, {7, SHIFT, 3}, {10, SHIFT, 4}, {12, SHIFT, 5}, {13, SHIFT, 6}, {14, SHIFT, 7}, {15, SHIFT, 8}, },
844                         {{-1, REDUCE, 20}, },
845                         {{-1, ERROR, 28}, {3, SHIFT, 1}, {4, SHIFT, 2}, {7, SHIFT, 3}, {10, SHIFT, 4}, {12, SHIFT, 5}, {13, SHIFT, 6}, {14, SHIFT, 7}, {15, SHIFT, 8}, },
846                         {{-1, REDUCE, 13}, },
847                         {{-1, REDUCE, 15}, },
848                         {{-1, REDUCE, 1}, {5, SHIFT, 25}, {6, SHIFT, 26}, },
849                         {{-1, REDUCE, 2}, {5, SHIFT, 25}, {6, SHIFT, 26}, },
850                         {{-1, REDUCE, 4}, },
851                         {{-1, REDUCE, 5}, },
852                         {{-1, REDUCE, 10}, {3, SHIFT, 23}, {4, SHIFT, 24}, },
853         };*/
854     private static int[][][] gotoTable;
855 /*      {
856                         {{-1, 9}, {4, 18}, {5, 20}, {28, 35}, },
857                         {{-1, 10}, {23, 31}, {24, 32}, },
858                         {{-1, 11}, {1, 15}, {2, 16}, {25, 33}, {26, 34}, },
859                         {{-1, 21}, },
860                         {{-1, 12}, },
861                         {{-1, 13}, {3, 17}, },
862                         {{-1, 14}, },
863         };*/
864     private static String[] errorMessages;
865 /*      {
866                         "expecting: '+', '-', '&', '(', func, cell, number, string",
867                         "expecting: cell",
868                         "expecting: '+', '-', '&', '(', ')', func, cell, number, string",
869                         "expecting: '+', '-', '*', '/', ',', ':', ')', EOF",
870                         "expecting: '+', '-', '*', '/', ',', ')', EOF",
871                         "expecting: '+', '-', EOF",
872                         "expecting: '+', '-', ')'",
873                         "expecting: '+', '-', ',', ')'",
874                         "expecting: ',', ')'",
875         };*/
876     private static int[] errors;
877 /*      {
878                         0, 0, 0, 1, 0, 2, 3, 4, 4, 5, 4, 4, 4, 4, 4, 4, 4, 4, 6, 4, 7, 8, 1, 0, 0, 0, 0, 4, 0, 4, 4, 4, 4, 4, 4, 7, 
879         };*/
880
881     static 
882     {
883         try
884         {
885             DataInputStream s = new DataInputStream(
886                 new BufferedInputStream(
887                 Parser.class.getResourceAsStream("parser.dat")));
888
889             // read actionTable
890             int length = s.readInt();
891             Parser.actionTable = new int[length][][];
892             for(int i = 0; i < Parser.actionTable.length; i++)
893             {
894                 length = s.readInt();
895                 Parser.actionTable[i] = new int[length][3];
896                 for(int j = 0; j < Parser.actionTable[i].length; j++)
897                 {
898                 for(int k = 0; k < 3; k++)
899                 {
900                     Parser.actionTable[i][j][k] = s.readInt();
901                 }
902                 }
903             }
904
905             // read gotoTable
906             length = s.readInt();
907             gotoTable = new int[length][][];
908             for(int i = 0; i < gotoTable.length; i++)
909             {
910                 length = s.readInt();
911                 gotoTable[i] = new int[length][2];
912                 for(int j = 0; j < gotoTable[i].length; j++)
913                 {
914                 for(int k = 0; k < 2; k++)
915                 {
916                     gotoTable[i][j][k] = s.readInt();
917                 }
918                 }
919             }
920
921             // read errorMessages
922             length = s.readInt();
923             errorMessages = new String[length];
924             for(int i = 0; i < errorMessages.length; i++)
925             {
926                 length = s.readInt();
927                 StringBuffer buffer = new StringBuffer();
928
929                 for(int j = 0; j < length; j++)
930                 {
931                 buffer.append(s.readChar());
932                 }
933                 errorMessages[i] = buffer.toString();
934             }
935
936             // read errors
937             length = s.readInt();
938             errors = new int[length];
939             for(int i = 0; i < errors.length; i++)
940             {
941                 errors[i] = s.readInt();
942             }
943
944             s.close();
945         }
946         catch(Exception e)
947         {
948             throw new RuntimeException("The file \"parser.dat\" is either missing or corrupted.");
949         }
950     }
951 }