KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > genimen > djeneric > repository > oql > core > DjOqlParserEngine


1 /* Generated By:JJTree&JavaCC: Do not edit this line. DjOqlParserEngine.java */
2 package com.genimen.djeneric.repository.oql.core;
3
4 import java.io.ByteArrayInputStream JavaDoc;
5 import java.io.UnsupportedEncodingException JavaDoc;
6
7 import com.genimen.djeneric.repository.oql.core.nodes.AndOrNode;
8 import com.genimen.djeneric.repository.oql.core.nodes.ArgumentsNode;
9 import com.genimen.djeneric.repository.oql.core.nodes.BoolNode;
10 import com.genimen.djeneric.repository.oql.core.nodes.BracketNode;
11 import com.genimen.djeneric.repository.oql.core.nodes.CalculatedExpressionNode;
12 import com.genimen.djeneric.repository.oql.core.nodes.CharNode;
13 import com.genimen.djeneric.repository.oql.core.nodes.ExpressionNode;
14 import com.genimen.djeneric.repository.oql.core.nodes.FloatNode;
15 import com.genimen.djeneric.repository.oql.core.nodes.IntegerNode;
16 import com.genimen.djeneric.repository.oql.core.nodes.NullNode;
17 import com.genimen.djeneric.repository.oql.core.nodes.OperatorNode;
18 import com.genimen.djeneric.repository.oql.core.nodes.ParameterNode;
19 import com.genimen.djeneric.repository.oql.core.nodes.PropertyNode;
20 import com.genimen.djeneric.repository.oql.core.nodes.PropertyOrFunctionNode;
21 import com.genimen.djeneric.repository.oql.core.nodes.StringNode;
22 import com.genimen.djeneric.repository.oql.core.nodes.SubExpressionNode;
23 import com.genimen.djeneric.repository.oql.core.util.TreeNormalizer;
24
25 public class DjOqlParserEngine/*@bgen(jjtree)*/implements DjOqlParserEngineTreeConstants, DjOqlParserEngineConstants
26 {/*@bgen(jjtree)*/
27   protected JJTDjOqlParserEngineState jjtree = new JJTDjOqlParserEngineState();
28
29   public DjOqlParserEngine()
30   {
31   }
32
33   public static SimpleNode parseExpression(String JavaDoc src) throws UnsupportedEncodingException JavaDoc, ParseException
34   {
35     ByteArrayInputStream JavaDoc sr = new ByteArrayInputStream JavaDoc(src.getBytes("UTF8"));
36     DjOqlParserEngine parser = new DjOqlParserEngine(sr);
37
38     ExpressionNode tree = parser.buildExpressionTree();
39     TreeNormalizer norm = new TreeNormalizer();
40     SimpleNode root = new SimpleNode(0);
41     root.addChild(tree);
42     norm.normalize(root);
43     return root.getChild(0);
44   }
45
46   /*******************************************************************
47    * DjOql grammar starts here
48    *******************************************************************/

49   final public ExpressionNode buildExpressionTree() throws ParseException
50   {
51     ExpressionNode node;
52     node = Expression();
53     jj_consume_token(0);
54     {
55       if (true) return node;
56     }
57     throw new Error JavaDoc("Missing return statement in function");
58   }
59
60   final public PropertyNode Objectpath() throws ParseException
61   {
62     /*@bgen(jjtree) Objectpath */
63     SimpleNode jjtn000 = (SimpleNode) SimpleNode.jjtCreate(JJTOBJECTPATH);
64     boolean jjtc000 = true;
65     jjtree.openNodeScope(jjtn000);
66     Token token;
67     PropertyNode pathNode = (PropertyNode) jjtn000;
68     String JavaDoc rs;
69     try
70     {
71       token = jj_consume_token(IDENTIFIER);
72       pathNode.setLineInfo(token);
73       rs = token.image;
74       label_1 : while (true)
75       {
76         if (jj_2_1(2))
77         {
78           ;
79         }
80         else
81         {
82           break label_1;
83         }
84         jj_consume_token(DOT);
85         token = jj_consume_token(IDENTIFIER);
86         rs += "." + token.image;
87       }
88       jjtree.closeNodeScope(jjtn000, true);
89       jjtc000 = false;
90       pathNode.setPath(rs);
91       {
92         if (true) return pathNode;
93       }
94     }
95     finally
96     {
97       if (jjtc000)
98       {
99         jjtree.closeNodeScope(jjtn000, true);
100       }
101     }
102     throw new Error JavaDoc("Missing return statement in function");
103   }
104
105   final public ExpressionNode Expression() throws ParseException
106   {
107     /*@bgen(jjtree) Expression */
108     SimpleNode jjtn000 = (SimpleNode) SimpleNode.jjtCreate(JJTEXPRESSION);
109     boolean jjtc000 = true;
110     jjtree.openNodeScope(jjtn000);
111     ExpressionNode expressionNode = (ExpressionNode) jjtn000;
112     SubExpressionNode subExpressionNode;
113     try
114     {
115       subExpressionNode = SubExpression();
116       expressionNode.setLineInfo(subExpressionNode);
117       label_2 : while (true)
118       {
119         switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk)
120         {
121           case SC_OR2 :
122           case SC_AND2 :
123           case SC_OR :
124           case SC_AND :
125             ;
126             break;
127           default :
128             jj_la1[0] = jj_gen;
129             break label_2;
130         }
131         AndOr();
132         SubExpression();
133       }
134       jjtree.closeNodeScope(jjtn000, true);
135       jjtc000 = false;
136       {
137         if (true) return expressionNode;
138       }
139     }
140     catch (Throwable JavaDoc jjte000)
141     {
142       if (jjtc000)
143       {
144         jjtree.clearNodeScope(jjtn000);
145         jjtc000 = false;
146       }
147       else
148       {
149         jjtree.popNode();
150       }
151       if (jjte000 instanceof RuntimeException JavaDoc)
152       {
153         {
154           if (true) throw (RuntimeException JavaDoc) jjte000;
155         }
156       }
157       if (jjte000 instanceof ParseException)
158       {
159         {
160           if (true) throw (ParseException) jjte000;
161         }
162       }
163       {
164         if (true) throw (Error JavaDoc) jjte000;
165       }
166     }
167     finally
168     {
169       if (jjtc000)
170       {
171         jjtree.closeNodeScope(jjtn000, true);
172       }
173     }
174     throw new Error JavaDoc("Missing return statement in function");
175   }
176
177   final public AndOrNode AndOr() throws ParseException
178   {
179     /*@bgen(jjtree) AndOr */
180     SimpleNode jjtn000 = (SimpleNode) SimpleNode.jjtCreate(JJTANDOR);
181     boolean jjtc000 = true;
182     jjtree.openNodeScope(jjtn000);
183     Token token;
184     AndOrNode node = (AndOrNode) jjtn000;
185     try
186     {
187       switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk)
188       {
189         case SC_OR :
190           token = jj_consume_token(SC_OR);
191           break;
192         case SC_AND :
193           token = jj_consume_token(SC_AND);
194           break;
195         case SC_OR2 :
196           token = jj_consume_token(SC_OR2);
197           break;
198         case SC_AND2 :
199           token = jj_consume_token(SC_AND2);
200           break;
201         default :
202           jj_la1[1] = jj_gen;
203           jj_consume_token(-1);
204           throw new ParseException();
205       }
206       jjtree.closeNodeScope(jjtn000, true);
207       jjtc000 = false;
208       node.setOperator(token.image.toString());
209       {
210         if (true) return node;
211       }
212     }
213     finally
214     {
215       if (jjtc000)
216       {
217         jjtree.closeNodeScope(jjtn000, true);
218       }
219     }
220     throw new Error JavaDoc("Missing return statement in function");
221   }
222
223   final public SubExpressionNode SubExpression() throws ParseException
224   {
225     /*@bgen(jjtree) SubExpression */
226     SimpleNode jjtn000 = (SimpleNode) SimpleNode.jjtCreate(JJTSUBEXPRESSION);
227     boolean jjtc000 = true;
228     jjtree.openNodeScope(jjtn000);
229     Token token = null;
230     SubExpressionNode subExpressionNode = (SubExpressionNode) jjtn000;
231     CalculatedExpressionNode calcNode;
232     Token not = null;
233     try
234     {
235       calcNode = CalculatedExpression();
236       subExpressionNode.setLineInfo(calcNode);
237       label_3 : while (true)
238       {
239         switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk)
240         {
241           case LIKE :
242           case IS :
243           case GT :
244           case LT :
245           case EQ :
246           case EQ2 :
247           case LE :
248           case GE :
249           case NE :
250             ;
251             break;
252           default :
253             jj_la1[2] = jj_gen;
254             break label_3;
255         }
256         switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk)
257         {
258           case EQ :
259             token = jj_consume_token(EQ);
260             break;
261           case NE :
262             token = jj_consume_token(NE);
263             break;
264           case LIKE :
265             token = jj_consume_token(LIKE);
266             break;
267           case EQ2 :
268             token = jj_consume_token(EQ2);
269             break;
270           case LT :
271             token = jj_consume_token(LT);
272             break;
273           case GT :
274             token = jj_consume_token(GT);
275             break;
276           case IS :
277             token = jj_consume_token(IS);
278             switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk)
279             {
280               case NOT :
281                 not = jj_consume_token(NOT);
282                 break;
283               default :
284                 jj_la1[3] = jj_gen;
285                 ;
286             }
287             break;
288           case LE :
289             token = jj_consume_token(LE);
290             break;
291           case GE :
292             token = jj_consume_token(GE);
293             break;
294           default :
295             jj_la1[4] = jj_gen;
296             jj_consume_token(-1);
297             throw new ParseException();
298         }
299         CalculatedExpression();
300       }
301       jjtree.closeNodeScope(jjtn000, true);
302       jjtc000 = false;
303       if (token != null) subExpressionNode.setOperator(token.image);
304       if (not != null) subExpressionNode.setNegated(true);
305       {
306         if (true) return subExpressionNode;
307       }
308     }
309     catch (Throwable JavaDoc jjte000)
310     {
311       if (jjtc000)
312       {
313         jjtree.clearNodeScope(jjtn000);
314         jjtc000 = false;
315       }
316       else
317       {
318         jjtree.popNode();
319       }
320       if (jjte000 instanceof RuntimeException JavaDoc)
321       {
322         {
323           if (true) throw (RuntimeException JavaDoc) jjte000;
324         }
325       }
326       if (jjte000 instanceof ParseException)
327       {
328         {
329           if (true) throw (ParseException) jjte000;
330         }
331       }
332       {
333         if (true) throw (Error JavaDoc) jjte000;
334       }
335     }
336     finally
337     {
338       if (jjtc000)
339       {
340         jjtree.closeNodeScope(jjtn000, true);
341       }
342     }
343     throw new Error JavaDoc("Missing return statement in function");
344   }
345
346   final public CalculatedExpressionNode CalculatedExpression() throws ParseException
347   {
348     /*@bgen(jjtree) CalculatedExpression */
349     SimpleNode jjtn000 = (SimpleNode) SimpleNode.jjtCreate(JJTCALCULATEDEXPRESSION);
350     boolean jjtc000 = true;
351     jjtree.openNodeScope(jjtn000);
352     CalculatedExpressionNode expressionNode = (CalculatedExpressionNode) jjtn000;
353     SimpleNode primNode;
354     try
355     {
356       primNode = PrimaryExpression();
357       expressionNode.setLineInfo(primNode);
358       label_4 : while (true)
359       {
360         switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk)
361         {
362           case DOT :
363           case PLUS :
364           case MINUS :
365           case STAR :
366           case SLASH :
367           case 51 :
368             ;
369             break;
370           default :
371             jj_la1[5] = jj_gen;
372             break label_4;
373         }
374         Operator();
375         PrimaryExpression();
376       }
377       jjtree.closeNodeScope(jjtn000, true);
378       jjtc000 = false;
379       {
380         if (true) return expressionNode;
381       }
382     }
383     catch (Throwable JavaDoc jjte000)
384     {
385       if (jjtc000)
386       {
387         jjtree.clearNodeScope(jjtn000);
388         jjtc000 = false;
389       }
390       else
391       {
392         jjtree.popNode();
393       }
394       if (jjte000 instanceof RuntimeException JavaDoc)
395       {
396         {
397           if (true) throw (RuntimeException JavaDoc) jjte000;
398         }
399       }
400       if (jjte000 instanceof ParseException)
401       {
402         {
403           if (true) throw (ParseException) jjte000;
404         }
405       }
406       {
407         if (true) throw (Error JavaDoc) jjte000;
408       }
409     }
410     finally
411     {
412       if (jjtc000)
413       {
414         jjtree.closeNodeScope(jjtn000, true);
415       }
416     }
417     throw new Error JavaDoc("Missing return statement in function");
418   }
419
420   final public void Operator() throws ParseException
421   {
422     /*@bgen(jjtree) Operator */
423     SimpleNode jjtn000 = (SimpleNode) SimpleNode.jjtCreate(JJTOPERATOR);
424     boolean jjtc000 = true;
425     jjtree.openNodeScope(jjtn000);
426     OperatorNode opNode = (OperatorNode) jjtn000;
427     try
428     {
429       switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk)
430       {
431         case PLUS :
432           jj_consume_token(PLUS);
433           opNode.setOperator("+");
434           break;
435         case MINUS :
436           jj_consume_token(MINUS);
437           opNode.setOperator("-");
438           break;
439         case STAR :
440           jj_consume_token(STAR);
441           opNode.setOperator("*");
442           break;
443         case SLASH :
444           jj_consume_token(SLASH);
445           opNode.setOperator("/");
446           break;
447         case 51 :
448           jj_consume_token(51);
449           opNode.setOperator("%");
450           break;
451         case DOT :
452           jj_consume_token(DOT);
453           opNode.setOperator(".");
454           break;
455         default :
456           jj_la1[6] = jj_gen;
457           jj_consume_token(-1);
458           throw new ParseException();
459       }
460       jjtree.closeNodeScope(jjtn000, true);
461       jjtc000 = false;
462       opNode.setLineInfo(token);
463     }
464     finally
465     {
466       if (jjtc000)
467       {
468         jjtree.closeNodeScope(jjtn000, true);
469       }
470     }
471   }
472
473   final public SimpleNode PrimaryExpression() throws ParseException
474   {
475     SimpleNode subNode;
476     if (jj_2_3(3))
477     {
478       subNode = boolLiteral();
479     }
480     else
481     {
482       switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk)
483       {
484         case COLON :
485           subNode = Parameter();
486           break;
487         case IDENTIFIER :
488         case BANG :
489           subNode = PropertyOrFunction();
490           break;
491         default :
492           jj_la1[7] = jj_gen;
493           if (jj_2_4(2))
494           {
495             subNode = integerLiteral();
496           }
497           else
498           {
499             switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk)
500             {
501               case FLOATING_POINT_LITERAL :
502               case MINUS :
503                 subNode = floatLiteral();
504                 break;
505               case CHARACTER_LITERAL :
506                 subNode = charLiteral();
507                 break;
508               case STRING_LITERAL :
509                 subNode = stringLiteral();
510                 break;
511               case NULL :
512                 subNode = nullLiteral();
513                 break;
514               case LPAREN :
515                 BracketOpen();
516                 subNode = Expression();
517                 BracketClose();
518                 label_5 : while (true)
519                 {
520                   if (jj_2_2(2))
521                   {
522                     ;
523                   }
524                   else
525                   {
526                     break label_5;
527                   }
528                   Arguments();
529                 }
530                 break;
531               default :
532                 jj_la1[8] = jj_gen;
533                 jj_consume_token(-1);
534                 throw new ParseException();
535             }
536           }
537       }
538     }
539     {
540       if (true) return subNode;
541     }
542     throw new Error JavaDoc("Missing return statement in function");
543   }
544
545   final public BracketNode BracketOpen() throws ParseException
546   {
547     /*@bgen(jjtree) BracketOpen */
548     SimpleNode jjtn000 = (SimpleNode) SimpleNode.jjtCreate(JJTBRACKETOPEN);
549     boolean jjtc000 = true;
550     jjtree.openNodeScope(jjtn000);
551     BracketNode bnode = (BracketNode) jjtn000;
552     Token token;
553     try
554     {
555       token = jj_consume_token(LPAREN);
556       jjtree.closeNodeScope(jjtn000, true);
557       jjtc000 = false;
558       bnode.setLineInfo(token);
559       bnode.setBracket("(");
560       {
561         if (true) return bnode;
562       }
563     }
564     finally
565     {
566       if (jjtc000)
567       {
568         jjtree.closeNodeScope(jjtn000, true);
569       }
570     }
571     throw new Error JavaDoc("Missing return statement in function");
572   }
573
574   final public BracketNode BracketClose() throws ParseException
575   {
576     /*@bgen(jjtree) BracketClose */
577     SimpleNode jjtn000 = (SimpleNode) SimpleNode.jjtCreate(JJTBRACKETCLOSE);
578     boolean jjtc000 = true;
579     jjtree.openNodeScope(jjtn000);
580     BracketNode bnode = (BracketNode) jjtn000;
581     Token token;
582     try
583     {
584       token = jj_consume_token(RPAREN);
585       jjtree.closeNodeScope(jjtn000, true);
586       jjtc000 = false;
587       bnode.setLineInfo(token);
588       bnode.setBracket(")");
589       {
590         if (true) return bnode;
591       }
592     }
593     finally
594     {
595       if (jjtc000)
596       {
597         jjtree.closeNodeScope(jjtn000, true);
598       }
599     }
600     throw new Error JavaDoc("Missing return statement in function");
601   }
602
603   final public PropertyOrFunctionNode PropertyOrFunction() throws ParseException
604   {
605     /*@bgen(jjtree) PropertyOrFunction */
606     SimpleNode jjtn000 = (SimpleNode) SimpleNode.jjtCreate(JJTPROPERTYORFUNCTION);
607     boolean jjtc000 = true;
608     jjtree.openNodeScope(jjtn000);
609     PropertyOrFunctionNode pfnode = (PropertyOrFunctionNode) jjtn000;
610     PropertyNode path;
611     Token not = null;
612     try
613     {
614       switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk)
615       {
616         case BANG :
617           not = jj_consume_token(BANG);
618           break;
619         default :
620           jj_la1[9] = jj_gen;
621           ;
622       }
623       path = Objectpath();
624       pfnode.setLineInfo(path);
625       switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk)
626       {
627         case LPAREN :
628           BracketOpen();
629           switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk)
630           {
631             case INTEGER_LITERAL :
632             case FLOATING_POINT_LITERAL :
633             case CHARACTER_LITERAL :
634             case STRING_LITERAL :
635             case NULL :
636             case TRUE :
637             case FALSE :
638             case IDENTIFIER :
639             case LPAREN :
640             case BANG :
641             case COLON :
642             case MINUS :
643               Expression();
644               label_6 : while (true)
645               {
646                 switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk)
647                 {
648                   case COMMA :
649                     ;
650                     break;
651                   default :
652                     jj_la1[10] = jj_gen;
653                     break label_6;
654                 }
655                 jj_consume_token(COMMA);
656                 Expression();
657               }
658               break;
659             default :
660               jj_la1[11] = jj_gen;
661               ;
662           }
663           BracketClose();
664           pfnode.setFunction(true);
665           break;
666         default :
667           jj_la1[12] = jj_gen;
668           ;
669       }
670       jjtree.closeNodeScope(jjtn000, true);
671       jjtc000 = false;
672       if (not != null) path.setNegated(true);
673       {
674         if (true) return pfnode;
675       }
676     }
677     catch (Throwable JavaDoc jjte000)
678     {
679       if (jjtc000)
680       {
681         jjtree.clearNodeScope(jjtn000);
682         jjtc000 = false;
683       }
684       else
685       {
686         jjtree.popNode();
687       }
688       if (jjte000 instanceof RuntimeException JavaDoc)
689       {
690         {
691           if (true) throw (RuntimeException JavaDoc) jjte000;
692         }
693       }
694       if (jjte000 instanceof ParseException)
695       {
696         {
697           if (true) throw (ParseException) jjte000;
698         }
699       }
700       {
701         if (true) throw (Error JavaDoc) jjte000;
702       }
703     }
704     finally
705     {
706       if (jjtc000)
707       {
708         jjtree.closeNodeScope(jjtn000, true);
709       }
710     }
711     throw new Error JavaDoc("Missing return statement in function");
712   }
713
714   final public ParameterNode Parameter() throws ParseException
715   {
716     /*@bgen(jjtree) Parameter */
717     SimpleNode jjtn000 = (SimpleNode) SimpleNode.jjtCreate(JJTPARAMETER);
718     boolean jjtc000 = true;
719     jjtree.openNodeScope(jjtn000);
720     ParameterNode paramNode = (ParameterNode) jjtn000;
721     Token token;
722     try
723     {
724       jj_consume_token(COLON);
725       token = jj_consume_token(IDENTIFIER);
726       jjtree.closeNodeScope(jjtn000, true);
727       jjtc000 = false;
728       paramNode.setParamName(token.image);
729       {
730         if (true) return paramNode;
731       }
732     }
733     finally
734     {
735       if (jjtc000)
736       {
737         jjtree.closeNodeScope(jjtn000, true);
738       }
739     }
740     throw new Error JavaDoc("Missing return statement in function");
741   }
742
743   final public PropertyOrFunctionNode FunctionCall() throws ParseException
744   {
745     /*@bgen(jjtree) FunctionCall */
746     SimpleNode jjtn000 = (SimpleNode) SimpleNode.jjtCreate(JJTFUNCTIONCALL);
747     boolean jjtc000 = true;
748     jjtree.openNodeScope(jjtn000);
749     PropertyOrFunctionNode pfnode = (PropertyOrFunctionNode) jjtn000;
750     PropertyNode path;
751     try
752     {
753       path = Objectpath();
754       pfnode.setLineInfo(path);
755       BracketOpen();
756       switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk)
757       {
758         case INTEGER_LITERAL :
759         case FLOATING_POINT_LITERAL :
760         case CHARACTER_LITERAL :
761         case STRING_LITERAL :
762         case NULL :
763         case TRUE :
764         case FALSE :
765         case IDENTIFIER :
766         case LPAREN :
767         case BANG :
768         case COLON :
769         case MINUS :
770           Expression();
771           label_7 : while (true)
772           {
773             switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk)
774             {
775               case COMMA :
776                 ;
777                 break;
778               default :
779                 jj_la1[13] = jj_gen;
780                 break label_7;
781             }
782             jj_consume_token(COMMA);
783             Expression();
784           }
785           break;
786         default :
787           jj_la1[14] = jj_gen;
788           ;
789       }
790       BracketClose();
791       jj_consume_token(52);
792       jjtree.closeNodeScope(jjtn000, true);
793       jjtc000 = false;
794       pfnode.setFunction(true);
795       {
796         if (true) return pfnode;
797       }
798     }
799     catch (Throwable JavaDoc jjte000)
800     {
801       if (jjtc000)
802       {
803         jjtree.clearNodeScope(jjtn000);
804         jjtc000 = false;
805       }
806       else
807       {
808         jjtree.popNode();
809       }
810       if (jjte000 instanceof RuntimeException JavaDoc)
811       {
812         {
813           if (true) throw (RuntimeException JavaDoc) jjte000;
814         }
815       }
816       if (jjte000 instanceof ParseException)
817       {
818         {
819           if (true) throw (ParseException) jjte000;
820         }
821       }
822       {
823         if (true) throw (Error JavaDoc) jjte000;
824       }
825     }
826     finally
827     {
828       if (jjtc000)
829       {
830         jjtree.closeNodeScope(jjtn000, true);
831       }
832     }
833     throw new Error JavaDoc("Missing return statement in function");
834   }
835
836   final public IntegerNode integerLiteral() throws ParseException
837   {
838     /*@bgen(jjtree) integerLiteral */
839     SimpleNode jjtn000 = (SimpleNode) SimpleNode.jjtCreate(JJTINTEGERLITERAL);
840     boolean jjtc000 = true;
841     jjtree.openNodeScope(jjtn000);
842     Token token = null;
843     Token sign = null;
844     IntegerNode node = (IntegerNode) jjtn000;
845     try
846     {
847       switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk)
848       {
849         case MINUS :
850           sign = jj_consume_token(MINUS);
851           break;
852         default :
853           jj_la1[15] = jj_gen;
854           ;
855       }
856       token = jj_consume_token(INTEGER_LITERAL);
857       node.setLineInfo(token);
858       try
859       {
860         int v = Integer.parseInt(token.image);
861         if (sign != null) v = -v;
862         node.setValue(v);
863       }
864       catch (Exception JavaDoc x)
865       { // Will never happen since it was parsed ok
866
x.printStackTrace();
867       }
868       jjtree.closeNodeScope(jjtn000, true);
869       jjtc000 = false;
870       {
871         if (true) return node;
872       }
873     }
874     finally
875     {
876       if (jjtc000)
877       {
878         jjtree.closeNodeScope(jjtn000, true);
879       }
880     }
881     throw new Error JavaDoc("Missing return statement in function");
882   }
883
884   final public FloatNode floatLiteral() throws ParseException
885   {
886     /*@bgen(jjtree) floatLiteral */
887     SimpleNode jjtn000 = (SimpleNode) SimpleNode.jjtCreate(JJTFLOATLITERAL);
888     boolean jjtc000 = true;
889     jjtree.openNodeScope(jjtn000);
890     Token token = null;
891     Token sign = null;
892     FloatNode node = (FloatNode) jjtn000;
893     try
894     {
895       switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk)
896       {
897         case MINUS :
898           sign = jj_consume_token(MINUS);
899           break;
900         default :
901           jj_la1[16] = jj_gen;
902           ;
903       }
904       token = jj_consume_token(FLOATING_POINT_LITERAL);
905       node.setLineInfo(token);
906       try
907       {
908         float v = Float.parseFloat(token.image);
909         if (sign != null) v = -v;
910         node.setValue(v);
911       }
912       catch (Exception JavaDoc x)
913       { // Will never happen since it was parsed ok
914
x.printStackTrace();
915       }
916       jjtree.closeNodeScope(jjtn000, true);
917       jjtc000 = false;
918       {
919         if (true) return node;
920       }
921     }
922     finally
923     {
924       if (jjtc000)
925       {
926         jjtree.closeNodeScope(jjtn000, true);
927       }
928     }
929     throw new Error JavaDoc("Missing return statement in function");
930   }
931
932   final public CharNode charLiteral() throws ParseException
933   {
934     /*@bgen(jjtree) charLiteral */
935     SimpleNode jjtn000 = (SimpleNode) SimpleNode.jjtCreate(JJTCHARLITERAL);
936     boolean jjtc000 = true;
937     jjtree.openNodeScope(jjtn000);
938     Token token = null;
939     CharNode node = (CharNode) jjtn000;
940     try
941     {
942       token = jj_consume_token(CHARACTER_LITERAL);
943       node.setLineInfo(token);
944       node.setValue(token.image.toString());
945       jjtree.closeNodeScope(jjtn000, true);
946       jjtc000 = false;
947       {
948         if (true) return node;
949       }
950     }
951     finally
952     {
953       if (jjtc000)
954       {
955         jjtree.closeNodeScope(jjtn000, true);
956       }
957     }
958     throw new Error JavaDoc("Missing return statement in function");
959   }
960
961   final public StringNode stringLiteral() throws ParseException
962   {
963     /*@bgen(jjtree) stringLiteral */
964     SimpleNode jjtn000 = (SimpleNode) SimpleNode.jjtCreate(JJTSTRINGLITERAL);
965     boolean jjtc000 = true;
966     jjtree.openNodeScope(jjtn000);
967     Token token = null;
968     StringNode node = (StringNode) jjtn000;
969     try
970     {
971       token = jj_consume_token(STRING_LITERAL);
972       node.setLineInfo(token);
973       node.setValue(token.image.toString());
974       jjtree.closeNodeScope(jjtn000, true);
975       jjtc000 = false;
976       {
977         if (true) return node;
978       }
979     }
980     finally
981     {
982       if (jjtc000)
983       {
984         jjtree.closeNodeScope(jjtn000, true);
985       }
986     }
987     throw new Error JavaDoc("Missing return statement in function");
988   }
989
990   final public BoolNode boolLiteral() throws ParseException
991   {
992     /*@bgen(jjtree) boolLiteral */
993     SimpleNode jjtn000 = (SimpleNode) SimpleNode.jjtCreate(JJTBOOLLITERAL);
994     boolean jjtc000 = true;
995     jjtree.openNodeScope(jjtn000);
996     Token token = null;
997     Token not = null;
998     BoolNode node = (BoolNode) jjtn000;
999     try
1000    {
1001      switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk)
1002      {
1003        case BANG :
1004          not = jj_consume_token(BANG);
1005          break;
1006        default :
1007          jj_la1[17] = jj_gen;
1008          ;
1009      }
1010      switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk)
1011      {
1012        case TRUE :
1013          token = jj_consume_token(TRUE);
1014          break;
1015        case FALSE :
1016          token = jj_consume_token(FALSE);
1017          break;
1018        default :
1019          jj_la1[18] = jj_gen;
1020          jj_consume_token(-1);
1021          throw new ParseException();
1022      }
1023      jjtree.closeNodeScope(jjtn000, true);
1024      jjtc000 = false;
1025      node.setValue(token.image.equals("true"));
1026      if (not != null) node.setValue(!node.isTrue());
1027      node.setLineInfo(token);
1028      {
1029        if (true) return node;
1030      }
1031    }
1032    finally
1033    {
1034      if (jjtc000)
1035      {
1036        jjtree.closeNodeScope(jjtn000, true);
1037      }
1038    }
1039    throw new Error JavaDoc("Missing return statement in function");
1040  }
1041
1042  final public NullNode nullLiteral() throws ParseException
1043  {
1044    /*@bgen(jjtree) nullLiteral */
1045    SimpleNode jjtn000 = (SimpleNode) SimpleNode.jjtCreate(JJTNULLLITERAL);
1046    boolean jjtc000 = true;
1047    jjtree.openNodeScope(jjtn000);
1048    Token token = null;
1049    NullNode node = (NullNode) jjtn000;
1050    try
1051    {
1052      token = jj_consume_token(NULL);
1053      jjtree.closeNodeScope(jjtn000, true);
1054      jjtc000 = false;
1055      node.setLineInfo(token);
1056      {
1057        if (true) return node;
1058      }
1059    }
1060    finally
1061    {
1062      if (jjtc000)
1063      {
1064        jjtree.closeNodeScope(jjtn000, true);
1065      }
1066    }
1067    throw new Error JavaDoc("Missing return statement in function");
1068  }
1069
1070  final public ArgumentsNode Arguments() throws ParseException
1071  {
1072    /*@bgen(jjtree) Arguments */
1073    SimpleNode jjtn000 = (SimpleNode) SimpleNode.jjtCreate(JJTARGUMENTS);
1074    boolean jjtc000 = true;
1075    jjtree.openNodeScope(jjtn000);
1076    ArgumentsNode argumentsNode = (ArgumentsNode) jjtn000;
1077    try
1078    {
1079      BracketOpen();
1080      switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk)
1081      {
1082        case INTEGER_LITERAL :
1083        case FLOATING_POINT_LITERAL :
1084        case CHARACTER_LITERAL :
1085        case STRING_LITERAL :
1086        case NULL :
1087        case TRUE :
1088        case FALSE :
1089        case IDENTIFIER :
1090        case LPAREN :
1091        case BANG :
1092        case COLON :
1093        case MINUS :
1094          Expression();
1095          label_8 : while (true)
1096          {
1097            switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk)
1098            {
1099              case COMMA :
1100                ;
1101                break;
1102              default :
1103                jj_la1[19] = jj_gen;
1104                break label_8;
1105            }
1106            jj_consume_token(COMMA);
1107            Expression();
1108          }
1109          break;
1110        default :
1111          jj_la1[20] = jj_gen;
1112          ;
1113      }
1114      BracketClose();
1115      jjtree.closeNodeScope(jjtn000, true);
1116      jjtc000 = false;
1117      {
1118        if (true) return argumentsNode;
1119      }
1120    }
1121    catch (Throwable JavaDoc jjte000)
1122    {
1123      if (jjtc000)
1124      {
1125        jjtree.clearNodeScope(jjtn000);
1126        jjtc000 = false;
1127      }
1128      else
1129      {
1130        jjtree.popNode();
1131      }
1132      if (jjte000 instanceof RuntimeException JavaDoc)
1133      {
1134        {
1135          if (true) throw (RuntimeException JavaDoc) jjte000;
1136        }
1137      }
1138      if (jjte000 instanceof ParseException)
1139      {
1140        {
1141          if (true) throw (ParseException) jjte000;
1142        }
1143      }
1144      {
1145        if (true) throw (Error JavaDoc) jjte000;
1146      }
1147    }
1148    finally
1149    {
1150      if (jjtc000)
1151      {
1152        jjtree.closeNodeScope(jjtn000, true);
1153      }
1154    }
1155    throw new Error JavaDoc("Missing return statement in function");
1156  }
1157
1158  final private boolean jj_2_1(int xla)
1159  {
1160    jj_la = xla;
1161    jj_lastpos = jj_scanpos = token;
1162    boolean retval = !jj_3_1();
1163    jj_save(0, xla);
1164    return retval;
1165  }
1166
1167  final private boolean jj_2_2(int xla)
1168  {
1169    jj_la = xla;
1170    jj_lastpos = jj_scanpos = token;
1171    boolean retval = !jj_3_2();
1172    jj_save(1, xla);
1173    return retval;
1174  }
1175
1176  final private boolean jj_2_3(int xla)
1177  {
1178    jj_la = xla;
1179    jj_lastpos = jj_scanpos = token;
1180    boolean retval = !jj_3_3();
1181    jj_save(2, xla);
1182    return retval;
1183  }
1184
1185  final private boolean jj_2_4(int xla)
1186  {
1187    jj_la = xla;
1188    jj_lastpos = jj_scanpos = token;
1189    boolean retval = !jj_3_4();
1190    jj_save(3, xla);
1191    return retval;
1192  }
1193
1194  final private boolean jj_3R_34()
1195  {
1196    if (jj_scan_token(STRING_LITERAL)) return true;
1197    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
1198    return false;
1199  }
1200
1201  final private boolean jj_3R_11()
1202  {
1203    Token xsp;
1204    xsp = jj_scanpos;
1205    if (jj_3R_18()) jj_scanpos = xsp;
1206    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
1207    if (jj_scan_token(INTEGER_LITERAL)) return true;
1208    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
1209    return false;
1210  }
1211
1212  final private boolean jj_3R_18()
1213  {
1214    if (jj_scan_token(MINUS)) return true;
1215    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
1216    return false;
1217  }
1218
1219  final private boolean jj_3R_14()
1220  {
1221    if (jj_scan_token(RPAREN)) return true;
1222    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
1223    return false;
1224  }
1225
1226  final private boolean jj_3R_33()
1227  {
1228    if (jj_scan_token(CHARACTER_LITERAL)) return true;
1229    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
1230    return false;
1231  }
1232
1233  final private boolean jj_3R_9()
1234  {
1235    if (jj_3R_12()) return true;
1236    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
1237    Token xsp;
1238    xsp = jj_scanpos;
1239    if (jj_3R_13()) jj_scanpos = xsp;
1240    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
1241    if (jj_3R_14()) return true;
1242    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
1243    return false;
1244  }
1245
1246  final private boolean jj_3R_17()
1247  {
1248    if (jj_scan_token(FALSE)) return true;
1249    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
1250    return false;
1251  }
1252
1253  final private boolean jj_3R_21()
1254  {
1255    if (jj_3R_22()) return true;
1256    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
1257    return false;
1258  }
1259
1260  final private boolean jj_3R_12()
1261  {
1262    if (jj_scan_token(LPAREN)) return true;
1263    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
1264    return false;
1265  }
1266
1267  final private boolean jj_3R_35()
1268  {
1269    if (jj_scan_token(NULL)) return true;
1270    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
1271    return false;
1272  }
1273
1274  final private boolean jj_3R_19()
1275  {
1276    if (jj_3R_20()) return true;
1277    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
1278    return false;
1279  }
1280
1281  final private boolean jj_3_2()
1282  {
1283    if (jj_3R_9()) return true;
1284    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
1285    return false;
1286  }
1287
1288  final private boolean jj_3R_30()
1289  {
1290    if (jj_scan_token(COLON)) return true;
1291    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
1292    return false;
1293  }
1294
1295  final private boolean jj_3R_29()
1296  {
1297    if (jj_3R_12()) return true;
1298    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
1299    return false;
1300  }
1301
1302  final private boolean jj_3R_38()
1303  {
1304    if (jj_scan_token(MINUS)) return true;
1305    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
1306    return false;
1307  }
1308
1309  final private boolean jj_3R_32()
1310  {
1311    Token xsp;
1312    xsp = jj_scanpos;
1313    if (jj_3R_38()) jj_scanpos = xsp;
1314    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
1315    if (jj_scan_token(FLOATING_POINT_LITERAL)) return true;
1316    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
1317    return false;
1318  }
1319
1320  final private boolean jj_3R_28()
1321  {
1322    if (jj_3R_35()) return true;
1323    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
1324    return false;
1325  }
1326
1327  final private boolean jj_3R_27()
1328  {
1329    if (jj_3R_34()) return true;
1330    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
1331    return false;
1332  }
1333
1334  final private boolean jj_3R_26()
1335  {
1336    if (jj_3R_33()) return true;
1337    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
1338    return false;
1339  }
1340
1341  final private boolean jj_3R_25()
1342  {
1343    if (jj_3R_32()) return true;
1344    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
1345    return false;
1346  }
1347
1348  final private boolean jj_3R_15()
1349  {
1350    if (jj_scan_token(BANG)) return true;
1351    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
1352    return false;
1353  }
1354
1355  final private boolean jj_3R_16()
1356  {
1357    if (jj_scan_token(TRUE)) return true;
1358    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
1359    return false;
1360  }
1361
1362  final private boolean jj_3_1()
1363  {
1364    if (jj_scan_token(DOT)) return true;
1365    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
1366    if (jj_scan_token(IDENTIFIER)) return true;
1367    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
1368    return false;
1369  }
1370
1371  final private boolean jj_3_4()
1372  {
1373    if (jj_3R_11()) return true;
1374    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
1375    return false;
1376  }
1377
1378  final private boolean jj_3R_10()
1379  {
1380    Token xsp;
1381    xsp = jj_scanpos;
1382    if (jj_3R_15()) jj_scanpos = xsp;
1383    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
1384    xsp = jj_scanpos;
1385    if (jj_3R_16())
1386    {
1387      jj_scanpos = xsp;
1388      if (jj_3R_17()) return true;
1389      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
1390    }
1391    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
1392    return false;
1393  }
1394
1395  final private boolean jj_3R_24()
1396  {
1397    if (jj_3R_31()) return true;
1398    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
1399    return false;
1400  }
1401
1402  final private boolean jj_3R_23()
1403  {
1404    if (jj_3R_30()) return true;
1405    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
1406    return false;
1407  }
1408
1409  final private boolean jj_3R_37()
1410  {
1411    if (jj_scan_token(IDENTIFIER)) return true;
1412    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
1413    return false;
1414  }
1415
1416  final private boolean jj_3_3()
1417  {
1418    if (jj_3R_10()) return true;
1419    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
1420    return false;
1421  }
1422
1423  final private boolean jj_3R_22()
1424  {
1425    Token xsp;
1426    xsp = jj_scanpos;
1427    if (jj_3_3())
1428    {
1429      jj_scanpos = xsp;
1430      if (jj_3R_23())
1431      {
1432        jj_scanpos = xsp;
1433        if (jj_3R_24())
1434        {
1435          jj_scanpos = xsp;
1436          if (jj_3_4())
1437          {
1438            jj_scanpos = xsp;
1439            if (jj_3R_25())
1440            {
1441              jj_scanpos = xsp;
1442              if (jj_3R_26())
1443              {
1444                jj_scanpos = xsp;
1445                if (jj_3R_27())
1446                {
1447                  jj_scanpos = xsp;
1448                  if (jj_3R_28())
1449                  {
1450                    jj_scanpos = xsp;
1451                    if (jj_3R_29()) return true;
1452                    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
1453                  }
1454                  else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
1455                }
1456                else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
1457              }
1458              else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
1459            }
1460            else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
1461          }
1462          else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
1463        }
1464        else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
1465      }
1466      else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
1467    }
1468    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
1469    return false;
1470  }
1471
1472  final private boolean jj_3R_20()
1473  {
1474    if (jj_3R_21()) return true;
1475    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
1476    return false;
1477  }
1478
1479  final private boolean jj_3R_13()
1480  {
1481    if (jj_3R_19()) return true;
1482    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
1483    return false;
1484  }
1485
1486  final private boolean jj_3R_36()
1487  {
1488    if (jj_scan_token(BANG)) return true;
1489    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
1490    return false;
1491  }
1492
1493  final private boolean jj_3R_31()
1494  {
1495    Token xsp;
1496    xsp = jj_scanpos;
1497    if (jj_3R_36()) jj_scanpos = xsp;
1498    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
1499    if (jj_3R_37()) return true;
1500    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
1501    return false;
1502  }
1503
1504  public DjOqlParserEngineTokenManager token_source;
1505  JavaCharStream jj_input_stream;
1506  public Token token, jj_nt;
1507  private int jj_ntk;
1508  private Token jj_scanpos, jj_lastpos;
1509  private int jj_la;
1510  public boolean lookingAhead = false;
1511  private boolean jj_semLA;
1512  private int jj_gen;
1513  final private int[] jj_la1 = new int[21];
1514  static private int[] jj_la1_0;
1515  static private int[] jj_la1_1;
1516  static
1517  {
1518    jj_la1_0();
1519    jj_la1_1();
1520  }
1521
1522  private static void jj_la1_0()
1523  {
1524    jj_la1_0 = new int[]{0x18000000, 0x18000000, 0xa00000, 0x1000000, 0xa00000, 0x0, 0x0, 0x20000000, 0x5a0000, 0x0,
1525        0x0, 0x265a2000, 0x0, 0x0, 0x265a2000, 0x0, 0x0, 0x0, 0x6000000, 0x0, 0x265a2000,};
1526  }
1527
1528  private static void jj_la1_1()
1529  {
1530    jj_la1_1 = new int[]{0x6000, 0x6000, 0x1f30, 0x0, 0x1f30, 0xf8008, 0xf8008, 0xc0, 0x10001, 0x40, 0x4, 0x100c1, 0x1,
1531        0x4, 0x100c1, 0x10000, 0x10000, 0x40, 0x0, 0x4, 0x100c1,};
1532  }
1533
1534  final private JJCalls[] jj_2_rtns = new JJCalls[4];
1535  private boolean jj_rescan = false;
1536  private int jj_gc = 0;
1537
1538  public DjOqlParserEngine(java.io.InputStream JavaDoc stream)
1539  {
1540    jj_input_stream = new JavaCharStream(stream, 1, 1);
1541    token_source = new DjOqlParserEngineTokenManager(jj_input_stream);
1542    token = new Token();
1543    jj_ntk = -1;
1544    jj_gen = 0;
1545    for (int i = 0; i < 21; i++)
1546      jj_la1[i] = -1;
1547    for (int i = 0; i < jj_2_rtns.length; i++)
1548      jj_2_rtns[i] = new JJCalls();
1549  }
1550
1551  public void ReInit(java.io.InputStream JavaDoc stream)
1552  {
1553    jj_input_stream.ReInit(stream, 1, 1);
1554    token_source.ReInit(jj_input_stream);
1555    token = new Token();
1556    jj_ntk = -1;
1557    jjtree.reset();
1558    jj_gen = 0;
1559    for (int i = 0; i < 21; i++)
1560      jj_la1[i] = -1;
1561    for (int i = 0; i < jj_2_rtns.length; i++)
1562      jj_2_rtns[i] = new JJCalls();
1563  }
1564
1565  public DjOqlParserEngine(java.io.Reader JavaDoc stream)
1566  {
1567    jj_input_stream = new JavaCharStream(stream, 1, 1);
1568    token_source = new DjOqlParserEngineTokenManager(jj_input_stream);
1569    token = new Token();
1570    jj_ntk = -1;
1571    jj_gen = 0;
1572    for (int i = 0; i < 21; i++)
1573      jj_la1[i] = -1;
1574    for (int i = 0; i < jj_2_rtns.length; i++)
1575      jj_2_rtns[i] = new JJCalls();
1576  }
1577
1578  public void ReInit(java.io.Reader JavaDoc stream)
1579  {
1580    jj_input_stream.ReInit(stream, 1, 1);
1581    token_source.ReInit(jj_input_stream);
1582    token = new Token();
1583    jj_ntk = -1;
1584    jjtree.reset();
1585    jj_gen = 0;
1586    for (int i = 0; i < 21; i++)
1587      jj_la1[i] = -1;
1588    for (int i = 0; i < jj_2_rtns.length; i++)
1589      jj_2_rtns[i] = new JJCalls();
1590  }
1591
1592  public DjOqlParserEngine(DjOqlParserEngineTokenManager tm)
1593  {
1594    token_source = tm;
1595    token = new Token();
1596    jj_ntk = -1;
1597    jj_gen = 0;
1598    for (int i = 0; i < 21; i++)
1599      jj_la1[i] = -1;
1600    for (int i = 0; i < jj_2_rtns.length; i++)
1601      jj_2_rtns[i] = new JJCalls();
1602  }
1603
1604  public void ReInit(DjOqlParserEngineTokenManager tm)
1605  {
1606    token_source = tm;
1607    token = new Token();
1608    jj_ntk = -1;
1609    jjtree.reset();
1610    jj_gen = 0;
1611    for (int i = 0; i < 21; i++)
1612      jj_la1[i] = -1;
1613    for (int i = 0; i < jj_2_rtns.length; i++)
1614      jj_2_rtns[i] = new JJCalls();
1615  }
1616
1617  final private Token jj_consume_token(int kind) throws ParseException
1618  {
1619    Token oldToken;
1620    if ((oldToken = token).next != null) token = token.next;
1621    else token = token.next = token_source.getNextToken();
1622    jj_ntk = -1;
1623    if (token.kind == kind)
1624    {
1625      jj_gen++;
1626      if (++jj_gc > 100)
1627      {
1628        jj_gc = 0;
1629        for (int i = 0; i < jj_2_rtns.length; i++)
1630        {
1631          JJCalls c = jj_2_rtns[i];
1632          while (c != null)
1633          {
1634            if (c.gen < jj_gen) c.first = null;
1635            c = c.next;
1636          }
1637        }
1638      }
1639      return token;
1640    }
1641    token = oldToken;
1642    jj_kind = kind;
1643    throw generateParseException();
1644  }
1645
1646  final private boolean jj_scan_token(int kind)
1647  {
1648    if (jj_scanpos == jj_lastpos)
1649    {
1650      jj_la--;
1651      if (jj_scanpos.next == null)
1652      {
1653        jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken();
1654      }
1655      else
1656      {
1657        jj_lastpos = jj_scanpos = jj_scanpos.next;
1658      }
1659    }
1660    else
1661    {
1662      jj_scanpos = jj_scanpos.next;
1663    }
1664    if (jj_rescan)
1665    {
1666      int i = 0;
1667      Token tok = token;
1668      while (tok != null && tok != jj_scanpos)
1669      {
1670        i++;
1671        tok = tok.next;
1672      }
1673      if (tok != null) jj_add_error_token(kind, i);
1674    }
1675    return (jj_scanpos.kind != kind);
1676  }
1677
1678  final public Token getNextToken()
1679  {
1680    if (token.next != null) token = token.next;
1681    else token = token.next = token_source.getNextToken();
1682    jj_ntk = -1;
1683    jj_gen++;
1684    return token;
1685  }
1686
1687  final public Token getToken(int index)
1688  {
1689    Token t = lookingAhead ? jj_scanpos : token;
1690    for (int i = 0; i < index; i++)
1691    {
1692      if (t.next != null) t = t.next;
1693      else t = t.next = token_source.getNextToken();
1694    }
1695    return t;
1696  }
1697
1698  final private int jj_ntk()
1699  {
1700    if ((jj_nt = token.next) == null) return (jj_ntk = (token.next = token_source.getNextToken()).kind);
1701    else return (jj_ntk = jj_nt.kind);
1702  }
1703
1704  private java.util.Vector JavaDoc jj_expentries = new java.util.Vector JavaDoc();
1705  private int[] jj_expentry;
1706  private int jj_kind = -1;
1707  private int[] jj_lasttokens = new int[100];
1708  private int jj_endpos;
1709
1710  private void jj_add_error_token(int kind, int pos)
1711  {
1712    if (pos >= 100) return;
1713    if (pos == jj_endpos + 1)
1714    {
1715      jj_lasttokens[jj_endpos++] = kind;
1716    }
1717    else if (jj_endpos != 0)
1718    {
1719      jj_expentry = new int[jj_endpos];
1720      for (int i = 0; i < jj_endpos; i++)
1721      {
1722        jj_expentry[i] = jj_lasttokens[i];
1723      }
1724      boolean exists = false;
1725      for (java.util.Enumeration JavaDoc enum1 = jj_expentries.elements(); enum1.hasMoreElements();)
1726      {
1727        int[] oldentry = (int[]) (enum1.nextElement());
1728        if (oldentry.length == jj_expentry.length)
1729        {
1730          exists = true;
1731          for (int i = 0; i < jj_expentry.length; i++)
1732          {
1733            if (oldentry[i] != jj_expentry[i])
1734            {
1735              exists = false;
1736              break;
1737            }
1738          }
1739          if (exists) break;
1740        }
1741      }
1742      if (!exists) jj_expentries.addElement(jj_expentry);
1743      if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind;
1744    }
1745  }
1746
1747  public ParseException generateParseException()
1748  {
1749    jj_expentries.removeAllElements();
1750    boolean[] la1tokens = new boolean[53];
1751    for (int i = 0; i < 53; i++)
1752    {
1753      la1tokens[i] = false;
1754    }
1755    if (jj_kind >= 0)
1756    {
1757      la1tokens[jj_kind] = true;
1758      jj_kind = -1;
1759    }
1760    for (int i = 0; i < 21; i++)
1761    {
1762      if (jj_la1[i] == jj_gen)
1763      {
1764        for (int j = 0; j < 32; j++)
1765        {
1766          if ((jj_la1_0[i] & (1 << j)) != 0)
1767          {
1768            la1tokens[j] = true;
1769          }
1770          if ((jj_la1_1[i] & (1 << j)) != 0)
1771          {
1772            la1tokens[32 + j] = true;
1773          }
1774        }
1775      }
1776    }
1777    for (int i = 0; i < 53; i++)
1778    {
1779      if (la1tokens[i])
1780      {
1781        jj_expentry = new int[1];
1782        jj_expentry[0] = i;
1783        jj_expentries.addElement(jj_expentry);
1784      }
1785    }
1786    jj_endpos = 0;
1787    jj_rescan_token();
1788    jj_add_error_token(0, 0);
1789    int[][] exptokseq = new int[jj_expentries.size()][];
1790    for (int i = 0; i < jj_expentries.size(); i++)
1791    {
1792      exptokseq[i] = (int[]) jj_expentries.elementAt(i);
1793    }
1794    return new ParseException(token, exptokseq, tokenImage);
1795  }
1796
1797  final public void enable_tracing()
1798  {
1799  }
1800
1801  final public void disable_tracing()
1802  {
1803  }
1804
1805  final private void jj_rescan_token()
1806  {
1807    jj_rescan = true;
1808    for (int i = 0; i < 4; i++)
1809    {
1810      JJCalls p = jj_2_rtns[i];
1811      do
1812      {
1813        if (p.gen > jj_gen)
1814        {
1815          jj_la = p.arg;
1816          jj_lastpos = jj_scanpos = p.first;
1817          switch (i)
1818          {
1819            case 0 :
1820              jj_3_1();
1821              break;
1822            case 1 :
1823              jj_3_2();
1824              break;
1825            case 2 :
1826              jj_3_3();
1827              break;
1828            case 3 :
1829              jj_3_4();
1830              break;
1831          }
1832        }
1833        p = p.next;
1834      }
1835      while (p != null);
1836    }
1837    jj_rescan = false;
1838  }
1839
1840  final private void jj_save(int index, int xla)
1841  {
1842    JJCalls p = jj_2_rtns[index];
1843    while (p.gen > jj_gen)
1844    {
1845      if (p.next == null)
1846      {
1847        p = p.next = new JJCalls();
1848        break;
1849      }
1850      p = p.next;
1851    }
1852    p.gen = jj_gen + xla - jj_la;
1853    p.first = token;
1854    p.arg = xla;
1855  }
1856
1857  static final class JJCalls
1858  {
1859    int gen;
1860    Token first;
1861    int arg;
1862    JJCalls next;
1863  }
1864
1865}
Popular Tags