KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > jofti > parser > sql > SQLQueryParser


1 // $ANTLR 2.7.5 (20050128): "SQLquery.g" -> "SQLQueryParser.java"$
2

3 package com.jofti.parser.sql;
4
5 import antlr.TokenBuffer;
6 import antlr.TokenStreamException;
7 import antlr.TokenStreamIOException;
8 import antlr.ANTLRException;
9 import antlr.LLkParser;
10 import antlr.Token;
11 import antlr.TokenStream;
12 import antlr.RecognitionException;
13 import antlr.NoViableAltException;
14 import antlr.MismatchedTokenException;
15 import antlr.SemanticException;
16 import antlr.ParserSharedInputState;
17 import antlr.collections.impl.BitSet;
18 import antlr.collections.AST;
19 import java.util.Hashtable JavaDoc;
20 import antlr.ASTFactory;
21 import antlr.ASTPair;
22 import antlr.collections.impl.ASTArray;
23
24 public class SQLQueryParser extends antlr.LLkParser implements SQLQueryParserTokenTypes
25  {
26
27 protected SQLQueryParser(TokenBuffer tokenBuf, int k) {
28   super(tokenBuf,k);
29   tokenNames = _tokenNames;
30   buildTokenTypeASTClassMap();
31   astFactory = new ASTFactory(getTokenTypeToASTClassMap());
32 }
33
34 public SQLQueryParser(TokenBuffer tokenBuf) {
35   this(tokenBuf,4);
36 }
37
38 protected SQLQueryParser(TokenStream lexer, int k) {
39   super(lexer,k);
40   tokenNames = _tokenNames;
41   buildTokenTypeASTClassMap();
42   astFactory = new ASTFactory(getTokenTypeToASTClassMap());
43 }
44
45 public SQLQueryParser(TokenStream lexer) {
46   this(lexer,4);
47 }
48
49 public SQLQueryParser(ParserSharedInputState state) {
50   super(state,4);
51   tokenNames = _tokenNames;
52   buildTokenTypeASTClassMap();
53   astFactory = new ASTFactory(getTokenTypeToASTClassMap());
54 }
55
56     public final void statement() throws RecognitionException, TokenStreamException {
57         
58         returnAST = null;
59         ASTPair currentAST = new ASTPair();
60         AST statement_AST = null;
61         
62         try { // for error handling
63
selectStatement();
64             astFactory.addASTChild(currentAST, returnAST);
65             match(SEMICOLON);
66             statement_AST = (AST)currentAST.root;
67         }
68         catch (RecognitionException ex) {
69             if (inputState.guessing==0) {
70                 reportError(ex);
71                 recover(ex,_tokenSet_0);
72             } else {
73               throw ex;
74             }
75         }
76         returnAST = statement_AST;
77     }
78     
79     public final void selectStatement() throws RecognitionException, TokenStreamException {
80         
81         returnAST = null;
82         ASTPair currentAST = new ASTPair();
83         AST selectStatement_AST = null;
84         
85         try { // for error handling
86
querySpecification();
87             astFactory.addASTChild(currentAST, returnAST);
88             selectStatement_AST = (AST)currentAST.root;
89         }
90         catch (RecognitionException ex) {
91             if (inputState.guessing==0) {
92                 reportError(ex);
93                 recover(ex,_tokenSet_1);
94             } else {
95               throw ex;
96             }
97         }
98         returnAST = selectStatement_AST;
99     }
100     
101     public final void querySpecification() throws RecognitionException, TokenStreamException {
102         
103         returnAST = null;
104         ASTPair currentAST = new ASTPair();
105         AST querySpecification_AST = null;
106         
107         try { // for error handling
108
AST tmp2_AST = null;
109             tmp2_AST = astFactory.create(LT(1));
110             astFactory.makeASTRoot(currentAST, tmp2_AST);
111             match(SELECT);
112             selectList();
113             astFactory.addASTChild(currentAST, returnAST);
114             {
115             switch ( LA(1)) {
116             case FROM:
117             {
118                 AST tmp3_AST = null;
119                 tmp3_AST = astFactory.create(LT(1));
120                 astFactory.makeASTRoot(currentAST, tmp3_AST);
121                 match(FROM);
122                 nameSpace();
123                 astFactory.addASTChild(currentAST, returnAST);
124                 break;
125             }
126             case WHERE:
127             {
128                 break;
129             }
130             default:
131             {
132                 throw new NoViableAltException(LT(1), getFilename());
133             }
134             }
135             }
136             AST tmp4_AST = null;
137             tmp4_AST = astFactory.create(LT(1));
138             astFactory.makeASTRoot(currentAST, tmp4_AST);
139             match(WHERE);
140             predicateList();
141             astFactory.addASTChild(currentAST, returnAST);
142             {
143             switch ( LA(1)) {
144             case ORDER:
145             {
146                 AST tmp5_AST = null;
147                 tmp5_AST = astFactory.create(LT(1));
148                 astFactory.makeASTRoot(currentAST, tmp5_AST);
149                 match(ORDER);
150                 match(BY);
151                 orderList();
152                 astFactory.addASTChild(currentAST, returnAST);
153                 break;
154             }
155             case SEMICOLON:
156             {
157                 break;
158             }
159             default:
160             {
161                 throw new NoViableAltException(LT(1), getFilename());
162             }
163             }
164             }
165             querySpecification_AST = (AST)currentAST.root;
166         }
167         catch (RecognitionException ex) {
168             if (inputState.guessing==0) {
169                 reportError(ex);
170                 recover(ex,_tokenSet_1);
171             } else {
172               throw ex;
173             }
174         }
175         returnAST = querySpecification_AST;
176     }
177     
178     public final void selectList() throws RecognitionException, TokenStreamException {
179         
180         returnAST = null;
181         ASTPair currentAST = new ASTPair();
182         AST selectList_AST = null;
183         
184         try { // for error handling
185
boolean synPredMatched8 = false;
186             if (((LA(1)==Identifier) && (LA(2)==ALIAS_IDENTIFIER))) {
187                 int _m8 = mark();
188                 synPredMatched8 = true;
189                 inputState.guessing++;
190                 try {
191                     {
192                     className();
193                     }
194                 }
195                 catch (RecognitionException pe) {
196                     synPredMatched8 = false;
197                 }
198                 rewind(_m8);
199                 inputState.guessing--;
200             }
201             if ( synPredMatched8 ) {
202                 fullClassName();
203                 astFactory.addASTChild(currentAST, returnAST);
204                 {
205                 _loop11:
206                 do {
207                     if ((LA(1)==COMMA||LA(1)==Identifier)) {
208                         {
209                         switch ( LA(1)) {
210                         case COMMA:
211                         {
212                             match(COMMA);
213                             break;
214                         }
215                         case Identifier:
216                         {
217                             break;
218                         }
219                         default:
220                         {
221                             throw new NoViableAltException(LT(1), getFilename());
222                         }
223                         }
224                         }
225                         fullClassName();
226                         astFactory.addASTChild(currentAST, returnAST);
227                     }
228                     else {
229                         break _loop11;
230                     }
231                     
232                 } while (true);
233                 }
234                 selectList_AST = (AST)currentAST.root;
235             }
236             else if ((LA(1)==Identifier) && (LA(2)==WHERE||LA(2)==FROM)) {
237                 className();
238                 astFactory.addASTChild(currentAST, returnAST);
239                 selectList_AST = (AST)currentAST.root;
240             }
241             else {
242                 throw new NoViableAltException(LT(1), getFilename());
243             }
244             
245         }
246         catch (RecognitionException ex) {
247             if (inputState.guessing==0) {
248                 reportError(ex);
249                 recover(ex,_tokenSet_2);
250             } else {
251               throw ex;
252             }
253         }
254         returnAST = selectList_AST;
255     }
256     
257     public final void nameSpace() throws RecognitionException, TokenStreamException {
258         
259         returnAST = null;
260         ASTPair currentAST = new ASTPair();
261         AST nameSpace_AST = null;
262         
263         try { // for error handling
264
{
265             int _cnt38=0;
266             _loop38:
267             do {
268                 switch ( LA(1)) {
269                 case FORWARDSLASH:
270                 {
271                     {
272                     AST tmp8_AST = null;
273                     tmp8_AST = astFactory.create(LT(1));
274                     astFactory.addASTChild(currentAST, tmp8_AST);
275                     match(FORWARDSLASH);
276                     }
277                     break;
278                 }
279                 case Identifier:
280                 {
281                     AST tmp9_AST = null;
282                     tmp9_AST = astFactory.create(LT(1));
283                     astFactory.addASTChild(currentAST, tmp9_AST);
284                     match(Identifier);
285                     break;
286                 }
287                 case DASH:
288                 {
289                     {
290                     AST tmp10_AST = null;
291                     tmp10_AST = astFactory.create(LT(1));
292                     astFactory.addASTChild(currentAST, tmp10_AST);
293                     match(DASH);
294                     }
295                     break;
296                 }
297                 case PLUS:
298                 {
299                     {
300                     AST tmp11_AST = null;
301                     tmp11_AST = astFactory.create(LT(1));
302                     astFactory.addASTChild(currentAST, tmp11_AST);
303                     match(PLUS);
304                     }
305                     break;
306                 }
307                 default:
308                 {
309                     if ( _cnt38>=1 ) { break _loop38; } else {throw new NoViableAltException(LT(1), getFilename());}
310                 }
311                 }
312                 _cnt38++;
313             } while (true);
314             }
315             nameSpace_AST = (AST)currentAST.root;
316         }
317         catch (RecognitionException ex) {
318             if (inputState.guessing==0) {
319                 reportError(ex);
320                 recover(ex,_tokenSet_3);
321             } else {
322               throw ex;
323             }
324         }
325         returnAST = nameSpace_AST;
326     }
327     
328     public final void predicateList() throws RecognitionException, TokenStreamException {
329         
330         returnAST = null;
331         ASTPair currentAST = new ASTPair();
332         AST predicateList_AST = null;
333         
334         try { // for error handling
335
subPredicate();
336             astFactory.addASTChild(currentAST, returnAST);
337             {
338             _loop27:
339             do {
340                 if ((LA(1)==AND||LA(1)==OR)) {
341                     {
342                     switch ( LA(1)) {
343                     case AND:
344                     {
345                         AST tmp12_AST = null;
346                         tmp12_AST = astFactory.create(LT(1));
347                         astFactory.addASTChild(currentAST, tmp12_AST);
348                         match(AND);
349                         break;
350                     }
351                     case OR:
352                     {
353                         AST tmp13_AST = null;
354                         tmp13_AST = astFactory.create(LT(1));
355                         astFactory.addASTChild(currentAST, tmp13_AST);
356                         match(OR);
357                         break;
358                     }
359                     default:
360                     {
361                         throw new NoViableAltException(LT(1), getFilename());
362                     }
363                     }
364                     }
365                     subPredicate();
366                     astFactory.addASTChild(currentAST, returnAST);
367                 }
368                 else {
369                     break _loop27;
370                 }
371                 
372             } while (true);
373             }
374             predicateList_AST = (AST)currentAST.root;
375         }
376         catch (RecognitionException ex) {
377             if (inputState.guessing==0) {
378                 reportError(ex);
379                 recover(ex,_tokenSet_4);
380             } else {
381               throw ex;
382             }
383         }
384         returnAST = predicateList_AST;
385     }
386     
387     public final void orderList() throws RecognitionException, TokenStreamException {
388         
389         returnAST = null;
390         ASTPair currentAST = new ASTPair();
391         AST orderList_AST = null;
392         
393         try { // for error handling
394
boolean synPredMatched15 = false;
395             if (((LA(1)==Identifier) && (LA(2)==ASC||LA(2)==DESC||LA(2)==COMMA) && (LA(3)==COMMA||LA(3)==Identifier))) {
396                 int _m15 = mark();
397                 synPredMatched15 = true;
398                 inputState.guessing++;
399                 try {
400                     {
401                     orderName();
402                     }
403                 }
404                 catch (RecognitionException pe) {
405                     synPredMatched15 = false;
406                 }
407                 rewind(_m15);
408                 inputState.guessing--;
409             }
410             if ( synPredMatched15 ) {
411                 orderName();
412                 astFactory.addASTChild(currentAST, returnAST);
413                 {
414                 switch ( LA(1)) {
415                 case ASC:
416                 {
417                     AST tmp14_AST = null;
418                     tmp14_AST = astFactory.create(LT(1));
419                     astFactory.addASTChild(currentAST, tmp14_AST);
420                     match(ASC);
421                     break;
422                 }
423                 case DESC:
424                 {
425                     AST tmp15_AST = null;
426                     tmp15_AST = astFactory.create(LT(1));
427                     astFactory.addASTChild(currentAST, tmp15_AST);
428                     match(DESC);
429                     break;
430                 }
431                 case COMMA:
432                 {
433                     break;
434                 }
435                 default:
436                 {
437                     throw new NoViableAltException(LT(1), getFilename());
438                 }
439                 }
440                 }
441                 {
442                 int _cnt19=0;
443                 _loop19:
444                 do {
445                     if ((LA(1)==COMMA)) {
446                         match(COMMA);
447                         orderName();
448                         astFactory.addASTChild(currentAST, returnAST);
449                         {
450                         switch ( LA(1)) {
451                         case ASC:
452                         {
453                             AST tmp17_AST = null;
454                             tmp17_AST = astFactory.create(LT(1));
455                             astFactory.addASTChild(currentAST, tmp17_AST);
456                             match(ASC);
457                             break;
458                         }
459                         case DESC:
460                         {
461                             AST tmp18_AST = null;
462                             tmp18_AST = astFactory.create(LT(1));
463                             astFactory.addASTChild(currentAST, tmp18_AST);
464                             match(DESC);
465                             break;
466                         }
467                         case COMMA:
468                         case SEMICOLON:
469                         {
470                             break;
471                         }
472                         default:
473                         {
474                             throw new NoViableAltException(LT(1), getFilename());
475                         }
476                         }
477                         }
478                     }
479                     else {
480                         if ( _cnt19>=1 ) { break _loop19; } else {throw new NoViableAltException(LT(1), getFilename());}
481                     }
482                     
483                     _cnt19++;
484                 } while (true);
485                 }
486                 orderList_AST = (AST)currentAST.root;
487             }
488             else if ((LA(1)==Identifier) && (LA(2)==ASC||LA(2)==DESC||LA(2)==SEMICOLON) && (LA(3)==EOF||LA(3)==SEMICOLON)) {
489                 orderName();
490                 astFactory.addASTChild(currentAST, returnAST);
491                 {
492                 switch ( LA(1)) {
493                 case ASC:
494                 {
495                     AST tmp19_AST = null;
496                     tmp19_AST = astFactory.create(LT(1));
497                     astFactory.addASTChild(currentAST, tmp19_AST);
498                     match(ASC);
499                     break;
500                 }
501                 case DESC:
502                 {
503                     AST tmp20_AST = null;
504                     tmp20_AST = astFactory.create(LT(1));
505                     astFactory.addASTChild(currentAST, tmp20_AST);
506                     match(DESC);
507                     break;
508                 }
509                 case SEMICOLON:
510                 {
511                     break;
512                 }
513                 default:
514                 {
515                     throw new NoViableAltException(LT(1), getFilename());
516                 }
517                 }
518                 }
519                 orderList_AST = (AST)currentAST.root;
520             }
521             else {
522                 throw new NoViableAltException(LT(1), getFilename());
523             }
524             
525         }
526         catch (RecognitionException ex) {
527             if (inputState.guessing==0) {
528                 reportError(ex);
529                 recover(ex,_tokenSet_1);
530             } else {
531               throw ex;
532             }
533         }
534         returnAST = orderList_AST;
535     }
536     
537     public final void className() throws RecognitionException, TokenStreamException {
538         
539         returnAST = null;
540         ASTPair currentAST = new ASTPair();
541         AST className_AST = null;
542         
543         try { // for error handling
544
AST tmp21_AST = null;
545             tmp21_AST = astFactory.create(LT(1));
546             astFactory.addASTChild(currentAST, tmp21_AST);
547             match(Identifier);
548             className_AST = (AST)currentAST.root;
549         }
550         catch (RecognitionException ex) {
551             if (inputState.guessing==0) {
552                 reportError(ex);
553                 recover(ex,_tokenSet_5);
554             } else {
555               throw ex;
556             }
557         }
558         returnAST = className_AST;
559     }
560     
561     public final void fullClassName() throws RecognitionException, TokenStreamException {
562         
563         returnAST = null;
564         ASTPair currentAST = new ASTPair();
565         AST fullClassName_AST = null;
566         
567         try { // for error handling
568
className();
569             astFactory.addASTChild(currentAST, returnAST);
570             AST tmp22_AST = null;
571             tmp22_AST = astFactory.create(LT(1));
572             astFactory.makeASTRoot(currentAST, tmp22_AST);
573             match(ALIAS_IDENTIFIER);
574             aliasName();
575             astFactory.addASTChild(currentAST, returnAST);
576             fullClassName_AST = (AST)currentAST.root;
577         }
578         catch (RecognitionException ex) {
579             if (inputState.guessing==0) {
580                 reportError(ex);
581                 recover(ex,_tokenSet_6);
582             } else {
583               throw ex;
584             }
585         }
586         returnAST = fullClassName_AST;
587     }
588     
589     public final void whereClause() throws RecognitionException, TokenStreamException {
590         
591         returnAST = null;
592         ASTPair currentAST = new ASTPair();
593         AST whereClause_AST = null;
594         
595         try { // for error handling
596
predicateList();
597             astFactory.addASTChild(currentAST, returnAST);
598             whereClause_AST = (AST)currentAST.root;
599         }
600         catch (RecognitionException ex) {
601             if (inputState.guessing==0) {
602                 reportError(ex);
603                 recover(ex,_tokenSet_0);
604             } else {
605               throw ex;
606             }
607         }
608         returnAST = whereClause_AST;
609     }
610     
611     public final void orderName() throws RecognitionException, TokenStreamException {
612         
613         returnAST = null;
614         ASTPair currentAST = new ASTPair();
615         AST orderName_AST = null;
616         
617         try { // for error handling
618
AST tmp23_AST = null;
619             tmp23_AST = astFactory.create(LT(1));
620             astFactory.addASTChild(currentAST, tmp23_AST);
621             match(Identifier);
622             orderName_AST = (AST)currentAST.root;
623         }
624         catch (RecognitionException ex) {
625             if (inputState.guessing==0) {
626                 reportError(ex);
627                 recover(ex,_tokenSet_7);
628             } else {
629               throw ex;
630             }
631         }
632         returnAST = orderName_AST;
633     }
634     
635     public final void aliasName() throws RecognitionException, TokenStreamException {
636         
637         returnAST = null;
638         ASTPair currentAST = new ASTPair();
639         AST aliasName_AST = null;
640         
641         try { // for error handling
642
AST tmp24_AST = null;
643             tmp24_AST = astFactory.create(LT(1));
644             astFactory.addASTChild(currentAST, tmp24_AST);
645             match(Identifier);
646             aliasName_AST = (AST)currentAST.root;
647         }
648         catch (RecognitionException ex) {
649             if (inputState.guessing==0) {
650                 reportError(ex);
651                 recover(ex,_tokenSet_6);
652             } else {
653               throw ex;
654             }
655         }
656         returnAST = aliasName_AST;
657     }
658     
659     public final void subPredicate() throws RecognitionException, TokenStreamException {
660         
661         returnAST = null;
662         ASTPair currentAST = new ASTPair();
663         AST subPredicate_AST = null;
664         
665         try { // for error handling
666
switch ( LA(1)) {
667             case LPAREN:
668             {
669                 AST tmp25_AST = null;
670                 tmp25_AST = astFactory.create(LT(1));
671                 astFactory.addASTChild(currentAST, tmp25_AST);
672                 match(LPAREN);
673                 predicateList();
674                 astFactory.addASTChild(currentAST, returnAST);
675                 AST tmp26_AST = null;
676                 tmp26_AST = astFactory.create(LT(1));
677                 astFactory.addASTChild(currentAST, tmp26_AST);
678                 match(RPAREN);
679                 subPredicate_AST = (AST)currentAST.root;
680                 break;
681             }
682             case VALUE:
683             case Identifier:
684             {
685                 predicate();
686                 astFactory.addASTChild(currentAST, returnAST);
687                 subPredicate_AST = (AST)currentAST.root;
688                 break;
689             }
690             default:
691             {
692                 throw new NoViableAltException(LT(1), getFilename());
693             }
694             }
695         }
696         catch (RecognitionException ex) {
697             if (inputState.guessing==0) {
698                 reportError(ex);
699                 recover(ex,_tokenSet_8);
700             } else {
701               throw ex;
702             }
703         }
704         returnAST = subPredicate_AST;
705     }
706     
707     public final void predicate() throws RecognitionException, TokenStreamException {
708         
709         returnAST = null;
710         ASTPair currentAST = new ASTPair();
711         AST predicate_AST = null;
712         
713         try { // for error handling
714
predicateName();
715             astFactory.addASTChild(currentAST, returnAST);
716             {
717             switch ( LA(1)) {
718             case ASSIGNEQUAL:
719             {
720                 AST tmp27_AST = null;
721                 tmp27_AST = astFactory.create(LT(1));
722                 astFactory.makeASTRoot(currentAST, tmp27_AST);
723                 match(ASSIGNEQUAL);
724                 break;
725             }
726             case NOTEQUAL2:
727             {
728                 AST tmp28_AST = null;
729                 tmp28_AST = astFactory.create(LT(1));
730                 astFactory.makeASTRoot(currentAST, tmp28_AST);
731                 match(NOTEQUAL2);
732                 break;
733             }
734             case NOTEQUAL1:
735             {
736                 AST tmp29_AST = null;
737                 tmp29_AST = astFactory.create(LT(1));
738                 astFactory.makeASTRoot(currentAST, tmp29_AST);
739                 match(NOTEQUAL1);
740                 break;
741             }
742             case LESSTHANOREQUALTO1:
743             {
744                 AST tmp30_AST = null;
745                 tmp30_AST = astFactory.create(LT(1));
746                 astFactory.makeASTRoot(currentAST, tmp30_AST);
747                 match(LESSTHANOREQUALTO1);
748                 break;
749             }
750             case LESSTHANOREQUALTO2:
751             {
752                 AST tmp31_AST = null;
753                 tmp31_AST = astFactory.create(LT(1));
754                 astFactory.makeASTRoot(currentAST, tmp31_AST);
755                 match(LESSTHANOREQUALTO2);
756                 break;
757             }
758             case LESSTHAN:
759             {
760                 AST tmp32_AST = null;
761                 tmp32_AST = astFactory.create(LT(1));
762                 astFactory.makeASTRoot(currentAST, tmp32_AST);
763                 match(LESSTHAN);
764                 break;
765             }
766             case GREATERTHANOREQUALTO1:
767             {
768                 AST tmp33_AST = null;
769                 tmp33_AST = astFactory.create(LT(1));
770                 astFactory.makeASTRoot(currentAST, tmp33_AST);
771                 match(GREATERTHANOREQUALTO1);
772                 break;
773             }
774             case GREATERTHANOREQUALTO2:
775             {
776                 AST tmp34_AST = null;
777                 tmp34_AST = astFactory.create(LT(1));
778                 astFactory.makeASTRoot(currentAST, tmp34_AST);
779                 match(GREATERTHANOREQUALTO2);
780                 break;
781             }
782             case GREATERTHAN:
783             {
784                 AST tmp35_AST = null;
785                 tmp35_AST = astFactory.create(LT(1));
786                 astFactory.makeASTRoot(currentAST, tmp35_AST);
787                 match(GREATERTHAN);
788                 break;
789             }
790             case IS:
791             {
792                 AST tmp36_AST = null;
793                 tmp36_AST = astFactory.create(LT(1));
794                 astFactory.makeASTRoot(currentAST, tmp36_AST);
795                 match(IS);
796                 break;
797             }
798             case NOT:
799             {
800                 AST tmp37_AST = null;
801                 tmp37_AST = astFactory.create(LT(1));
802                 astFactory.makeASTRoot(currentAST, tmp37_AST);
803                 match(NOT);
804                 break;
805             }
806             case LIKE:
807             {
808                 AST tmp38_AST = null;
809                 tmp38_AST = astFactory.create(LT(1));
810                 astFactory.makeASTRoot(currentAST, tmp38_AST);
811                 match(LIKE);
812                 break;
813             }
814             case IN:
815             {
816                 AST tmp39_AST = null;
817                 tmp39_AST = astFactory.create(LT(1));
818                 astFactory.makeASTRoot(currentAST, tmp39_AST);
819                 match(IN);
820                 break;
821             }
822             default:
823             {
824                 throw new NoViableAltException(LT(1), getFilename());
825             }
826             }
827             }
828             predicateParenValue();
829             astFactory.addASTChild(currentAST, returnAST);
830             predicate_AST = (AST)currentAST.root;
831         }
832         catch (RecognitionException ex) {
833             if (inputState.guessing==0) {
834                 reportError(ex);
835                 recover(ex,_tokenSet_8);
836             } else {
837               throw ex;
838             }
839         }
840         returnAST = predicate_AST;
841     }
842     
843     public final void predicateName() throws RecognitionException, TokenStreamException {
844         
845         returnAST = null;
846         ASTPair currentAST = new ASTPair();
847         AST predicateName_AST = null;
848         
849         try { // for error handling
850
switch ( LA(1)) {
851             case Identifier:
852             {
853                 AST tmp40_AST = null;
854                 tmp40_AST = astFactory.create(LT(1));
855                 astFactory.addASTChild(currentAST, tmp40_AST);
856                 match(Identifier);
857                 predicateName_AST = (AST)currentAST.root;
858                 break;
859             }
860             case VALUE:
861             {
862                 AST tmp41_AST = null;
863                 tmp41_AST = astFactory.create(LT(1));
864                 astFactory.addASTChild(currentAST, tmp41_AST);
865                 match(VALUE);
866                 predicateName_AST = (AST)currentAST.root;
867                 break;
868             }
869             default:
870             {
871                 throw new NoViableAltException(LT(1), getFilename());
872             }
873             }
874         }
875         catch (RecognitionException ex) {
876             if (inputState.guessing==0) {
877                 reportError(ex);
878                 recover(ex,_tokenSet_9);
879             } else {
880               throw ex;
881             }
882         }
883         returnAST = predicateName_AST;
884     }
885     
886     public final void predicateParenValue() throws RecognitionException, TokenStreamException {
887         
888         returnAST = null;
889         ASTPair currentAST = new ASTPair();
890         AST predicateParenValue_AST = null;
891         
892         try { // for error handling
893
switch ( LA(1)) {
894             case LPAREN:
895             {
896                 AST tmp42_AST = null;
897                 tmp42_AST = astFactory.create(LT(1));
898                 astFactory.addASTChild(currentAST, tmp42_AST);
899                 match(LPAREN);
900                 {
901                 _loop43:
902                 do {
903                     switch ( LA(1)) {
904                     case SELECT:
905                     case WHERE:
906                     case ALIAS_IDENTIFIER:
907                     case AND:
908                     case OR:
909                     case NOT:
910                     case VALUE:
911                     case FROM:
912                     case IS:
913                     case LIKE:
914                     case IN:
915                     case NAMESPACE:
916                     case Identifier:
917                     case PredicateIdentifier:
918                     {
919                         predicateValue();
920                         astFactory.addASTChild(currentAST, returnAST);
921                         break;
922                     }
923                     case COMMA:
924                     {
925                         AST tmp43_AST = null;
926                         tmp43_AST = astFactory.create(LT(1));
927                         astFactory.addASTChild(currentAST, tmp43_AST);
928                         match(COMMA);
929                         break;
930                     }
931                     default:
932                     {
933                         break _loop43;
934                     }
935                     }
936                 } while (true);
937                 }
938                 AST tmp44_AST = null;
939                 tmp44_AST = astFactory.create(LT(1));
940                 astFactory.addASTChild(currentAST, tmp44_AST);
941                 match(RPAREN);
942                 predicateParenValue_AST = (AST)currentAST.root;
943                 break;
944             }
945             case SELECT:
946             case WHERE:
947             case ALIAS_IDENTIFIER:
948             case AND:
949             case OR:
950             case NOT:
951             case VALUE:
952             case FROM:
953             case IS:
954             case LIKE:
955             case IN:
956             case NAMESPACE:
957             case Identifier:
958             case PredicateIdentifier:
959             {
960                 predicateValue();
961                 astFactory.addASTChild(currentAST, returnAST);
962                 predicateParenValue_AST = (AST)currentAST.root;
963                 break;
964             }
965             default:
966             {
967                 throw new NoViableAltException(LT(1), getFilename());
968             }
969             }
970         }
971         catch (RecognitionException ex) {
972             if (inputState.guessing==0) {
973                 reportError(ex);
974                 recover(ex,_tokenSet_8);
975             } else {
976               throw ex;
977             }
978         }
979         returnAST = predicateParenValue_AST;
980     }
981     
982     public final void predicateValue() throws RecognitionException, TokenStreamException {
983         
984         returnAST = null;
985         ASTPair currentAST = new ASTPair();
986         AST predicateValue_AST = null;
987         
988         try { // for error handling
989
switch ( LA(1)) {
990             case PredicateIdentifier:
991             {
992                 AST tmp45_AST = null;
993                 tmp45_AST = astFactory.create(LT(1));
994                 astFactory.addASTChild(currentAST, tmp45_AST);
995                 match(PredicateIdentifier);
996                 predicateValue_AST = (AST)currentAST.root;
997                 break;
998             }
999             case Identifier:
1000            {
1001                AST tmp46_AST = null;
1002                tmp46_AST = astFactory.create(LT(1));
1003                astFactory.addASTChild(currentAST, tmp46_AST);
1004                match(Identifier);
1005                predicateValue_AST = (AST)currentAST.root;
1006                break;
1007            }
1008            case SELECT:
1009            {
1010                AST tmp47_AST = null;
1011                tmp47_AST = astFactory.create(LT(1));
1012                astFactory.addASTChild(currentAST, tmp47_AST);
1013                match(SELECT);
1014                predicateValue_AST = (AST)currentAST.root;
1015                break;
1016            }
1017            case FROM:
1018            {
1019                AST tmp48_AST = null;
1020                tmp48_AST = astFactory.create(LT(1));
1021                astFactory.addASTChild(currentAST, tmp48_AST);
1022                match(FROM);
1023                predicateValue_AST = (AST)currentAST.root;
1024                break;
1025            }
1026            case WHERE:
1027            {
1028                AST tmp49_AST = null;
1029                tmp49_AST = astFactory.create(LT(1));
1030                astFactory.addASTChild(currentAST, tmp49_AST);
1031                match(WHERE);
1032                predicateValue_AST = (AST)currentAST.root;
1033                break;
1034            }
1035            case ALIAS_IDENTIFIER:
1036            {
1037                AST tmp50_AST = null;
1038                tmp50_AST = astFactory.create(LT(1));
1039                astFactory.addASTChild(currentAST, tmp50_AST);
1040                match(ALIAS_IDENTIFIER);
1041                predicateValue_AST = (AST)currentAST.root;
1042                break;
1043            }
1044            case AND:
1045            {
1046                AST tmp51_AST = null;
1047                tmp51_AST = astFactory.create(LT(1));
1048                astFactory.addASTChild(currentAST, tmp51_AST);
1049                match(AND);
1050                predicateValue_AST = (AST)currentAST.root;
1051                break;
1052            }
1053            case OR:
1054            {
1055                AST tmp52_AST = null;
1056                tmp52_AST = astFactory.create(LT(1));
1057                astFactory.addASTChild(currentAST, tmp52_AST);
1058                match(OR);
1059                predicateValue_AST = (AST)currentAST.root;
1060                break;
1061            }
1062            case NOT:
1063            {
1064                AST tmp53_AST = null;
1065                tmp53_AST = astFactory.create(LT(1));
1066                astFactory.addASTChild(currentAST, tmp53_AST);
1067                match(NOT);
1068                predicateValue_AST = (AST)currentAST.root;
1069                break;
1070            }
1071            case VALUE:
1072            {
1073                AST tmp54_AST = null;
1074                tmp54_AST = astFactory.create(LT(1));
1075                astFactory.addASTChild(currentAST, tmp54_AST);
1076                match(VALUE);
1077                predicateValue_AST = (AST)currentAST.root;
1078                break;
1079            }
1080            case IS:
1081            {
1082                AST tmp55_AST = null;
1083                tmp55_AST = astFactory.create(LT(1));
1084                astFactory.addASTChild(currentAST, tmp55_AST);
1085                match(IS);
1086                predicateValue_AST = (AST)currentAST.root;
1087                break;
1088            }
1089            case LIKE:
1090            {
1091                AST tmp56_AST = null;
1092                tmp56_AST = astFactory.create(LT(1));
1093                astFactory.addASTChild(currentAST, tmp56_AST);
1094                match(LIKE);
1095                predicateValue_AST = (AST)currentAST.root;
1096                break;
1097            }
1098            case IN:
1099            {
1100                AST tmp57_AST = null;
1101                tmp57_AST = astFactory.create(LT(1));
1102                astFactory.addASTChild(currentAST, tmp57_AST);
1103                match(IN);
1104                predicateValue_AST = (AST)currentAST.root;
1105                break;
1106            }
1107            case NAMESPACE:
1108            {
1109                AST tmp58_AST = null;
1110                tmp58_AST = astFactory.create(LT(1));
1111                astFactory.addASTChild(currentAST, tmp58_AST);
1112                match(NAMESPACE);
1113                predicateValue_AST = (AST)currentAST.root;
1114                break;
1115            }
1116            default:
1117            {
1118                throw new NoViableAltException(LT(1), getFilename());
1119            }
1120            }
1121        }
1122        catch (RecognitionException ex) {
1123            if (inputState.guessing==0) {
1124                reportError(ex);
1125                recover(ex,_tokenSet_10);
1126            } else {
1127              throw ex;
1128            }
1129        }
1130        returnAST = predicateValue_AST;
1131    }
1132    
1133    public final void comparisonOperator() throws RecognitionException, TokenStreamException {
1134        
1135        returnAST = null;
1136        ASTPair currentAST = new ASTPair();
1137        AST comparisonOperator_AST = null;
1138        
1139        try { // for error handling
1140
switch ( LA(1)) {
1141            case ASSIGNEQUAL:
1142            {
1143                AST tmp59_AST = null;
1144                tmp59_AST = astFactory.create(LT(1));
1145                astFactory.addASTChild(currentAST, tmp59_AST);
1146                match(ASSIGNEQUAL);
1147                comparisonOperator_AST = (AST)currentAST.root;
1148                break;
1149            }
1150            case NOTEQUAL1:
1151            {
1152                AST tmp60_AST = null;
1153                tmp60_AST = astFactory.create(LT(1));
1154                astFactory.addASTChild(currentAST, tmp60_AST);
1155                match(NOTEQUAL1);
1156                comparisonOperator_AST = (AST)currentAST.root;
1157                break;
1158            }
1159            case NOTEQUAL2:
1160            {
1161                AST tmp61_AST = null;
1162                tmp61_AST = astFactory.create(LT(1));
1163                astFactory.addASTChild(currentAST, tmp61_AST);
1164                match(NOTEQUAL2);
1165                comparisonOperator_AST = (AST)currentAST.root;
1166                break;
1167            }
1168            case LESSTHANOREQUALTO1:
1169            {
1170                AST tmp62_AST = null;
1171                tmp62_AST = astFactory.create(LT(1));
1172                astFactory.addASTChild(currentAST, tmp62_AST);
1173                match(LESSTHANOREQUALTO1);
1174                comparisonOperator_AST = (AST)currentAST.root;
1175                break;
1176            }
1177            case LESSTHANOREQUALTO2:
1178            {
1179                AST tmp63_AST = null;
1180                tmp63_AST = astFactory.create(LT(1));
1181                astFactory.addASTChild(currentAST, tmp63_AST);
1182                match(LESSTHANOREQUALTO2);
1183                comparisonOperator_AST = (AST)currentAST.root;
1184                break;
1185            }
1186            case LESSTHAN:
1187            {
1188                AST tmp64_AST = null;
1189                tmp64_AST = astFactory.create(LT(1));
1190                astFactory.addASTChild(currentAST, tmp64_AST);
1191                match(LESSTHAN);
1192                comparisonOperator_AST = (AST)currentAST.root;
1193                break;
1194            }
1195            case GREATERTHANOREQUALTO1:
1196            {
1197                AST tmp65_AST = null;
1198                tmp65_AST = astFactory.create(LT(1));
1199                astFactory.addASTChild(currentAST, tmp65_AST);
1200                match(GREATERTHANOREQUALTO1);
1201                comparisonOperator_AST = (AST)currentAST.root;
1202                break;
1203            }
1204            case GREATERTHANOREQUALTO2:
1205            {
1206                AST tmp66_AST = null;
1207                tmp66_AST = astFactory.create(LT(1));
1208                astFactory.addASTChild(currentAST, tmp66_AST);
1209                match(GREATERTHANOREQUALTO2);
1210                comparisonOperator_AST = (AST)currentAST.root;
1211                break;
1212            }
1213            case GREATERTHAN:
1214            {
1215                AST tmp67_AST = null;
1216                tmp67_AST = astFactory.create(LT(1));
1217                astFactory.addASTChild(currentAST, tmp67_AST);
1218                match(GREATERTHAN);
1219                comparisonOperator_AST = (AST)currentAST.root;
1220                break;
1221            }
1222            default:
1223            {
1224                throw new NoViableAltException(LT(1), getFilename());
1225            }
1226            }
1227        }
1228        catch (RecognitionException ex) {
1229            if (inputState.guessing==0) {
1230                reportError(ex);
1231                recover(ex,_tokenSet_0);
1232            } else {
1233              throw ex;
1234            }
1235        }
1236        returnAST = comparisonOperator_AST;
1237    }
1238    
1239    public final void logicalOperator() throws RecognitionException, TokenStreamException {
1240        
1241        returnAST = null;
1242        ASTPair currentAST = new ASTPair();
1243        AST logicalOperator_AST = null;
1244        
1245        try { // for error handling
1246
switch ( LA(1)) {
1247            case AND:
1248            {
1249                AST tmp68_AST = null;
1250                tmp68_AST = astFactory.create(LT(1));
1251                astFactory.addASTChild(currentAST, tmp68_AST);
1252                match(AND);
1253                logicalOperator_AST = (AST)currentAST.root;
1254                break;
1255            }
1256            case OR:
1257            {
1258                AST tmp69_AST = null;
1259                tmp69_AST = astFactory.create(LT(1));
1260                astFactory.addASTChild(currentAST, tmp69_AST);
1261                match(OR);
1262                logicalOperator_AST = (AST)currentAST.root;
1263                break;
1264            }
1265            default:
1266            {
1267                throw new NoViableAltException(LT(1), getFilename());
1268            }
1269            }
1270        }
1271        catch (RecognitionException ex) {
1272            if (inputState.guessing==0) {
1273                reportError(ex);
1274                recover(ex,_tokenSet_0);
1275            } else {
1276              throw ex;
1277            }
1278        }
1279        returnAST = logicalOperator_AST;
1280    }
1281    
1282    
1283    public static final String JavaDoc[] _tokenNames = {
1284        "<0>",
1285        "EOF",
1286        "<2>",
1287        "NULL_TREE_LOOKAHEAD",
1288        "\"select\"",
1289        "\"where\"",
1290        "\"as\"",
1291        "\"and\"",
1292        "\"or\"",
1293        "\"not\"",
1294        "\"value\"",
1295        "\"from\"",
1296        "\"is\"",
1297        "\"like\"",
1298        "\"in\"",
1299        "\"namespace\"",
1300        "\"order\"",
1301        "\"by\"",
1302        "\"asc\"",
1303        "\"desc\"",
1304        "PACKAGE_SEPERATOR",
1305        "COMMA",
1306        "SEMICOLON",
1307        "LPAREN",
1308        "RPAREN",
1309        "SINGLE_QUOTE",
1310        "BACKSLASH",
1311        "FORWARDSLASH",
1312        "DASH",
1313        "PLUS",
1314        "ASSIGNEQUAL",
1315        "NOTEQUAL1",
1316        "NOTEQUAL2",
1317        "LESSTHANOREQUALTO1",
1318        "LESSTHANOREQUALTO2",
1319        "LESSTHAN",
1320        "GREATERTHANOREQUALTO1",
1321        "GREATERTHANOREQUALTO2",
1322        "GREATERTHAN",
1323        "LBRACKET",
1324        "RBRACKET",
1325        "Letter",
1326        "Digit",
1327        "SPACE",
1328        "Identifier",
1329        "ESC",
1330        "NONESC",
1331        "PredicateIdentifier",
1332        "WS"
1333    };
1334    
1335    protected void buildTokenTypeASTClassMap() {
1336        tokenTypeToASTClassMap=null;
1337    };
1338    
1339    private static final long[] mk_tokenSet_0() {
1340        long[] data = { 2L, 0L};
1341        return data;
1342    }
1343    public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0());
1344    private static final long[] mk_tokenSet_1() {
1345        long[] data = { 4194304L, 0L};
1346        return data;
1347    }
1348    public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1());
1349    private static final long[] mk_tokenSet_2() {
1350        long[] data = { 2080L, 0L};
1351        return data;
1352    }
1353    public static final BitSet _tokenSet_2 = new BitSet(mk_tokenSet_2());
1354    private static final long[] mk_tokenSet_3() {
1355        long[] data = { 32L, 0L};
1356        return data;
1357    }
1358    public static final BitSet _tokenSet_3 = new BitSet(mk_tokenSet_3());
1359    private static final long[] mk_tokenSet_4() {
1360        long[] data = { 21037058L, 0L};
1361        return data;
1362    }
1363    public static final BitSet _tokenSet_4 = new BitSet(mk_tokenSet_4());
1364    private static final long[] mk_tokenSet_5() {
1365        long[] data = { 2144L, 0L};
1366        return data;
1367    }
1368    public static final BitSet _tokenSet_5 = new BitSet(mk_tokenSet_5());
1369    private static final long[] mk_tokenSet_6() {
1370        long[] data = { 17592188143648L, 0L};
1371        return data;
1372    }
1373    public static final BitSet _tokenSet_6 = new BitSet(mk_tokenSet_6());
1374    private static final long[] mk_tokenSet_7() {
1375        long[] data = { 7077888L, 0L};
1376        return data;
1377    }
1378    public static final BitSet _tokenSet_7 = new BitSet(mk_tokenSet_7());
1379    private static final long[] mk_tokenSet_8() {
1380        long[] data = { 21037442L, 0L};
1381        return data;
1382    }
1383    public static final BitSet _tokenSet_8 = new BitSet(mk_tokenSet_8());
1384    private static final long[] mk_tokenSet_9() {
1385        long[] data = { 548682101248L, 0L};
1386        return data;
1387    }
1388    public static final BitSet _tokenSet_9 = new BitSet(mk_tokenSet_9());
1389    private static final long[] mk_tokenSet_10() {
1390        long[] data = { 158329697599474L, 0L};
1391        return data;
1392    }
1393    public static final BitSet _tokenSet_10 = new BitSet(mk_tokenSet_10());
1394    
1395    }
1396
Popular Tags