0001: // $ANTLR 2.7.5 (20050128): "SQLquery.g" -> "SQLQueryParser.java"$
0002:
0003: package com.jofti.parser.sql;
0004:
0005: import antlr.TokenBuffer;
0006: import antlr.TokenStreamException;
0007: import antlr.TokenStreamIOException;
0008: import antlr.ANTLRException;
0009: import antlr.LLkParser;
0010: import antlr.Token;
0011: import antlr.TokenStream;
0012: import antlr.RecognitionException;
0013: import antlr.NoViableAltException;
0014: import antlr.MismatchedTokenException;
0015: import antlr.SemanticException;
0016: import antlr.ParserSharedInputState;
0017: import antlr.collections.impl.BitSet;
0018: import antlr.collections.AST;
0019: import java.util.Hashtable;
0020: import antlr.ASTFactory;
0021: import antlr.ASTPair;
0022: import antlr.collections.impl.ASTArray;
0023:
0024: public class SQLQueryParser extends antlr.LLkParser implements
0025: SQLQueryParserTokenTypes {
0026:
0027: protected SQLQueryParser(TokenBuffer tokenBuf, int k) {
0028: super (tokenBuf, k);
0029: tokenNames = _tokenNames;
0030: buildTokenTypeASTClassMap();
0031: astFactory = new ASTFactory(getTokenTypeToASTClassMap());
0032: }
0033:
0034: public SQLQueryParser(TokenBuffer tokenBuf) {
0035: this (tokenBuf, 4);
0036: }
0037:
0038: protected SQLQueryParser(TokenStream lexer, int k) {
0039: super (lexer, k);
0040: tokenNames = _tokenNames;
0041: buildTokenTypeASTClassMap();
0042: astFactory = new ASTFactory(getTokenTypeToASTClassMap());
0043: }
0044:
0045: public SQLQueryParser(TokenStream lexer) {
0046: this (lexer, 4);
0047: }
0048:
0049: public SQLQueryParser(ParserSharedInputState state) {
0050: super (state, 4);
0051: tokenNames = _tokenNames;
0052: buildTokenTypeASTClassMap();
0053: astFactory = new ASTFactory(getTokenTypeToASTClassMap());
0054: }
0055:
0056: public final void statement() throws RecognitionException,
0057: TokenStreamException {
0058:
0059: returnAST = null;
0060: ASTPair currentAST = new ASTPair();
0061: AST statement_AST = null;
0062:
0063: try { // for error handling
0064: selectStatement();
0065: astFactory.addASTChild(currentAST, returnAST);
0066: match(SEMICOLON);
0067: statement_AST = (AST) currentAST.root;
0068: } catch (RecognitionException ex) {
0069: if (inputState.guessing == 0) {
0070: reportError(ex);
0071: recover(ex, _tokenSet_0);
0072: } else {
0073: throw ex;
0074: }
0075: }
0076: returnAST = statement_AST;
0077: }
0078:
0079: public final void selectStatement() throws RecognitionException,
0080: TokenStreamException {
0081:
0082: returnAST = null;
0083: ASTPair currentAST = new ASTPair();
0084: AST selectStatement_AST = null;
0085:
0086: try { // for error handling
0087: querySpecification();
0088: astFactory.addASTChild(currentAST, returnAST);
0089: selectStatement_AST = (AST) currentAST.root;
0090: } catch (RecognitionException ex) {
0091: if (inputState.guessing == 0) {
0092: reportError(ex);
0093: recover(ex, _tokenSet_1);
0094: } else {
0095: throw ex;
0096: }
0097: }
0098: returnAST = selectStatement_AST;
0099: }
0100:
0101: public final void querySpecification() throws RecognitionException,
0102: TokenStreamException {
0103:
0104: returnAST = null;
0105: ASTPair currentAST = new ASTPair();
0106: AST querySpecification_AST = null;
0107:
0108: try { // for error handling
0109: AST tmp2_AST = null;
0110: tmp2_AST = astFactory.create(LT(1));
0111: astFactory.makeASTRoot(currentAST, tmp2_AST);
0112: match(SELECT);
0113: selectList();
0114: astFactory.addASTChild(currentAST, returnAST);
0115: {
0116: switch (LA(1)) {
0117: case FROM: {
0118: AST tmp3_AST = null;
0119: tmp3_AST = astFactory.create(LT(1));
0120: astFactory.makeASTRoot(currentAST, tmp3_AST);
0121: match(FROM);
0122: nameSpace();
0123: astFactory.addASTChild(currentAST, returnAST);
0124: break;
0125: }
0126: case WHERE: {
0127: break;
0128: }
0129: default: {
0130: throw new NoViableAltException(LT(1), getFilename());
0131: }
0132: }
0133: }
0134: AST tmp4_AST = null;
0135: tmp4_AST = astFactory.create(LT(1));
0136: astFactory.makeASTRoot(currentAST, tmp4_AST);
0137: match(WHERE);
0138: predicateList();
0139: astFactory.addASTChild(currentAST, returnAST);
0140: {
0141: switch (LA(1)) {
0142: case ORDER: {
0143: AST tmp5_AST = null;
0144: tmp5_AST = astFactory.create(LT(1));
0145: astFactory.makeASTRoot(currentAST, tmp5_AST);
0146: match(ORDER);
0147: match(BY);
0148: orderList();
0149: astFactory.addASTChild(currentAST, returnAST);
0150: break;
0151: }
0152: case SEMICOLON: {
0153: break;
0154: }
0155: default: {
0156: throw new NoViableAltException(LT(1), getFilename());
0157: }
0158: }
0159: }
0160: querySpecification_AST = (AST) currentAST.root;
0161: } catch (RecognitionException ex) {
0162: if (inputState.guessing == 0) {
0163: reportError(ex);
0164: recover(ex, _tokenSet_1);
0165: } else {
0166: throw ex;
0167: }
0168: }
0169: returnAST = querySpecification_AST;
0170: }
0171:
0172: public final void selectList() throws RecognitionException,
0173: TokenStreamException {
0174:
0175: returnAST = null;
0176: ASTPair currentAST = new ASTPair();
0177: AST selectList_AST = null;
0178:
0179: try { // for error handling
0180: boolean synPredMatched8 = false;
0181: if (((LA(1) == Identifier) && (LA(2) == ALIAS_IDENTIFIER))) {
0182: int _m8 = mark();
0183: synPredMatched8 = true;
0184: inputState.guessing++;
0185: try {
0186: {
0187: className();
0188: }
0189: } catch (RecognitionException pe) {
0190: synPredMatched8 = false;
0191: }
0192: rewind(_m8);
0193: inputState.guessing--;
0194: }
0195: if (synPredMatched8) {
0196: fullClassName();
0197: astFactory.addASTChild(currentAST, returnAST);
0198: {
0199: _loop11: do {
0200: if ((LA(1) == COMMA || LA(1) == Identifier)) {
0201: {
0202: switch (LA(1)) {
0203: case COMMA: {
0204: match(COMMA);
0205: break;
0206: }
0207: case Identifier: {
0208: break;
0209: }
0210: default: {
0211: throw new NoViableAltException(
0212: LT(1), getFilename());
0213: }
0214: }
0215: }
0216: fullClassName();
0217: astFactory.addASTChild(currentAST,
0218: returnAST);
0219: } else {
0220: break _loop11;
0221: }
0222:
0223: } while (true);
0224: }
0225: selectList_AST = (AST) currentAST.root;
0226: } else if ((LA(1) == Identifier)
0227: && (LA(2) == WHERE || LA(2) == FROM)) {
0228: className();
0229: astFactory.addASTChild(currentAST, returnAST);
0230: selectList_AST = (AST) currentAST.root;
0231: } else {
0232: throw new NoViableAltException(LT(1), getFilename());
0233: }
0234:
0235: } catch (RecognitionException ex) {
0236: if (inputState.guessing == 0) {
0237: reportError(ex);
0238: recover(ex, _tokenSet_2);
0239: } else {
0240: throw ex;
0241: }
0242: }
0243: returnAST = selectList_AST;
0244: }
0245:
0246: public final void nameSpace() throws RecognitionException,
0247: TokenStreamException {
0248:
0249: returnAST = null;
0250: ASTPair currentAST = new ASTPair();
0251: AST nameSpace_AST = null;
0252:
0253: try { // for error handling
0254: {
0255: int _cnt38 = 0;
0256: _loop38: do {
0257: switch (LA(1)) {
0258: case FORWARDSLASH: {
0259: {
0260: AST tmp8_AST = null;
0261: tmp8_AST = astFactory.create(LT(1));
0262: astFactory
0263: .addASTChild(currentAST, tmp8_AST);
0264: match(FORWARDSLASH);
0265: }
0266: break;
0267: }
0268: case Identifier: {
0269: AST tmp9_AST = null;
0270: tmp9_AST = astFactory.create(LT(1));
0271: astFactory.addASTChild(currentAST, tmp9_AST);
0272: match(Identifier);
0273: break;
0274: }
0275: case DASH: {
0276: {
0277: AST tmp10_AST = null;
0278: tmp10_AST = astFactory.create(LT(1));
0279: astFactory.addASTChild(currentAST,
0280: tmp10_AST);
0281: match(DASH);
0282: }
0283: break;
0284: }
0285: case PLUS: {
0286: {
0287: AST tmp11_AST = null;
0288: tmp11_AST = astFactory.create(LT(1));
0289: astFactory.addASTChild(currentAST,
0290: tmp11_AST);
0291: match(PLUS);
0292: }
0293: break;
0294: }
0295: default: {
0296: if (_cnt38 >= 1) {
0297: break _loop38;
0298: } else {
0299: throw new NoViableAltException(LT(1),
0300: getFilename());
0301: }
0302: }
0303: }
0304: _cnt38++;
0305: } while (true);
0306: }
0307: nameSpace_AST = (AST) currentAST.root;
0308: } catch (RecognitionException ex) {
0309: if (inputState.guessing == 0) {
0310: reportError(ex);
0311: recover(ex, _tokenSet_3);
0312: } else {
0313: throw ex;
0314: }
0315: }
0316: returnAST = nameSpace_AST;
0317: }
0318:
0319: public final void predicateList() throws RecognitionException,
0320: TokenStreamException {
0321:
0322: returnAST = null;
0323: ASTPair currentAST = new ASTPair();
0324: AST predicateList_AST = null;
0325:
0326: try { // for error handling
0327: subPredicate();
0328: astFactory.addASTChild(currentAST, returnAST);
0329: {
0330: _loop27: do {
0331: if ((LA(1) == AND || LA(1) == OR)) {
0332: {
0333: switch (LA(1)) {
0334: case AND: {
0335: AST tmp12_AST = null;
0336: tmp12_AST = astFactory.create(LT(1));
0337: astFactory.addASTChild(currentAST,
0338: tmp12_AST);
0339: match(AND);
0340: break;
0341: }
0342: case OR: {
0343: AST tmp13_AST = null;
0344: tmp13_AST = astFactory.create(LT(1));
0345: astFactory.addASTChild(currentAST,
0346: tmp13_AST);
0347: match(OR);
0348: break;
0349: }
0350: default: {
0351: throw new NoViableAltException(LT(1),
0352: getFilename());
0353: }
0354: }
0355: }
0356: subPredicate();
0357: astFactory.addASTChild(currentAST, returnAST);
0358: } else {
0359: break _loop27;
0360: }
0361:
0362: } while (true);
0363: }
0364: predicateList_AST = (AST) currentAST.root;
0365: } catch (RecognitionException ex) {
0366: if (inputState.guessing == 0) {
0367: reportError(ex);
0368: recover(ex, _tokenSet_4);
0369: } else {
0370: throw ex;
0371: }
0372: }
0373: returnAST = predicateList_AST;
0374: }
0375:
0376: public final void orderList() throws RecognitionException,
0377: TokenStreamException {
0378:
0379: returnAST = null;
0380: ASTPair currentAST = new ASTPair();
0381: AST orderList_AST = null;
0382:
0383: try { // for error handling
0384: boolean synPredMatched15 = false;
0385: if (((LA(1) == Identifier)
0386: && (LA(2) == ASC || LA(2) == DESC || LA(2) == COMMA) && (LA(3) == COMMA || LA(3) == Identifier))) {
0387: int _m15 = mark();
0388: synPredMatched15 = true;
0389: inputState.guessing++;
0390: try {
0391: {
0392: orderName();
0393: }
0394: } catch (RecognitionException pe) {
0395: synPredMatched15 = false;
0396: }
0397: rewind(_m15);
0398: inputState.guessing--;
0399: }
0400: if (synPredMatched15) {
0401: orderName();
0402: astFactory.addASTChild(currentAST, returnAST);
0403: {
0404: switch (LA(1)) {
0405: case ASC: {
0406: AST tmp14_AST = null;
0407: tmp14_AST = astFactory.create(LT(1));
0408: astFactory.addASTChild(currentAST, tmp14_AST);
0409: match(ASC);
0410: break;
0411: }
0412: case DESC: {
0413: AST tmp15_AST = null;
0414: tmp15_AST = astFactory.create(LT(1));
0415: astFactory.addASTChild(currentAST, tmp15_AST);
0416: match(DESC);
0417: break;
0418: }
0419: case COMMA: {
0420: break;
0421: }
0422: default: {
0423: throw new NoViableAltException(LT(1),
0424: getFilename());
0425: }
0426: }
0427: }
0428: {
0429: int _cnt19 = 0;
0430: _loop19: do {
0431: if ((LA(1) == COMMA)) {
0432: match(COMMA);
0433: orderName();
0434: astFactory.addASTChild(currentAST,
0435: returnAST);
0436: {
0437: switch (LA(1)) {
0438: case ASC: {
0439: AST tmp17_AST = null;
0440: tmp17_AST = astFactory
0441: .create(LT(1));
0442: astFactory.addASTChild(currentAST,
0443: tmp17_AST);
0444: match(ASC);
0445: break;
0446: }
0447: case DESC: {
0448: AST tmp18_AST = null;
0449: tmp18_AST = astFactory
0450: .create(LT(1));
0451: astFactory.addASTChild(currentAST,
0452: tmp18_AST);
0453: match(DESC);
0454: break;
0455: }
0456: case COMMA:
0457: case SEMICOLON: {
0458: break;
0459: }
0460: default: {
0461: throw new NoViableAltException(
0462: LT(1), getFilename());
0463: }
0464: }
0465: }
0466: } else {
0467: if (_cnt19 >= 1) {
0468: break _loop19;
0469: } else {
0470: throw new NoViableAltException(LT(1),
0471: getFilename());
0472: }
0473: }
0474:
0475: _cnt19++;
0476: } while (true);
0477: }
0478: orderList_AST = (AST) currentAST.root;
0479: } else if ((LA(1) == Identifier)
0480: && (LA(2) == ASC || LA(2) == DESC || LA(2) == SEMICOLON)
0481: && (LA(3) == EOF || LA(3) == SEMICOLON)) {
0482: orderName();
0483: astFactory.addASTChild(currentAST, returnAST);
0484: {
0485: switch (LA(1)) {
0486: case ASC: {
0487: AST tmp19_AST = null;
0488: tmp19_AST = astFactory.create(LT(1));
0489: astFactory.addASTChild(currentAST, tmp19_AST);
0490: match(ASC);
0491: break;
0492: }
0493: case DESC: {
0494: AST tmp20_AST = null;
0495: tmp20_AST = astFactory.create(LT(1));
0496: astFactory.addASTChild(currentAST, tmp20_AST);
0497: match(DESC);
0498: break;
0499: }
0500: case SEMICOLON: {
0501: break;
0502: }
0503: default: {
0504: throw new NoViableAltException(LT(1),
0505: getFilename());
0506: }
0507: }
0508: }
0509: orderList_AST = (AST) currentAST.root;
0510: } else {
0511: throw new NoViableAltException(LT(1), getFilename());
0512: }
0513:
0514: } catch (RecognitionException ex) {
0515: if (inputState.guessing == 0) {
0516: reportError(ex);
0517: recover(ex, _tokenSet_1);
0518: } else {
0519: throw ex;
0520: }
0521: }
0522: returnAST = orderList_AST;
0523: }
0524:
0525: public final void className() throws RecognitionException,
0526: TokenStreamException {
0527:
0528: returnAST = null;
0529: ASTPair currentAST = new ASTPair();
0530: AST className_AST = null;
0531:
0532: try { // for error handling
0533: AST tmp21_AST = null;
0534: tmp21_AST = astFactory.create(LT(1));
0535: astFactory.addASTChild(currentAST, tmp21_AST);
0536: match(Identifier);
0537: className_AST = (AST) currentAST.root;
0538: } catch (RecognitionException ex) {
0539: if (inputState.guessing == 0) {
0540: reportError(ex);
0541: recover(ex, _tokenSet_5);
0542: } else {
0543: throw ex;
0544: }
0545: }
0546: returnAST = className_AST;
0547: }
0548:
0549: public final void fullClassName() throws RecognitionException,
0550: TokenStreamException {
0551:
0552: returnAST = null;
0553: ASTPair currentAST = new ASTPair();
0554: AST fullClassName_AST = null;
0555:
0556: try { // for error handling
0557: className();
0558: astFactory.addASTChild(currentAST, returnAST);
0559: AST tmp22_AST = null;
0560: tmp22_AST = astFactory.create(LT(1));
0561: astFactory.makeASTRoot(currentAST, tmp22_AST);
0562: match(ALIAS_IDENTIFIER);
0563: aliasName();
0564: astFactory.addASTChild(currentAST, returnAST);
0565: fullClassName_AST = (AST) currentAST.root;
0566: } catch (RecognitionException ex) {
0567: if (inputState.guessing == 0) {
0568: reportError(ex);
0569: recover(ex, _tokenSet_6);
0570: } else {
0571: throw ex;
0572: }
0573: }
0574: returnAST = fullClassName_AST;
0575: }
0576:
0577: public final void whereClause() throws RecognitionException,
0578: TokenStreamException {
0579:
0580: returnAST = null;
0581: ASTPair currentAST = new ASTPair();
0582: AST whereClause_AST = null;
0583:
0584: try { // for error handling
0585: predicateList();
0586: astFactory.addASTChild(currentAST, returnAST);
0587: whereClause_AST = (AST) currentAST.root;
0588: } catch (RecognitionException ex) {
0589: if (inputState.guessing == 0) {
0590: reportError(ex);
0591: recover(ex, _tokenSet_0);
0592: } else {
0593: throw ex;
0594: }
0595: }
0596: returnAST = whereClause_AST;
0597: }
0598:
0599: public final void orderName() throws RecognitionException,
0600: TokenStreamException {
0601:
0602: returnAST = null;
0603: ASTPair currentAST = new ASTPair();
0604: AST orderName_AST = null;
0605:
0606: try { // for error handling
0607: AST tmp23_AST = null;
0608: tmp23_AST = astFactory.create(LT(1));
0609: astFactory.addASTChild(currentAST, tmp23_AST);
0610: match(Identifier);
0611: orderName_AST = (AST) currentAST.root;
0612: } catch (RecognitionException ex) {
0613: if (inputState.guessing == 0) {
0614: reportError(ex);
0615: recover(ex, _tokenSet_7);
0616: } else {
0617: throw ex;
0618: }
0619: }
0620: returnAST = orderName_AST;
0621: }
0622:
0623: public final void aliasName() throws RecognitionException,
0624: TokenStreamException {
0625:
0626: returnAST = null;
0627: ASTPair currentAST = new ASTPair();
0628: AST aliasName_AST = null;
0629:
0630: try { // for error handling
0631: AST tmp24_AST = null;
0632: tmp24_AST = astFactory.create(LT(1));
0633: astFactory.addASTChild(currentAST, tmp24_AST);
0634: match(Identifier);
0635: aliasName_AST = (AST) currentAST.root;
0636: } catch (RecognitionException ex) {
0637: if (inputState.guessing == 0) {
0638: reportError(ex);
0639: recover(ex, _tokenSet_6);
0640: } else {
0641: throw ex;
0642: }
0643: }
0644: returnAST = aliasName_AST;
0645: }
0646:
0647: public final void subPredicate() throws RecognitionException,
0648: TokenStreamException {
0649:
0650: returnAST = null;
0651: ASTPair currentAST = new ASTPair();
0652: AST subPredicate_AST = null;
0653:
0654: try { // for error handling
0655: switch (LA(1)) {
0656: case LPAREN: {
0657: AST tmp25_AST = null;
0658: tmp25_AST = astFactory.create(LT(1));
0659: astFactory.addASTChild(currentAST, tmp25_AST);
0660: match(LPAREN);
0661: predicateList();
0662: astFactory.addASTChild(currentAST, returnAST);
0663: AST tmp26_AST = null;
0664: tmp26_AST = astFactory.create(LT(1));
0665: astFactory.addASTChild(currentAST, tmp26_AST);
0666: match(RPAREN);
0667: subPredicate_AST = (AST) currentAST.root;
0668: break;
0669: }
0670: case VALUE:
0671: case Identifier: {
0672: predicate();
0673: astFactory.addASTChild(currentAST, returnAST);
0674: subPredicate_AST = (AST) currentAST.root;
0675: break;
0676: }
0677: default: {
0678: throw new NoViableAltException(LT(1), getFilename());
0679: }
0680: }
0681: } catch (RecognitionException ex) {
0682: if (inputState.guessing == 0) {
0683: reportError(ex);
0684: recover(ex, _tokenSet_8);
0685: } else {
0686: throw ex;
0687: }
0688: }
0689: returnAST = subPredicate_AST;
0690: }
0691:
0692: public final void predicate() throws RecognitionException,
0693: TokenStreamException {
0694:
0695: returnAST = null;
0696: ASTPair currentAST = new ASTPair();
0697: AST predicate_AST = null;
0698:
0699: try { // for error handling
0700: predicateName();
0701: astFactory.addASTChild(currentAST, returnAST);
0702: {
0703: switch (LA(1)) {
0704: case ASSIGNEQUAL: {
0705: AST tmp27_AST = null;
0706: tmp27_AST = astFactory.create(LT(1));
0707: astFactory.makeASTRoot(currentAST, tmp27_AST);
0708: match(ASSIGNEQUAL);
0709: break;
0710: }
0711: case NOTEQUAL2: {
0712: AST tmp28_AST = null;
0713: tmp28_AST = astFactory.create(LT(1));
0714: astFactory.makeASTRoot(currentAST, tmp28_AST);
0715: match(NOTEQUAL2);
0716: break;
0717: }
0718: case NOTEQUAL1: {
0719: AST tmp29_AST = null;
0720: tmp29_AST = astFactory.create(LT(1));
0721: astFactory.makeASTRoot(currentAST, tmp29_AST);
0722: match(NOTEQUAL1);
0723: break;
0724: }
0725: case LESSTHANOREQUALTO1: {
0726: AST tmp30_AST = null;
0727: tmp30_AST = astFactory.create(LT(1));
0728: astFactory.makeASTRoot(currentAST, tmp30_AST);
0729: match(LESSTHANOREQUALTO1);
0730: break;
0731: }
0732: case LESSTHANOREQUALTO2: {
0733: AST tmp31_AST = null;
0734: tmp31_AST = astFactory.create(LT(1));
0735: astFactory.makeASTRoot(currentAST, tmp31_AST);
0736: match(LESSTHANOREQUALTO2);
0737: break;
0738: }
0739: case LESSTHAN: {
0740: AST tmp32_AST = null;
0741: tmp32_AST = astFactory.create(LT(1));
0742: astFactory.makeASTRoot(currentAST, tmp32_AST);
0743: match(LESSTHAN);
0744: break;
0745: }
0746: case GREATERTHANOREQUALTO1: {
0747: AST tmp33_AST = null;
0748: tmp33_AST = astFactory.create(LT(1));
0749: astFactory.makeASTRoot(currentAST, tmp33_AST);
0750: match(GREATERTHANOREQUALTO1);
0751: break;
0752: }
0753: case GREATERTHANOREQUALTO2: {
0754: AST tmp34_AST = null;
0755: tmp34_AST = astFactory.create(LT(1));
0756: astFactory.makeASTRoot(currentAST, tmp34_AST);
0757: match(GREATERTHANOREQUALTO2);
0758: break;
0759: }
0760: case GREATERTHAN: {
0761: AST tmp35_AST = null;
0762: tmp35_AST = astFactory.create(LT(1));
0763: astFactory.makeASTRoot(currentAST, tmp35_AST);
0764: match(GREATERTHAN);
0765: break;
0766: }
0767: case IS: {
0768: AST tmp36_AST = null;
0769: tmp36_AST = astFactory.create(LT(1));
0770: astFactory.makeASTRoot(currentAST, tmp36_AST);
0771: match(IS);
0772: break;
0773: }
0774: case NOT: {
0775: AST tmp37_AST = null;
0776: tmp37_AST = astFactory.create(LT(1));
0777: astFactory.makeASTRoot(currentAST, tmp37_AST);
0778: match(NOT);
0779: break;
0780: }
0781: case LIKE: {
0782: AST tmp38_AST = null;
0783: tmp38_AST = astFactory.create(LT(1));
0784: astFactory.makeASTRoot(currentAST, tmp38_AST);
0785: match(LIKE);
0786: break;
0787: }
0788: case IN: {
0789: AST tmp39_AST = null;
0790: tmp39_AST = astFactory.create(LT(1));
0791: astFactory.makeASTRoot(currentAST, tmp39_AST);
0792: match(IN);
0793: break;
0794: }
0795: default: {
0796: throw new NoViableAltException(LT(1), getFilename());
0797: }
0798: }
0799: }
0800: predicateParenValue();
0801: astFactory.addASTChild(currentAST, returnAST);
0802: predicate_AST = (AST) currentAST.root;
0803: } catch (RecognitionException ex) {
0804: if (inputState.guessing == 0) {
0805: reportError(ex);
0806: recover(ex, _tokenSet_8);
0807: } else {
0808: throw ex;
0809: }
0810: }
0811: returnAST = predicate_AST;
0812: }
0813:
0814: public final void predicateName() throws RecognitionException,
0815: TokenStreamException {
0816:
0817: returnAST = null;
0818: ASTPair currentAST = new ASTPair();
0819: AST predicateName_AST = null;
0820:
0821: try { // for error handling
0822: switch (LA(1)) {
0823: case Identifier: {
0824: AST tmp40_AST = null;
0825: tmp40_AST = astFactory.create(LT(1));
0826: astFactory.addASTChild(currentAST, tmp40_AST);
0827: match(Identifier);
0828: predicateName_AST = (AST) currentAST.root;
0829: break;
0830: }
0831: case VALUE: {
0832: AST tmp41_AST = null;
0833: tmp41_AST = astFactory.create(LT(1));
0834: astFactory.addASTChild(currentAST, tmp41_AST);
0835: match(VALUE);
0836: predicateName_AST = (AST) currentAST.root;
0837: break;
0838: }
0839: default: {
0840: throw new NoViableAltException(LT(1), getFilename());
0841: }
0842: }
0843: } catch (RecognitionException ex) {
0844: if (inputState.guessing == 0) {
0845: reportError(ex);
0846: recover(ex, _tokenSet_9);
0847: } else {
0848: throw ex;
0849: }
0850: }
0851: returnAST = predicateName_AST;
0852: }
0853:
0854: public final void predicateParenValue()
0855: throws RecognitionException, TokenStreamException {
0856:
0857: returnAST = null;
0858: ASTPair currentAST = new ASTPair();
0859: AST predicateParenValue_AST = null;
0860:
0861: try { // for error handling
0862: switch (LA(1)) {
0863: case LPAREN: {
0864: AST tmp42_AST = null;
0865: tmp42_AST = astFactory.create(LT(1));
0866: astFactory.addASTChild(currentAST, tmp42_AST);
0867: match(LPAREN);
0868: {
0869: _loop43: do {
0870: switch (LA(1)) {
0871: case SELECT:
0872: case WHERE:
0873: case ALIAS_IDENTIFIER:
0874: case AND:
0875: case OR:
0876: case NOT:
0877: case VALUE:
0878: case FROM:
0879: case IS:
0880: case LIKE:
0881: case IN:
0882: case NAMESPACE:
0883: case Identifier:
0884: case PredicateIdentifier: {
0885: predicateValue();
0886: astFactory.addASTChild(currentAST,
0887: returnAST);
0888: break;
0889: }
0890: case COMMA: {
0891: AST tmp43_AST = null;
0892: tmp43_AST = astFactory.create(LT(1));
0893: astFactory.addASTChild(currentAST,
0894: tmp43_AST);
0895: match(COMMA);
0896: break;
0897: }
0898: default: {
0899: break _loop43;
0900: }
0901: }
0902: } while (true);
0903: }
0904: AST tmp44_AST = null;
0905: tmp44_AST = astFactory.create(LT(1));
0906: astFactory.addASTChild(currentAST, tmp44_AST);
0907: match(RPAREN);
0908: predicateParenValue_AST = (AST) currentAST.root;
0909: break;
0910: }
0911: case SELECT:
0912: case WHERE:
0913: case ALIAS_IDENTIFIER:
0914: case AND:
0915: case OR:
0916: case NOT:
0917: case VALUE:
0918: case FROM:
0919: case IS:
0920: case LIKE:
0921: case IN:
0922: case NAMESPACE:
0923: case Identifier:
0924: case PredicateIdentifier: {
0925: predicateValue();
0926: astFactory.addASTChild(currentAST, returnAST);
0927: predicateParenValue_AST = (AST) currentAST.root;
0928: break;
0929: }
0930: default: {
0931: throw new NoViableAltException(LT(1), getFilename());
0932: }
0933: }
0934: } catch (RecognitionException ex) {
0935: if (inputState.guessing == 0) {
0936: reportError(ex);
0937: recover(ex, _tokenSet_8);
0938: } else {
0939: throw ex;
0940: }
0941: }
0942: returnAST = predicateParenValue_AST;
0943: }
0944:
0945: public final void predicateValue() throws RecognitionException,
0946: TokenStreamException {
0947:
0948: returnAST = null;
0949: ASTPair currentAST = new ASTPair();
0950: AST predicateValue_AST = null;
0951:
0952: try { // for error handling
0953: switch (LA(1)) {
0954: case PredicateIdentifier: {
0955: AST tmp45_AST = null;
0956: tmp45_AST = astFactory.create(LT(1));
0957: astFactory.addASTChild(currentAST, tmp45_AST);
0958: match(PredicateIdentifier);
0959: predicateValue_AST = (AST) currentAST.root;
0960: break;
0961: }
0962: case Identifier: {
0963: AST tmp46_AST = null;
0964: tmp46_AST = astFactory.create(LT(1));
0965: astFactory.addASTChild(currentAST, tmp46_AST);
0966: match(Identifier);
0967: predicateValue_AST = (AST) currentAST.root;
0968: break;
0969: }
0970: case SELECT: {
0971: AST tmp47_AST = null;
0972: tmp47_AST = astFactory.create(LT(1));
0973: astFactory.addASTChild(currentAST, tmp47_AST);
0974: match(SELECT);
0975: predicateValue_AST = (AST) currentAST.root;
0976: break;
0977: }
0978: case FROM: {
0979: AST tmp48_AST = null;
0980: tmp48_AST = astFactory.create(LT(1));
0981: astFactory.addASTChild(currentAST, tmp48_AST);
0982: match(FROM);
0983: predicateValue_AST = (AST) currentAST.root;
0984: break;
0985: }
0986: case WHERE: {
0987: AST tmp49_AST = null;
0988: tmp49_AST = astFactory.create(LT(1));
0989: astFactory.addASTChild(currentAST, tmp49_AST);
0990: match(WHERE);
0991: predicateValue_AST = (AST) currentAST.root;
0992: break;
0993: }
0994: case ALIAS_IDENTIFIER: {
0995: AST tmp50_AST = null;
0996: tmp50_AST = astFactory.create(LT(1));
0997: astFactory.addASTChild(currentAST, tmp50_AST);
0998: match(ALIAS_IDENTIFIER);
0999: predicateValue_AST = (AST) currentAST.root;
1000: break;
1001: }
1002: case AND: {
1003: AST tmp51_AST = null;
1004: tmp51_AST = astFactory.create(LT(1));
1005: astFactory.addASTChild(currentAST, tmp51_AST);
1006: match(AND);
1007: predicateValue_AST = (AST) currentAST.root;
1008: break;
1009: }
1010: case OR: {
1011: AST tmp52_AST = null;
1012: tmp52_AST = astFactory.create(LT(1));
1013: astFactory.addASTChild(currentAST, tmp52_AST);
1014: match(OR);
1015: predicateValue_AST = (AST) currentAST.root;
1016: break;
1017: }
1018: case NOT: {
1019: AST tmp53_AST = null;
1020: tmp53_AST = astFactory.create(LT(1));
1021: astFactory.addASTChild(currentAST, tmp53_AST);
1022: match(NOT);
1023: predicateValue_AST = (AST) currentAST.root;
1024: break;
1025: }
1026: case VALUE: {
1027: AST tmp54_AST = null;
1028: tmp54_AST = astFactory.create(LT(1));
1029: astFactory.addASTChild(currentAST, tmp54_AST);
1030: match(VALUE);
1031: predicateValue_AST = (AST) currentAST.root;
1032: break;
1033: }
1034: case IS: {
1035: AST tmp55_AST = null;
1036: tmp55_AST = astFactory.create(LT(1));
1037: astFactory.addASTChild(currentAST, tmp55_AST);
1038: match(IS);
1039: predicateValue_AST = (AST) currentAST.root;
1040: break;
1041: }
1042: case LIKE: {
1043: AST tmp56_AST = null;
1044: tmp56_AST = astFactory.create(LT(1));
1045: astFactory.addASTChild(currentAST, tmp56_AST);
1046: match(LIKE);
1047: predicateValue_AST = (AST) currentAST.root;
1048: break;
1049: }
1050: case IN: {
1051: AST tmp57_AST = null;
1052: tmp57_AST = astFactory.create(LT(1));
1053: astFactory.addASTChild(currentAST, tmp57_AST);
1054: match(IN);
1055: predicateValue_AST = (AST) currentAST.root;
1056: break;
1057: }
1058: case NAMESPACE: {
1059: AST tmp58_AST = null;
1060: tmp58_AST = astFactory.create(LT(1));
1061: astFactory.addASTChild(currentAST, tmp58_AST);
1062: match(NAMESPACE);
1063: predicateValue_AST = (AST) currentAST.root;
1064: break;
1065: }
1066: default: {
1067: throw new NoViableAltException(LT(1), getFilename());
1068: }
1069: }
1070: } catch (RecognitionException ex) {
1071: if (inputState.guessing == 0) {
1072: reportError(ex);
1073: recover(ex, _tokenSet_10);
1074: } else {
1075: throw ex;
1076: }
1077: }
1078: returnAST = predicateValue_AST;
1079: }
1080:
1081: public final void comparisonOperator() throws RecognitionException,
1082: TokenStreamException {
1083:
1084: returnAST = null;
1085: ASTPair currentAST = new ASTPair();
1086: AST comparisonOperator_AST = null;
1087:
1088: try { // for error handling
1089: switch (LA(1)) {
1090: case ASSIGNEQUAL: {
1091: AST tmp59_AST = null;
1092: tmp59_AST = astFactory.create(LT(1));
1093: astFactory.addASTChild(currentAST, tmp59_AST);
1094: match(ASSIGNEQUAL);
1095: comparisonOperator_AST = (AST) currentAST.root;
1096: break;
1097: }
1098: case NOTEQUAL1: {
1099: AST tmp60_AST = null;
1100: tmp60_AST = astFactory.create(LT(1));
1101: astFactory.addASTChild(currentAST, tmp60_AST);
1102: match(NOTEQUAL1);
1103: comparisonOperator_AST = (AST) currentAST.root;
1104: break;
1105: }
1106: case NOTEQUAL2: {
1107: AST tmp61_AST = null;
1108: tmp61_AST = astFactory.create(LT(1));
1109: astFactory.addASTChild(currentAST, tmp61_AST);
1110: match(NOTEQUAL2);
1111: comparisonOperator_AST = (AST) currentAST.root;
1112: break;
1113: }
1114: case LESSTHANOREQUALTO1: {
1115: AST tmp62_AST = null;
1116: tmp62_AST = astFactory.create(LT(1));
1117: astFactory.addASTChild(currentAST, tmp62_AST);
1118: match(LESSTHANOREQUALTO1);
1119: comparisonOperator_AST = (AST) currentAST.root;
1120: break;
1121: }
1122: case LESSTHANOREQUALTO2: {
1123: AST tmp63_AST = null;
1124: tmp63_AST = astFactory.create(LT(1));
1125: astFactory.addASTChild(currentAST, tmp63_AST);
1126: match(LESSTHANOREQUALTO2);
1127: comparisonOperator_AST = (AST) currentAST.root;
1128: break;
1129: }
1130: case LESSTHAN: {
1131: AST tmp64_AST = null;
1132: tmp64_AST = astFactory.create(LT(1));
1133: astFactory.addASTChild(currentAST, tmp64_AST);
1134: match(LESSTHAN);
1135: comparisonOperator_AST = (AST) currentAST.root;
1136: break;
1137: }
1138: case GREATERTHANOREQUALTO1: {
1139: AST tmp65_AST = null;
1140: tmp65_AST = astFactory.create(LT(1));
1141: astFactory.addASTChild(currentAST, tmp65_AST);
1142: match(GREATERTHANOREQUALTO1);
1143: comparisonOperator_AST = (AST) currentAST.root;
1144: break;
1145: }
1146: case GREATERTHANOREQUALTO2: {
1147: AST tmp66_AST = null;
1148: tmp66_AST = astFactory.create(LT(1));
1149: astFactory.addASTChild(currentAST, tmp66_AST);
1150: match(GREATERTHANOREQUALTO2);
1151: comparisonOperator_AST = (AST) currentAST.root;
1152: break;
1153: }
1154: case GREATERTHAN: {
1155: AST tmp67_AST = null;
1156: tmp67_AST = astFactory.create(LT(1));
1157: astFactory.addASTChild(currentAST, tmp67_AST);
1158: match(GREATERTHAN);
1159: comparisonOperator_AST = (AST) currentAST.root;
1160: break;
1161: }
1162: default: {
1163: throw new NoViableAltException(LT(1), getFilename());
1164: }
1165: }
1166: } catch (RecognitionException ex) {
1167: if (inputState.guessing == 0) {
1168: reportError(ex);
1169: recover(ex, _tokenSet_0);
1170: } else {
1171: throw ex;
1172: }
1173: }
1174: returnAST = comparisonOperator_AST;
1175: }
1176:
1177: public final void logicalOperator() throws RecognitionException,
1178: TokenStreamException {
1179:
1180: returnAST = null;
1181: ASTPair currentAST = new ASTPair();
1182: AST logicalOperator_AST = null;
1183:
1184: try { // for error handling
1185: switch (LA(1)) {
1186: case AND: {
1187: AST tmp68_AST = null;
1188: tmp68_AST = astFactory.create(LT(1));
1189: astFactory.addASTChild(currentAST, tmp68_AST);
1190: match(AND);
1191: logicalOperator_AST = (AST) currentAST.root;
1192: break;
1193: }
1194: case OR: {
1195: AST tmp69_AST = null;
1196: tmp69_AST = astFactory.create(LT(1));
1197: astFactory.addASTChild(currentAST, tmp69_AST);
1198: match(OR);
1199: logicalOperator_AST = (AST) currentAST.root;
1200: break;
1201: }
1202: default: {
1203: throw new NoViableAltException(LT(1), getFilename());
1204: }
1205: }
1206: } catch (RecognitionException ex) {
1207: if (inputState.guessing == 0) {
1208: reportError(ex);
1209: recover(ex, _tokenSet_0);
1210: } else {
1211: throw ex;
1212: }
1213: }
1214: returnAST = logicalOperator_AST;
1215: }
1216:
1217: public static final String[] _tokenNames = { "<0>", "EOF", "<2>",
1218: "NULL_TREE_LOOKAHEAD", "\"select\"", "\"where\"", "\"as\"",
1219: "\"and\"", "\"or\"", "\"not\"", "\"value\"", "\"from\"",
1220: "\"is\"", "\"like\"", "\"in\"", "\"namespace\"",
1221: "\"order\"", "\"by\"", "\"asc\"", "\"desc\"",
1222: "PACKAGE_SEPERATOR", "COMMA", "SEMICOLON", "LPAREN",
1223: "RPAREN", "SINGLE_QUOTE", "BACKSLASH", "FORWARDSLASH",
1224: "DASH", "PLUS", "ASSIGNEQUAL", "NOTEQUAL1", "NOTEQUAL2",
1225: "LESSTHANOREQUALTO1", "LESSTHANOREQUALTO2", "LESSTHAN",
1226: "GREATERTHANOREQUALTO1", "GREATERTHANOREQUALTO2",
1227: "GREATERTHAN", "LBRACKET", "RBRACKET", "Letter", "Digit",
1228: "SPACE", "Identifier", "ESC", "NONESC",
1229: "PredicateIdentifier", "WS" };
1230:
1231: protected void buildTokenTypeASTClassMap() {
1232: tokenTypeToASTClassMap = null;
1233: };
1234:
1235: private static final long[] mk_tokenSet_0() {
1236: long[] data = { 2L, 0L };
1237: return data;
1238: }
1239:
1240: public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0());
1241:
1242: private static final long[] mk_tokenSet_1() {
1243: long[] data = { 4194304L, 0L };
1244: return data;
1245: }
1246:
1247: public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1());
1248:
1249: private static final long[] mk_tokenSet_2() {
1250: long[] data = { 2080L, 0L };
1251: return data;
1252: }
1253:
1254: public static final BitSet _tokenSet_2 = new BitSet(mk_tokenSet_2());
1255:
1256: private static final long[] mk_tokenSet_3() {
1257: long[] data = { 32L, 0L };
1258: return data;
1259: }
1260:
1261: public static final BitSet _tokenSet_3 = new BitSet(mk_tokenSet_3());
1262:
1263: private static final long[] mk_tokenSet_4() {
1264: long[] data = { 21037058L, 0L };
1265: return data;
1266: }
1267:
1268: public static final BitSet _tokenSet_4 = new BitSet(mk_tokenSet_4());
1269:
1270: private static final long[] mk_tokenSet_5() {
1271: long[] data = { 2144L, 0L };
1272: return data;
1273: }
1274:
1275: public static final BitSet _tokenSet_5 = new BitSet(mk_tokenSet_5());
1276:
1277: private static final long[] mk_tokenSet_6() {
1278: long[] data = { 17592188143648L, 0L };
1279: return data;
1280: }
1281:
1282: public static final BitSet _tokenSet_6 = new BitSet(mk_tokenSet_6());
1283:
1284: private static final long[] mk_tokenSet_7() {
1285: long[] data = { 7077888L, 0L };
1286: return data;
1287: }
1288:
1289: public static final BitSet _tokenSet_7 = new BitSet(mk_tokenSet_7());
1290:
1291: private static final long[] mk_tokenSet_8() {
1292: long[] data = { 21037442L, 0L };
1293: return data;
1294: }
1295:
1296: public static final BitSet _tokenSet_8 = new BitSet(mk_tokenSet_8());
1297:
1298: private static final long[] mk_tokenSet_9() {
1299: long[] data = { 548682101248L, 0L };
1300: return data;
1301: }
1302:
1303: public static final BitSet _tokenSet_9 = new BitSet(mk_tokenSet_9());
1304:
1305: private static final long[] mk_tokenSet_10() {
1306: long[] data = { 158329697599474L, 0L };
1307: return data;
1308: }
1309:
1310: public static final BitSet _tokenSet_10 = new BitSet(
1311: mk_tokenSet_10());
1312:
1313: }
|