public virtual object ApplyOnce(object t, System.Func <TreeRuleReturnScope> whichRule) { if (t == null) { return(null); } try { // share TreeParser object but not parsing-related state state = new RecognizerSharedState(); input = new CommonTreeNodeStream(originalAdaptor, t); ((CommonTreeNodeStream)input).TokenStream = originalTokenStream; BacktrackingLevel = 1; TreeRuleReturnScope r = whichRule(); BacktrackingLevel = 0; if (Failed) { return(t); } if (r != null && !t.Equals(r.Tree) && r.Tree != null) { // show any transformations Console.Out.WriteLine(((CommonTree)t).ToStringTree() + " -> " + ((CommonTree)r.Tree).ToStringTree()); } if (r != null && r.Tree != null) { return(r.Tree); } else { return(t); } } catch (RecognitionException) { } return(t); }
private TreeRuleReturnScope<IASTNode> limitValue() { EnterRule_limitValue(); EnterRule("limitValue", 50); TraceIn("limitValue", 50); TreeRuleReturnScope<IASTNode> retval = new TreeRuleReturnScope<IASTNode>(); retval.Start = (IASTNode)input.LT(1); try { DebugEnterRule(GrammarFileName, "limitValue"); DebugLocation(363, 1); try { // SqlGenerator.g:364:2: ( NUM_INT | NAMED_PARAM | PARAM ) DebugEnterAlt(1); // SqlGenerator.g: { DebugLocation(364, 2); if (input.LA(1)==NUM_INT||input.LA(1)==PARAM||input.LA(1)==NAMED_PARAM) { input.Consume(); state.errorRecovery=false;state.failed=false; } else { if (state.backtracking>0) {state.failed=true; return retval;} MismatchedSetException mse = new MismatchedSetException(null,input); DebugRecognitionException(mse); throw mse; } } } catch (RecognitionException re) { ReportError(re); Recover(input,re); } finally { TraceOut("limitValue", 50); LeaveRule("limitValue", 50); LeaveRule_limitValue(); } DebugLocation(367, 1); } finally { DebugExitRule(GrammarFileName, "limitValue"); } return retval; }
private TreeRuleReturnScope<IASTNode> constant() { EnterRule_constant(); EnterRule("constant", 38); TraceIn("constant", 38); TreeRuleReturnScope<IASTNode> retval = new TreeRuleReturnScope<IASTNode>(); retval.Start = (IASTNode)input.LT(1); try { DebugEnterRule(GrammarFileName, "constant"); DebugLocation(279, 1); try { // SqlGenerator.g:280:2: ( NUM_DOUBLE | NUM_DECIMAL | NUM_FLOAT | NUM_INT | NUM_LONG | QUOTED_String | CONSTANT | JAVA_CONSTANT | TRUE | FALSE | IDENT ) DebugEnterAlt(1); // SqlGenerator.g: { DebugLocation(280, 2); if (input.LA(1)==CONSTANT||input.LA(1)==FALSE||input.LA(1)==IDENT||input.LA(1)==JAVA_CONSTANT||(input.LA(1)>=NUM_DECIMAL && input.LA(1)<=NUM_LONG)||input.LA(1)==QUOTED_String||input.LA(1)==TRUE) { input.Consume(); state.errorRecovery=false;state.failed=false; } else { if (state.backtracking>0) {state.failed=true; return retval;} MismatchedSetException mse = new MismatchedSetException(null,input); DebugRecognitionException(mse); throw mse; } } } catch (RecognitionException re) { ReportError(re); Recover(input,re); } finally { TraceOut("constant", 38); LeaveRule("constant", 38); LeaveRule_constant(); } DebugLocation(291, 1); } finally { DebugExitRule(GrammarFileName, "constant"); } return retval; }
public TreeRuleReturnScope<IASTNode> simpleExpr() { EnterRule_simpleExpr(); EnterRule("simpleExpr", 37); TraceIn("simpleExpr", 37); TreeRuleReturnScope<IASTNode> retval = new TreeRuleReturnScope<IASTNode>(); retval.Start = (IASTNode)input.LT(1); TreeRuleReturnScope<IASTNode> c = default(TreeRuleReturnScope<IASTNode>); try { DebugEnterRule(GrammarFileName, "simpleExpr"); DebugLocation(267, 1); try { // SqlGenerator.g:268:2: (c= constant | NULL | addrExpr | sqlToken | aggregate | methodCall | count | parameter | arithmeticExpr ) int alt54=9; try { DebugEnterDecision(54, false); switch (input.LA(1)) { case CONSTANT: case FALSE: case IDENT: case JAVA_CONSTANT: case NUM_DECIMAL: case NUM_DOUBLE: case NUM_FLOAT: case NUM_INT: case NUM_LONG: case QUOTED_String: case TRUE: { alt54 = 1; } break; case NULL: { alt54 = 2; } break; case DOT: case INDEX_OP: case ALIAS_REF: { alt54 = 3; } break; case SQL_TOKEN: { alt54 = 4; } break; case AGGREGATE: { alt54 = 5; } break; case METHOD_CALL: { alt54 = 6; } break; case COUNT: { alt54 = 7; } break; case PARAM: case NAMED_PARAM: { alt54 = 8; } break; case BAND: case BNOT: case BOR: case BXOR: case CASE: case CASE2: case DIV: case MINUS: case PLUS: case STAR: case UNARY_MINUS: { alt54 = 9; } break; default: { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 54, 0, input, 1); DebugRecognitionException(nvae); throw nvae; } } } finally { DebugExitDecision(54); } switch (alt54) { case 1: DebugEnterAlt(1); // SqlGenerator.g:268:4: c= constant { DebugLocation(268, 5); PushFollow(Follow._constant_in_simpleExpr1520); c=constant(); PopFollow(); if (state.failed) return retval; DebugLocation(268, 15); if (state.backtracking == 0) { Out((c!=null?((IASTNode)c.Start):default(IASTNode))); } } break; case 2: DebugEnterAlt(2); // SqlGenerator.g:269:4: NULL { DebugLocation(269, 4); Match(input,NULL,Follow._NULL_in_simpleExpr1527); if (state.failed) return retval; DebugLocation(269, 9); if (state.backtracking == 0) { Out("null"); } } break; case 3: DebugEnterAlt(3); // SqlGenerator.g:270:4: addrExpr { DebugLocation(270, 4); PushFollow(Follow._addrExpr_in_simpleExpr1534); addrExpr(); PopFollow(); if (state.failed) return retval; } break; case 4: DebugEnterAlt(4); // SqlGenerator.g:271:4: sqlToken { DebugLocation(271, 4); PushFollow(Follow._sqlToken_in_simpleExpr1539); sqlToken(); PopFollow(); if (state.failed) return retval; } break; case 5: DebugEnterAlt(5); // SqlGenerator.g:272:4: aggregate { DebugLocation(272, 4); PushFollow(Follow._aggregate_in_simpleExpr1544); aggregate(); PopFollow(); if (state.failed) return retval; } break; case 6: DebugEnterAlt(6); // SqlGenerator.g:273:4: methodCall { DebugLocation(273, 4); PushFollow(Follow._methodCall_in_simpleExpr1549); methodCall(); PopFollow(); if (state.failed) return retval; } break; case 7: DebugEnterAlt(7); // SqlGenerator.g:274:4: count { DebugLocation(274, 4); PushFollow(Follow._count_in_simpleExpr1554); count(); PopFollow(); if (state.failed) return retval; } break; case 8: DebugEnterAlt(8); // SqlGenerator.g:275:4: parameter { DebugLocation(275, 4); PushFollow(Follow._parameter_in_simpleExpr1559); parameter(); PopFollow(); if (state.failed) return retval; } break; case 9: DebugEnterAlt(9); // SqlGenerator.g:276:4: arithmeticExpr { DebugLocation(276, 4); PushFollow(Follow._arithmeticExpr_in_simpleExpr1564); arithmeticExpr(); PopFollow(); if (state.failed) return retval; } break; } } catch (RecognitionException re) { ReportError(re); Recover(input,re); } finally { TraceOut("simpleExpr", 37); LeaveRule("simpleExpr", 37); LeaveRule_simpleExpr(); } DebugLocation(277, 1); } finally { DebugExitRule(GrammarFileName, "simpleExpr"); } return retval; }
private TreeRuleReturnScope<IASTNode> expr() { EnterRule_expr(); EnterRule("expr", 34); TraceIn("expr", 34); TreeRuleReturnScope<IASTNode> retval = new TreeRuleReturnScope<IASTNode>(); retval.Start = (IASTNode)input.LT(1); TreeRuleReturnScope<IASTNode> e = default(TreeRuleReturnScope<IASTNode>); try { DebugEnterRule(GrammarFileName, "expr"); DebugLocation(248, 1); try { // SqlGenerator.g:249:2: ( simpleExpr | ^( VECTOR_EXPR (e= expr )* ) | parenSelect | ^( ANY quantified ) | ^( ALL quantified ) | ^( SOME quantified ) ) int alt51=6; try { DebugEnterDecision(51, false); switch (input.LA(1)) { case AGGREGATE: case BAND: case BNOT: case BOR: case BXOR: case CASE: case CASE2: case CONSTANT: case COUNT: case DIV: case DOT: case FALSE: case IDENT: case INDEX_OP: case JAVA_CONSTANT: case METHOD_CALL: case MINUS: case NULL: case NUM_DECIMAL: case NUM_DOUBLE: case NUM_FLOAT: case NUM_INT: case NUM_LONG: case PARAM: case PLUS: case QUOTED_String: case STAR: case TRUE: case UNARY_MINUS: case ALIAS_REF: case NAMED_PARAM: case SQL_TOKEN: { alt51 = 1; } break; case VECTOR_EXPR: { alt51 = 2; } break; case SELECT: case UNION: { alt51 = 3; } break; case ANY: { alt51 = 4; } break; case ALL: { alt51 = 5; } break; case SOME: { alt51 = 6; } break; default: { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 51, 0, input, 1); DebugRecognitionException(nvae); throw nvae; } } } finally { DebugExitDecision(51); } switch (alt51) { case 1: DebugEnterAlt(1); // SqlGenerator.g:249:4: simpleExpr { DebugLocation(249, 4); PushFollow(Follow._simpleExpr_in_expr1380); simpleExpr(); PopFollow(); if (state.failed) return retval; } break; case 2: DebugEnterAlt(2); // SqlGenerator.g:250:4: ^( VECTOR_EXPR (e= expr )* ) { DebugLocation(250, 4); DebugLocation(250, 7); Match(input,VECTOR_EXPR,Follow._VECTOR_EXPR_in_expr1387); if (state.failed) return retval; DebugLocation(250, 19); if (state.backtracking == 0) { Out("("); } if (input.LA(1) == TokenTypes.Down) { Match(input, TokenTypes.Down, null); if (state.failed) return retval; DebugLocation(250, 33); // SqlGenerator.g:250:33: (e= expr )* try { DebugEnterSubRule(50); while (true) { int alt50=2; try { DebugEnterDecision(50, false); int LA50_1 = input.LA(1); if ((LA50_1==AGGREGATE||LA50_1==ALL||LA50_1==ANY||LA50_1==BAND||(LA50_1>=BNOT && LA50_1<=BOR)||(LA50_1>=BXOR && LA50_1<=CASE2)||LA50_1==CONSTANT||LA50_1==COUNT||(LA50_1>=DIV && LA50_1<=DOT)||LA50_1==FALSE||LA50_1==IDENT||LA50_1==INDEX_OP||LA50_1==JAVA_CONSTANT||LA50_1==METHOD_CALL||LA50_1==MINUS||(LA50_1>=NULL && LA50_1<=NUM_LONG)||(LA50_1>=PARAM && LA50_1<=PLUS)||LA50_1==QUOTED_String||LA50_1==SELECT||LA50_1==SOME||LA50_1==STAR||(LA50_1>=TRUE && LA50_1<=UNARY_MINUS)||LA50_1==UNION||LA50_1==VECTOR_EXPR||LA50_1==ALIAS_REF||LA50_1==NAMED_PARAM||LA50_1==SQL_TOKEN)) { alt50 = 1; } } finally { DebugExitDecision(50); } switch ( alt50 ) { case 1: DebugEnterAlt(1); // SqlGenerator.g:250:34: e= expr { DebugLocation(250, 35); PushFollow(Follow._expr_in_expr1394); e=expr(); PopFollow(); if (state.failed) return retval; DebugLocation(250, 41); if (state.backtracking == 0) { Separator((e!=null?((IASTNode)e.Start):default(IASTNode))," , "); } } break; default: goto loop50; } } loop50: ; } finally { DebugExitSubRule(50); } DebugLocation(250, 76); if (state.backtracking == 0) { Out(")"); } Match(input, TokenTypes.Up, null); if (state.failed) return retval; } } break; case 3: DebugEnterAlt(3); // SqlGenerator.g:251:4: parenSelect { DebugLocation(251, 4); PushFollow(Follow._parenSelect_in_expr1409); parenSelect(); PopFollow(); if (state.failed) return retval; } break; case 4: DebugEnterAlt(4); // SqlGenerator.g:252:4: ^( ANY quantified ) { DebugLocation(252, 4); DebugLocation(252, 6); Match(input,ANY,Follow._ANY_in_expr1415); if (state.failed) return retval; DebugLocation(252, 10); if (state.backtracking == 0) { Out("any "); } Match(input, TokenTypes.Down, null); if (state.failed) return retval; DebugLocation(252, 27); PushFollow(Follow._quantified_in_expr1419); quantified(); PopFollow(); if (state.failed) return retval; Match(input, TokenTypes.Up, null); if (state.failed) return retval; } break; case 5: DebugEnterAlt(5); // SqlGenerator.g:253:4: ^( ALL quantified ) { DebugLocation(253, 4); DebugLocation(253, 6); Match(input,ALL,Follow._ALL_in_expr1427); if (state.failed) return retval; DebugLocation(253, 10); if (state.backtracking == 0) { Out("all "); } Match(input, TokenTypes.Down, null); if (state.failed) return retval; DebugLocation(253, 27); PushFollow(Follow._quantified_in_expr1431); quantified(); PopFollow(); if (state.failed) return retval; Match(input, TokenTypes.Up, null); if (state.failed) return retval; } break; case 6: DebugEnterAlt(6); // SqlGenerator.g:254:4: ^( SOME quantified ) { DebugLocation(254, 4); DebugLocation(254, 6); Match(input,SOME,Follow._SOME_in_expr1439); if (state.failed) return retval; DebugLocation(254, 11); if (state.backtracking == 0) { Out("some "); } Match(input, TokenTypes.Down, null); if (state.failed) return retval; DebugLocation(254, 29); PushFollow(Follow._quantified_in_expr1443); quantified(); PopFollow(); if (state.failed) return retval; Match(input, TokenTypes.Up, null); if (state.failed) return retval; } break; } } catch (RecognitionException re) { ReportError(re); Recover(input,re); } finally { TraceOut("expr", 34); LeaveRule("expr", 34); LeaveRule_expr(); } DebugLocation(255, 1); } finally { DebugExitRule(GrammarFileName, "expr"); } return retval; }
private TreeRuleReturnScope<IASTNode> selectAtom() { EnterRule_selectAtom(); EnterRule("selectAtom", 22); TraceIn("selectAtom", 22); TreeRuleReturnScope<IASTNode> retval = new TreeRuleReturnScope<IASTNode>(); retval.Start = (IASTNode)input.LT(1); try { DebugEnterRule(GrammarFileName, "selectAtom"); DebugLocation(165, 1); try { // SqlGenerator.g:166:2: ( ^( DOT ( . )* ) | ^( SQL_TOKEN ( . )* ) | ^( ALIAS_REF ( . )* ) | ^( SELECT_EXPR ( . )* ) ) int alt34=4; try { DebugEnterDecision(34, false); switch (input.LA(1)) { case DOT: { alt34 = 1; } break; case SQL_TOKEN: { alt34 = 2; } break; case ALIAS_REF: { alt34 = 3; } break; case SELECT_EXPR: { alt34 = 4; } break; default: { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 34, 0, input, 1); DebugRecognitionException(nvae); throw nvae; } } } finally { DebugExitDecision(34); } switch (alt34) { case 1: DebugEnterAlt(1); // SqlGenerator.g:166:4: ^( DOT ( . )* ) { DebugLocation(166, 4); DebugLocation(166, 6); Match(input,DOT,Follow._DOT_in_selectAtom792); if (state.failed) return retval; if (input.LA(1) == TokenTypes.Down) { Match(input, TokenTypes.Down, null); if (state.failed) return retval; DebugLocation(166, 10); // SqlGenerator.g:166:10: ( . )* try { DebugEnterSubRule(30); while (true) { int alt30=2; try { DebugEnterDecision(30, false); int LA30_1 = input.LA(1); if (((LA30_1>=AGGREGATE && LA30_1<=THETA_JOINS))) { alt30 = 1; } else if ((LA30_1==UP)) { alt30 = 2; } } finally { DebugExitDecision(30); } switch ( alt30 ) { case 1: DebugEnterAlt(1); // SqlGenerator.g:166:10: . { DebugLocation(166, 10); MatchAny(input); if (state.failed) return retval; } break; default: goto loop30; } } loop30: ; } finally { DebugExitSubRule(30); } Match(input, TokenTypes.Up, null); if (state.failed) return retval; } } break; case 2: DebugEnterAlt(2); // SqlGenerator.g:167:4: ^( SQL_TOKEN ( . )* ) { DebugLocation(167, 4); DebugLocation(167, 6); Match(input,SQL_TOKEN,Follow._SQL_TOKEN_in_selectAtom802); if (state.failed) return retval; if (input.LA(1) == TokenTypes.Down) { Match(input, TokenTypes.Down, null); if (state.failed) return retval; DebugLocation(167, 16); // SqlGenerator.g:167:16: ( . )* try { DebugEnterSubRule(31); while (true) { int alt31=2; try { DebugEnterDecision(31, false); int LA31_1 = input.LA(1); if (((LA31_1>=AGGREGATE && LA31_1<=THETA_JOINS))) { alt31 = 1; } else if ((LA31_1==UP)) { alt31 = 2; } } finally { DebugExitDecision(31); } switch ( alt31 ) { case 1: DebugEnterAlt(1); // SqlGenerator.g:167:16: . { DebugLocation(167, 16); MatchAny(input); if (state.failed) return retval; } break; default: goto loop31; } } loop31: ; } finally { DebugExitSubRule(31); } Match(input, TokenTypes.Up, null); if (state.failed) return retval; } } break; case 3: DebugEnterAlt(3); // SqlGenerator.g:168:4: ^( ALIAS_REF ( . )* ) { DebugLocation(168, 4); DebugLocation(168, 6); Match(input,ALIAS_REF,Follow._ALIAS_REF_in_selectAtom812); if (state.failed) return retval; if (input.LA(1) == TokenTypes.Down) { Match(input, TokenTypes.Down, null); if (state.failed) return retval; DebugLocation(168, 16); // SqlGenerator.g:168:16: ( . )* try { DebugEnterSubRule(32); while (true) { int alt32=2; try { DebugEnterDecision(32, false); int LA32_1 = input.LA(1); if (((LA32_1>=AGGREGATE && LA32_1<=THETA_JOINS))) { alt32 = 1; } else if ((LA32_1==UP)) { alt32 = 2; } } finally { DebugExitDecision(32); } switch ( alt32 ) { case 1: DebugEnterAlt(1); // SqlGenerator.g:168:16: . { DebugLocation(168, 16); MatchAny(input); if (state.failed) return retval; } break; default: goto loop32; } } loop32: ; } finally { DebugExitSubRule(32); } Match(input, TokenTypes.Up, null); if (state.failed) return retval; } } break; case 4: DebugEnterAlt(4); // SqlGenerator.g:169:4: ^( SELECT_EXPR ( . )* ) { DebugLocation(169, 4); DebugLocation(169, 6); Match(input,SELECT_EXPR,Follow._SELECT_EXPR_in_selectAtom822); if (state.failed) return retval; if (input.LA(1) == TokenTypes.Down) { Match(input, TokenTypes.Down, null); if (state.failed) return retval; DebugLocation(169, 18); // SqlGenerator.g:169:18: ( . )* try { DebugEnterSubRule(33); while (true) { int alt33=2; try { DebugEnterDecision(33, false); int LA33_1 = input.LA(1); if (((LA33_1>=AGGREGATE && LA33_1<=THETA_JOINS))) { alt33 = 1; } else if ((LA33_1==UP)) { alt33 = 2; } } finally { DebugExitDecision(33); } switch ( alt33 ) { case 1: DebugEnterAlt(1); // SqlGenerator.g:169:18: . { DebugLocation(169, 18); MatchAny(input); if (state.failed) return retval; } break; default: goto loop33; } } loop33: ; } finally { DebugExitSubRule(33); } Match(input, TokenTypes.Up, null); if (state.failed) return retval; } } break; } } catch (RecognitionException re) { ReportError(re); Recover(input,re); } finally { TraceOut("selectAtom", 22); LeaveRule("selectAtom", 22); LeaveRule_selectAtom(); } DebugLocation(170, 1); } finally { DebugExitRule(GrammarFileName, "selectAtom"); } return retval; }
private TreeRuleReturnScope<IASTNode> selectExpr() { EnterRule_selectExpr(); EnterRule("selectExpr", 18); TraceIn("selectExpr", 18); TreeRuleReturnScope<IASTNode> retval = new TreeRuleReturnScope<IASTNode>(); retval.Start = (IASTNode)input.LT(1); TreeRuleReturnScope<IASTNode> e = default(TreeRuleReturnScope<IASTNode>); TreeRuleReturnScope<IASTNode> c = default(TreeRuleReturnScope<IASTNode>); try { DebugEnterRule(GrammarFileName, "selectExpr"); DebugLocation(136, 1); try { // SqlGenerator.g:137:2: (e= selectAtom | count | ^( CONSTRUCTOR ( DOT | IDENT ) ( selectColumn )+ ) | methodCall | aggregate |c= constant | arithmeticExpr | parameter | selectStatement ) int alt25=9; try { DebugEnterDecision(25, false); switch (input.LA(1)) { case DOT: case ALIAS_REF: case SELECT_EXPR: case SQL_TOKEN: { alt25 = 1; } break; case COUNT: { alt25 = 2; } break; case CONSTRUCTOR: { alt25 = 3; } break; case METHOD_CALL: { alt25 = 4; } break; case AGGREGATE: { alt25 = 5; } break; case CONSTANT: case FALSE: case IDENT: case JAVA_CONSTANT: case NUM_DECIMAL: case NUM_DOUBLE: case NUM_FLOAT: case NUM_INT: case NUM_LONG: case QUOTED_String: case TRUE: { alt25 = 6; } break; case BAND: case BNOT: case BOR: case BXOR: case CASE: case CASE2: case DIV: case MINUS: case PLUS: case STAR: case UNARY_MINUS: { alt25 = 7; } break; case PARAM: case NAMED_PARAM: { alt25 = 8; } break; case SELECT: { alt25 = 9; } break; default: { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 25, 0, input, 1); DebugRecognitionException(nvae); throw nvae; } } } finally { DebugExitDecision(25); } switch (alt25) { case 1: DebugEnterAlt(1); // SqlGenerator.g:137:4: e= selectAtom { DebugLocation(137, 5); PushFollow(Follow._selectAtom_in_selectExpr636); e=selectAtom(); PopFollow(); if (state.failed) return retval; DebugLocation(137, 17); if (state.backtracking == 0) { Out((e!=null?((IASTNode)e.Start):default(IASTNode))); } } break; case 2: DebugEnterAlt(2); // SqlGenerator.g:138:4: count { DebugLocation(138, 4); PushFollow(Follow._count_in_selectExpr643); count(); PopFollow(); if (state.failed) return retval; } break; case 3: DebugEnterAlt(3); // SqlGenerator.g:139:4: ^( CONSTRUCTOR ( DOT | IDENT ) ( selectColumn )+ ) { DebugLocation(139, 4); DebugLocation(139, 6); Match(input,CONSTRUCTOR,Follow._CONSTRUCTOR_in_selectExpr649); if (state.failed) return retval; Match(input, TokenTypes.Down, null); if (state.failed) return retval; DebugLocation(139, 18); if (input.LA(1)==DOT||input.LA(1)==IDENT) { input.Consume(); state.errorRecovery=false;state.failed=false; } else { if (state.backtracking>0) {state.failed=true; return retval;} MismatchedSetException mse = new MismatchedSetException(null,input); DebugRecognitionException(mse); throw mse; } DebugLocation(139, 32); // SqlGenerator.g:139:32: ( selectColumn )+ int cnt24=0; try { DebugEnterSubRule(24); while (true) { int alt24=2; try { DebugEnterDecision(24, false); int LA24_1 = input.LA(1); if ((LA24_1==AGGREGATE||LA24_1==BAND||(LA24_1>=BNOT && LA24_1<=BOR)||(LA24_1>=BXOR && LA24_1<=CASE2)||(LA24_1>=CONSTANT && LA24_1<=COUNT)||(LA24_1>=DIV && LA24_1<=DOT)||LA24_1==FALSE||LA24_1==IDENT||LA24_1==JAVA_CONSTANT||LA24_1==METHOD_CALL||LA24_1==MINUS||(LA24_1>=NUM_DECIMAL && LA24_1<=NUM_LONG)||(LA24_1>=PARAM && LA24_1<=PLUS)||LA24_1==QUOTED_String||LA24_1==SELECT||LA24_1==STAR||(LA24_1>=TRUE && LA24_1<=UNARY_MINUS)||LA24_1==ALIAS_REF||LA24_1==NAMED_PARAM||(LA24_1>=SELECT_EXPR && LA24_1<=SQL_TOKEN))) { alt24 = 1; } } finally { DebugExitDecision(24); } switch (alt24) { case 1: DebugEnterAlt(1); // SqlGenerator.g:139:34: selectColumn { DebugLocation(139, 34); PushFollow(Follow._selectColumn_in_selectExpr661); selectColumn(); PopFollow(); if (state.failed) return retval; } break; default: if (cnt24 >= 1) goto loop24; if (state.backtracking>0) {state.failed=true; return retval;} EarlyExitException eee24 = new EarlyExitException( 24, input ); DebugRecognitionException(eee24); throw eee24; } cnt24++; } loop24: ; } finally { DebugExitSubRule(24); } Match(input, TokenTypes.Up, null); if (state.failed) return retval; } break; case 4: DebugEnterAlt(4); // SqlGenerator.g:140:4: methodCall { DebugLocation(140, 4); PushFollow(Follow._methodCall_in_selectExpr671); methodCall(); PopFollow(); if (state.failed) return retval; } break; case 5: DebugEnterAlt(5); // SqlGenerator.g:141:4: aggregate { DebugLocation(141, 4); PushFollow(Follow._aggregate_in_selectExpr676); aggregate(); PopFollow(); if (state.failed) return retval; } break; case 6: DebugEnterAlt(6); // SqlGenerator.g:142:4: c= constant { DebugLocation(142, 5); PushFollow(Follow._constant_in_selectExpr683); c=constant(); PopFollow(); if (state.failed) return retval; DebugLocation(142, 15); if (state.backtracking == 0) { Out((c!=null?((IASTNode)c.Start):default(IASTNode))); } } break; case 7: DebugEnterAlt(7); // SqlGenerator.g:143:4: arithmeticExpr { DebugLocation(143, 4); PushFollow(Follow._arithmeticExpr_in_selectExpr690); arithmeticExpr(); PopFollow(); if (state.failed) return retval; } break; case 8: DebugEnterAlt(8); // SqlGenerator.g:144:4: parameter { DebugLocation(144, 4); PushFollow(Follow._parameter_in_selectExpr695); parameter(); PopFollow(); if (state.failed) return retval; } break; case 9: DebugEnterAlt(9); // SqlGenerator.g:147:4: selectStatement { DebugLocation(147, 4); if (state.backtracking == 0) { Out("("); } DebugLocation(147, 18); PushFollow(Follow._selectStatement_in_selectExpr704); selectStatement(); PopFollow(); if (state.failed) return retval; DebugLocation(147, 34); if (state.backtracking == 0) { Out(")"); } } break; } } catch (RecognitionException re) { ReportError(re); Recover(input,re); } finally { TraceOut("selectExpr", 18); LeaveRule("selectExpr", 18); LeaveRule_selectExpr(); } DebugLocation(148, 1); } finally { DebugExitRule(GrammarFileName, "selectExpr"); } return retval; }
private TreeRuleReturnScope<IASTNode> orderDirection() { EnterRule_orderDirection(); EnterRule("orderDirection", 11); TraceIn("orderDirection", 11); TreeRuleReturnScope<IASTNode> retval = new TreeRuleReturnScope<IASTNode>(); retval.Start = (IASTNode)input.LT(1); try { DebugEnterRule(GrammarFileName, "orderDirection"); DebugLocation(99, 1); try { // SqlGenerator.g:100:2: ( ASCENDING | DESCENDING ) DebugEnterAlt(1); // SqlGenerator.g: { DebugLocation(100, 2); if (input.LA(1)==ASCENDING||input.LA(1)==DESCENDING) { input.Consume(); state.errorRecovery=false;state.failed=false; } else { if (state.backtracking>0) {state.failed=true; return retval;} MismatchedSetException mse = new MismatchedSetException(null,input); DebugRecognitionException(mse); throw mse; } } } catch (RecognitionException re) { ReportError(re); Recover(input,re); } finally { TraceOut("orderDirection", 11); LeaveRule("orderDirection", 11); LeaveRule_orderDirection(); } DebugLocation(102, 1); } finally { DebugExitRule(GrammarFileName, "orderDirection"); } return retval; }