private AstParserRuleReturnScope<CommonTree, IToken> match_expr() { EnterRule_match_expr(); EnterRule("match_expr", 62); TraceIn("match_expr", 62); AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>(); retval.Start = (IToken)input.LT(1); CommonTree root_0 = default(CommonTree); IToken string_literal647 = default(IToken); IToken WS648 = default(IToken); IToken WS650 = default(IToken); IToken string_literal651 = default(IToken); IToken WS652 = default(IToken); IToken WS654 = default(IToken); IToken NEWLINE655 = default(IToken); IToken INDENT656 = default(IToken); IToken NEWLINE657 = default(IToken); IToken WS659 = default(IToken); IToken NEWLINE660 = default(IToken); IToken DEDENT661 = default(IToken); AstParserRuleReturnScope<CommonTree, IToken> expr649 = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> type_name653 = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> match_item658 = default(AstParserRuleReturnScope<CommonTree, IToken>); CommonTree string_literal647_tree = default(CommonTree); CommonTree WS648_tree = default(CommonTree); CommonTree WS650_tree = default(CommonTree); CommonTree string_literal651_tree = default(CommonTree); CommonTree WS652_tree = default(CommonTree); CommonTree WS654_tree = default(CommonTree); CommonTree NEWLINE655_tree = default(CommonTree); CommonTree INDENT656_tree = default(CommonTree); CommonTree NEWLINE657_tree = default(CommonTree); CommonTree WS659_tree = default(CommonTree); CommonTree NEWLINE660_tree = default(CommonTree); CommonTree DEDENT661_tree = default(CommonTree); RewriteRuleITokenStream stream_WS=new RewriteRuleITokenStream(adaptor,"token WS"); RewriteRuleITokenStream stream_DEDENT=new RewriteRuleITokenStream(adaptor,"token DEDENT"); RewriteRuleITokenStream stream_NEWLINE=new RewriteRuleITokenStream(adaptor,"token NEWLINE"); RewriteRuleITokenStream stream_158=new RewriteRuleITokenStream(adaptor,"token 158"); RewriteRuleITokenStream stream_INDENT=new RewriteRuleITokenStream(adaptor,"token INDENT"); RewriteRuleITokenStream stream_165=new RewriteRuleITokenStream(adaptor,"token 165"); RewriteRuleSubtreeStream stream_match_item=new RewriteRuleSubtreeStream(adaptor,"rule match_item"); RewriteRuleSubtreeStream stream_type_name=new RewriteRuleSubtreeStream(adaptor,"rule type_name"); RewriteRuleSubtreeStream stream_expr=new RewriteRuleSubtreeStream(adaptor,"rule expr"); try { DebugEnterRule(GrammarFileName, "match_expr"); DebugLocation(560, 1); try { // SugarCpp.g:561:2: ( 'match' ( ( WS )* expr )? ( ( WS )* 'returns' ( WS )* type_name )? ( WS )* ( NEWLINE )+ INDENT ( NEWLINE )* ( match_item ( WS )* ( NEWLINE )+ )+ DEDENT -> ^( Match_Expr ( expr )? ( type_name )? ( match_item )+ ) ) DebugEnterAlt(1); // SugarCpp.g:561:4: 'match' ( ( WS )* expr )? ( ( WS )* 'returns' ( WS )* type_name )? ( WS )* ( NEWLINE )+ INDENT ( NEWLINE )* ( match_item ( WS )* ( NEWLINE )+ )+ DEDENT { DebugLocation(561, 4); string_literal647=(IToken)Match(input,158,Follow._158_in_match_expr5936); if (state.failed) return retval; if (state.backtracking == 0) stream_158.Add(string_literal647); DebugLocation(561, 12); // SugarCpp.g:561:12: ( ( WS )* expr )? int alt420=2; try { DebugEnterSubRule(420); try { DebugEnterDecision(420, false); try { alt420 = dfa420.Predict(input); } catch (NoViableAltException nvae) { DebugRecognitionException(nvae); throw; } } finally { DebugExitDecision(420); } switch (alt420) { case 1: DebugEnterAlt(1); // SugarCpp.g:561:13: ( WS )* expr { DebugLocation(561, 13); // SugarCpp.g:561:13: ( WS )* try { DebugEnterSubRule(419); while (true) { int alt419=2; try { DebugEnterDecision(419, false); int LA419_0 = input.LA(1); if ((LA419_0==WS)) { alt419 = 1; } } finally { DebugExitDecision(419); } switch ( alt419 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:561:13: WS { DebugLocation(561, 13); WS648=(IToken)Match(input,WS,Follow._WS_in_match_expr5939); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS648); } break; default: goto loop419; } } loop419: ; } finally { DebugExitSubRule(419); } DebugLocation(561, 17); PushFollow(Follow._expr_in_match_expr5942); expr649=expr(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_expr.Add(expr649.Tree); } break; } } finally { DebugExitSubRule(420); } DebugLocation(561, 24); // SugarCpp.g:561:24: ( ( WS )* 'returns' ( WS )* type_name )? int alt423=2; try { DebugEnterSubRule(423); try { DebugEnterDecision(423, false); try { alt423 = dfa423.Predict(input); } catch (NoViableAltException nvae) { DebugRecognitionException(nvae); throw; } } finally { DebugExitDecision(423); } switch (alt423) { case 1: DebugEnterAlt(1); // SugarCpp.g:561:25: ( WS )* 'returns' ( WS )* type_name { DebugLocation(561, 25); // SugarCpp.g:561:25: ( WS )* try { DebugEnterSubRule(421); while (true) { int alt421=2; try { DebugEnterDecision(421, false); int LA421_0 = input.LA(1); if ((LA421_0==WS)) { alt421 = 1; } } finally { DebugExitDecision(421); } switch ( alt421 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:561:25: WS { DebugLocation(561, 25); WS650=(IToken)Match(input,WS,Follow._WS_in_match_expr5947); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS650); } break; default: goto loop421; } } loop421: ; } finally { DebugExitSubRule(421); } DebugLocation(561, 29); string_literal651=(IToken)Match(input,165,Follow._165_in_match_expr5950); if (state.failed) return retval; if (state.backtracking == 0) stream_165.Add(string_literal651); DebugLocation(561, 39); // SugarCpp.g:561:39: ( WS )* try { DebugEnterSubRule(422); while (true) { int alt422=2; try { DebugEnterDecision(422, false); int LA422_0 = input.LA(1); if ((LA422_0==WS)) { alt422 = 1; } } finally { DebugExitDecision(422); } switch ( alt422 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:561:39: WS { DebugLocation(561, 39); WS652=(IToken)Match(input,WS,Follow._WS_in_match_expr5952); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS652); } break; default: goto loop422; } } loop422: ; } finally { DebugExitSubRule(422); } DebugLocation(561, 43); PushFollow(Follow._type_name_in_match_expr5955); type_name653=type_name(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_type_name.Add(type_name653.Tree); } break; } } finally { DebugExitSubRule(423); } DebugLocation(561, 55); // SugarCpp.g:561:55: ( WS )* try { DebugEnterSubRule(424); while (true) { int alt424=2; try { DebugEnterDecision(424, false); int LA424_0 = input.LA(1); if ((LA424_0==WS)) { alt424 = 1; } } finally { DebugExitDecision(424); } switch ( alt424 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:561:55: WS { DebugLocation(561, 55); WS654=(IToken)Match(input,WS,Follow._WS_in_match_expr5959); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS654); } break; default: goto loop424; } } loop424: ; } finally { DebugExitSubRule(424); } DebugLocation(561, 59); // SugarCpp.g:561:59: ( NEWLINE )+ int cnt425=0; try { DebugEnterSubRule(425); while (true) { int alt425=2; try { DebugEnterDecision(425, false); int LA425_0 = input.LA(1); if ((LA425_0==NEWLINE)) { alt425 = 1; } } finally { DebugExitDecision(425); } switch (alt425) { case 1: DebugEnterAlt(1); // SugarCpp.g:561:59: NEWLINE { DebugLocation(561, 59); NEWLINE655=(IToken)Match(input,NEWLINE,Follow._NEWLINE_in_match_expr5962); if (state.failed) return retval; if (state.backtracking == 0) stream_NEWLINE.Add(NEWLINE655); } break; default: if (cnt425 >= 1) goto loop425; if (state.backtracking>0) {state.failed=true; return retval;} EarlyExitException eee425 = new EarlyExitException( 425, input ); DebugRecognitionException(eee425); throw eee425; } cnt425++; } loop425: ; } finally { DebugExitSubRule(425); } DebugLocation(561, 68); INDENT656=(IToken)Match(input,INDENT,Follow._INDENT_in_match_expr5965); if (state.failed) return retval; if (state.backtracking == 0) stream_INDENT.Add(INDENT656); DebugLocation(561, 75); // SugarCpp.g:561:75: ( NEWLINE )* try { DebugEnterSubRule(426); while (true) { int alt426=2; try { DebugEnterDecision(426, false); int LA426_0 = input.LA(1); if ((LA426_0==NEWLINE)) { alt426 = 1; } } finally { DebugExitDecision(426); } switch ( alt426 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:561:75: NEWLINE { DebugLocation(561, 75); NEWLINE657=(IToken)Match(input,NEWLINE,Follow._NEWLINE_in_match_expr5967); if (state.failed) return retval; if (state.backtracking == 0) stream_NEWLINE.Add(NEWLINE657); } break; default: goto loop426; } } loop426: ; } finally { DebugExitSubRule(426); } DebugLocation(561, 84); // SugarCpp.g:561:84: ( match_item ( WS )* ( NEWLINE )+ )+ int cnt429=0; try { DebugEnterSubRule(429); while (true) { int alt429=2; try { DebugEnterDecision(429, false); int LA429_0 = input.LA(1); if ((LA429_0==182)) { alt429 = 1; } } finally { DebugExitDecision(429); } switch (alt429) { case 1: DebugEnterAlt(1); // SugarCpp.g:561:85: match_item ( WS )* ( NEWLINE )+ { DebugLocation(561, 85); PushFollow(Follow._match_item_in_match_expr5971); match_item658=match_item(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_match_item.Add(match_item658.Tree); DebugLocation(561, 96); // SugarCpp.g:561:96: ( WS )* try { DebugEnterSubRule(427); while (true) { int alt427=2; try { DebugEnterDecision(427, false); int LA427_0 = input.LA(1); if ((LA427_0==WS)) { alt427 = 1; } } finally { DebugExitDecision(427); } switch ( alt427 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:561:96: WS { DebugLocation(561, 96); WS659=(IToken)Match(input,WS,Follow._WS_in_match_expr5973); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS659); } break; default: goto loop427; } } loop427: ; } finally { DebugExitSubRule(427); } DebugLocation(561, 100); // SugarCpp.g:561:100: ( NEWLINE )+ int cnt428=0; try { DebugEnterSubRule(428); while (true) { int alt428=2; try { DebugEnterDecision(428, false); int LA428_0 = input.LA(1); if ((LA428_0==NEWLINE)) { alt428 = 1; } } finally { DebugExitDecision(428); } switch (alt428) { case 1: DebugEnterAlt(1); // SugarCpp.g:561:100: NEWLINE { DebugLocation(561, 100); NEWLINE660=(IToken)Match(input,NEWLINE,Follow._NEWLINE_in_match_expr5976); if (state.failed) return retval; if (state.backtracking == 0) stream_NEWLINE.Add(NEWLINE660); } break; default: if (cnt428 >= 1) goto loop428; if (state.backtracking>0) {state.failed=true; return retval;} EarlyExitException eee428 = new EarlyExitException( 428, input ); DebugRecognitionException(eee428); throw eee428; } cnt428++; } loop428: ; } finally { DebugExitSubRule(428); } } break; default: if (cnt429 >= 1) goto loop429; if (state.backtracking>0) {state.failed=true; return retval;} EarlyExitException eee429 = new EarlyExitException( 429, input ); DebugRecognitionException(eee429); throw eee429; } cnt429++; } loop429: ; } finally { DebugExitSubRule(429); } DebugLocation(561, 111); DEDENT661=(IToken)Match(input,DEDENT,Follow._DEDENT_in_match_expr5981); if (state.failed) return retval; if (state.backtracking == 0) stream_DEDENT.Add(DEDENT661); { // AST REWRITE // elements: expr, type_name, match_item // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: if (state.backtracking == 0) { retval.Tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null); root_0 = (CommonTree)adaptor.Nil(); // 561:118: -> ^( Match_Expr ( expr )? ( type_name )? ( match_item )+ ) { DebugLocation(561, 121); // SugarCpp.g:561:121: ^( Match_Expr ( expr )? ( type_name )? ( match_item )+ ) { CommonTree root_1 = (CommonTree)adaptor.Nil(); DebugLocation(561, 123); root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(Match_Expr, "Match_Expr"), root_1); DebugLocation(561, 134); // SugarCpp.g:561:134: ( expr )? if (stream_expr.HasNext) { DebugLocation(561, 134); adaptor.AddChild(root_1, stream_expr.NextTree()); } stream_expr.Reset(); DebugLocation(561, 140); // SugarCpp.g:561:140: ( type_name )? if (stream_type_name.HasNext) { DebugLocation(561, 140); adaptor.AddChild(root_1, stream_type_name.NextTree()); } stream_type_name.Reset(); DebugLocation(561, 151); if (!(stream_match_item.HasNext)) { throw new RewriteEarlyExitException(); } while ( stream_match_item.HasNext ) { DebugLocation(561, 151); adaptor.AddChild(root_1, stream_match_item.NextTree()); } stream_match_item.Reset(); adaptor.AddChild(root_0, root_1); } } retval.Tree = root_0; } } } retval.Stop = (IToken)input.LT(-1); if (state.backtracking == 0) { retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0); adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop); } } catch (RecognitionException re) { ReportError(re); Recover(input,re); retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re); } finally { TraceOut("match_expr", 62); LeaveRule("match_expr", 62); LeaveRule_match_expr(); } DebugLocation(562, 1); } finally { DebugExitRule(GrammarFileName, "match_expr"); } return retval; }
// $ANTLR start "classDeclaration" // C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:79:1: classDeclaration : 'class' name ( baseClassDeclaration )? classStatementBlock -> ^( CLASS name ( baseClassDeclaration )? classStatementBlock ) ; public classDeclaration_return classDeclaration() // throws RecognitionException [1] { var retval = new classDeclaration_return(); retval.Start = input.LT( 1 ); CommonTree root_0 = null; IToken string_literal4 = null; name_return name5 = default( name_return ); baseClassDeclaration_return baseClassDeclaration6 = default( baseClassDeclaration_return ); classStatementBlock_return classStatementBlock7 = default( classStatementBlock_return ); CommonTree string_literal4_tree = null; var stream_57 = new RewriteRuleTokenStream( adaptor, "token 57" ); var stream_classStatementBlock = new RewriteRuleSubtreeStream( adaptor, "rule classStatementBlock" ); var stream_name = new RewriteRuleSubtreeStream( adaptor, "rule name" ); var stream_baseClassDeclaration = new RewriteRuleSubtreeStream( adaptor, "rule baseClassDeclaration" ); try { // C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:80:2: ( 'class' name ( baseClassDeclaration )? classStatementBlock -> ^( CLASS name ( baseClassDeclaration )? classStatementBlock ) ) // C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:80:4: 'class' name ( baseClassDeclaration )? classStatementBlock { string_literal4 = (IToken)Match( input, 57, FOLLOW_57_in_classDeclaration262 ); stream_57.Add( string_literal4 ); PushFollow( FOLLOW_name_in_classDeclaration264 ); name5 = name(); state.followingStackPointer--; stream_name.Add( name5.Tree ); // C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:80:17: ( baseClassDeclaration )? int alt3 = 2; int LA3_0 = input.LA( 1 ); if ( ( LA3_0 == 58 ) ) alt3 = 1; switch ( alt3 ) { case 1: // C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:80:17: baseClassDeclaration { PushFollow( FOLLOW_baseClassDeclaration_in_classDeclaration266 ); baseClassDeclaration6 = baseClassDeclaration(); state.followingStackPointer--; stream_baseClassDeclaration.Add( baseClassDeclaration6.Tree ); } break; } PushFollow( FOLLOW_classStatementBlock_in_classDeclaration269 ); classStatementBlock7 = classStatementBlock(); state.followingStackPointer--; stream_classStatementBlock.Add( classStatementBlock7.Tree ); // AST REWRITE // elements: name, classStatementBlock, baseClassDeclaration // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: retval.Tree = root_0; var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null ); root_0 = (CommonTree)adaptor.GetNilNode(); // 80:59: -> ^( CLASS name ( baseClassDeclaration )? classStatementBlock ) { // C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:80:62: ^( CLASS name ( baseClassDeclaration )? classStatementBlock ) { var root_1 = (CommonTree)adaptor.GetNilNode(); root_1 = (CommonTree)adaptor.BecomeRoot( adaptor.Create( CLASS, "CLASS" ), root_1 ); adaptor.AddChild( root_1, stream_name.NextTree() ); // C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:80:76: ( baseClassDeclaration )? if ( stream_baseClassDeclaration.HasNext() ) adaptor.AddChild( root_1, stream_baseClassDeclaration.NextTree() ); stream_baseClassDeclaration.Reset(); adaptor.AddChild( root_1, stream_classStatementBlock.NextTree() ); adaptor.AddChild( root_0, root_1 ); } } retval.Tree = root_0; retval.Tree = root_0; } retval.Stop = input.LT( -1 ); retval.Tree = adaptor.RulePostProcessing( root_0 ); adaptor.SetTokenBoundaries( retval.Tree, (IToken)retval.Start, (IToken)retval.Stop ); } catch ( RecognitionException re ) { ReportError( re ); Recover( input, re ); // Conversion of the second argument necessary, but harmless retval.Tree = adaptor.ErrorNode( input, (IToken)retval.Start, input.LT( -1 ), re ); } finally {} return retval; }
// $ANTLR start "classStatementBlock" // C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:85:1: classStatementBlock : '{' ( classLevelStatement )* '}' -> ^( STATEMENT_BLOCK ( classLevelStatement )* ) ; public classStatementBlock_return classStatementBlock() // throws RecognitionException [1] { var retval = new classStatementBlock_return(); retval.Start = input.LT( 1 ); CommonTree root_0 = null; IToken char_literal12 = null; IToken char_literal14 = null; classLevelStatement_return classLevelStatement13 = default( classLevelStatement_return ); CommonTree char_literal12_tree = null; CommonTree char_literal14_tree = null; var stream_60 = new RewriteRuleTokenStream( adaptor, "token 60" ); var stream_61 = new RewriteRuleTokenStream( adaptor, "token 61" ); var stream_classLevelStatement = new RewriteRuleSubtreeStream( adaptor, "rule classLevelStatement" ); try { // C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:86:2: ( '{' ( classLevelStatement )* '}' -> ^( STATEMENT_BLOCK ( classLevelStatement )* ) ) // C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:86:4: '{' ( classLevelStatement )* '}' { char_literal12 = (IToken)Match( input, 60, FOLLOW_60_in_classStatementBlock328 ); stream_60.Add( char_literal12 ); // C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:86:8: ( classLevelStatement )* do { int alt4 = 2; int LA4_0 = input.LA( 1 ); if ( ( LA4_0 == 62 || LA4_0 == 67 ) ) alt4 = 1; switch ( alt4 ) { case 1: // C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:86:8: classLevelStatement { PushFollow( FOLLOW_classLevelStatement_in_classStatementBlock330 ); classLevelStatement13 = classLevelStatement(); state.followingStackPointer--; stream_classLevelStatement.Add( classLevelStatement13.Tree ); } break; default: goto loop4; } } while ( true ); loop4: ; // Stops C# compiler whining that label 'loop4' has no statements char_literal14 = (IToken)Match( input, 61, FOLLOW_61_in_classStatementBlock333 ); stream_61.Add( char_literal14 ); // AST REWRITE // elements: classLevelStatement // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: retval.Tree = root_0; var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null ); root_0 = (CommonTree)adaptor.GetNilNode(); // 86:33: -> ^( STATEMENT_BLOCK ( classLevelStatement )* ) { // C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:86:36: ^( STATEMENT_BLOCK ( classLevelStatement )* ) { var root_1 = (CommonTree)adaptor.GetNilNode(); root_1 = (CommonTree)adaptor.BecomeRoot( adaptor.Create( STATEMENT_BLOCK, "STATEMENT_BLOCK" ), root_1 ); // C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:86:55: ( classLevelStatement )* while ( stream_classLevelStatement.HasNext() ) adaptor.AddChild( root_1, stream_classLevelStatement.NextTree() ); stream_classLevelStatement.Reset(); adaptor.AddChild( root_0, root_1 ); } } retval.Tree = root_0; retval.Tree = root_0; } retval.Stop = input.LT( -1 ); retval.Tree = adaptor.RulePostProcessing( root_0 ); adaptor.SetTokenBoundaries( retval.Tree, (IToken)retval.Start, (IToken)retval.Stop ); } catch ( RecognitionException re ) { ReportError( re ); Recover( input, re ); // Conversion of the second argument necessary, but harmless retval.Tree = adaptor.ErrorNode( input, (IToken)retval.Start, input.LT( -1 ), re ); } finally {} return retval; }
private AstParserRuleReturnScope<object, IToken> lambda_expression() { EnterRule_lambda_expression(); EnterRule("lambda_expression", 4); TraceIn("lambda_expression", 4); AstParserRuleReturnScope<object, IToken> retval = new AstParserRuleReturnScope<object, IToken>(); retval.Start = (IToken)input.LT(1); object root_0 = default(object); IToken char_literal8 = default(IToken); AstParserRuleReturnScope<object, IToken> or_expression7 = default(AstParserRuleReturnScope<object, IToken>); AstParserRuleReturnScope<object, IToken> or_expression9 = default(AstParserRuleReturnScope<object, IToken>); object char_literal8_tree = default(object); RewriteRuleITokenStream stream_51=new RewriteRuleITokenStream(adaptor,"token 51"); RewriteRuleSubtreeStream stream_or_expression=new RewriteRuleSubtreeStream(adaptor,"rule or_expression"); try { DebugEnterRule(GrammarFileName, "lambda_expression"); DebugLocation(89, 1); try { // Queries\\PomonaQuery.g:90:2: ( or_expression ( ':' or_expression )? -> ^( LAMBDA_OP ( or_expression )+ ) ) DebugEnterAlt(1); // Queries\\PomonaQuery.g:90:4: or_expression ( ':' or_expression )? { DebugLocation(90, 4); PushFollow(Follow._or_expression_in_lambda_expression559); or_expression7=or_expression(); PopFollow(); stream_or_expression.Add(or_expression7.Tree); DebugLocation(90, 18); // Queries\\PomonaQuery.g:90:18: ( ':' or_expression )? int alt2=2; try { DebugEnterSubRule(2); try { DebugEnterDecision(2, false); int LA2_1 = input.LA(1); if ((LA2_1==51)) { alt2 = 1; } } finally { DebugExitDecision(2); } switch (alt2) { case 1: DebugEnterAlt(1); // Queries\\PomonaQuery.g:90:20: ':' or_expression { DebugLocation(90, 20); char_literal8=(IToken)Match(input,51,Follow._51_in_lambda_expression563); stream_51.Add(char_literal8); DebugLocation(90, 24); PushFollow(Follow._or_expression_in_lambda_expression565); or_expression9=or_expression(); PopFollow(); stream_or_expression.Add(or_expression9.Tree); } break; } } finally { DebugExitSubRule(2); } { // AST REWRITE // elements: or_expression // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: retval.Tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null); root_0 = (object)adaptor.Nil(); // 90:41: -> ^( LAMBDA_OP ( or_expression )+ ) { DebugLocation(90, 44); // Queries\\PomonaQuery.g:90:44: ^( LAMBDA_OP ( or_expression )+ ) { object root_1 = (object)adaptor.Nil(); DebugLocation(90, 46); root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(LAMBDA_OP, "LAMBDA_OP"), root_1); DebugLocation(90, 56); if (!(stream_or_expression.HasNext)) { throw new RewriteEarlyExitException(); } while ( stream_or_expression.HasNext ) { DebugLocation(90, 56); adaptor.AddChild(root_1, stream_or_expression.NextTree()); } stream_or_expression.Reset(); adaptor.AddChild(root_0, root_1); } } retval.Tree = root_0; } } retval.Stop = (IToken)input.LT(-1); retval.Tree = (object)adaptor.RulePostProcessing(root_0); adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop); } catch (RecognitionException re) { ReportError(re); Recover(input,re); retval.Tree = (object)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re); } finally { TraceOut("lambda_expression", 4); LeaveRule("lambda_expression", 4); LeaveRule_lambda_expression(); } DebugLocation(91, 1); } finally { DebugExitRule(GrammarFileName, "lambda_expression"); } return retval; }
private AstParserRuleReturnScope<object, IToken> and_expression() { EnterRule_and_expression(); EnterRule("and_expression", 7); TraceIn("and_expression", 7); AstParserRuleReturnScope<object, IToken> retval = new AstParserRuleReturnScope<object, IToken>(); retval.Start = (IToken)input.LT(1); object root_0 = default(object); AstParserRuleReturnScope<object, IToken> relational_expr15 = default(AstParserRuleReturnScope<object, IToken>); AstParserRuleReturnScope<object, IToken> and_operator16 = default(AstParserRuleReturnScope<object, IToken>); AstParserRuleReturnScope<object, IToken> relational_expr17 = default(AstParserRuleReturnScope<object, IToken>); RewriteRuleSubtreeStream stream_relational_expr=new RewriteRuleSubtreeStream(adaptor,"rule relational_expr"); RewriteRuleSubtreeStream stream_and_operator=new RewriteRuleSubtreeStream(adaptor,"rule and_operator"); try { DebugEnterRule(GrammarFileName, "and_expression"); DebugLocation(101, 1); try { // Queries\\PomonaQuery.g:102:2: ( relational_expr ( and_operator relational_expr )* -> ^( AND_OP ( relational_expr )+ ) ) DebugEnterAlt(1); // Queries\\PomonaQuery.g:102:4: relational_expr ( and_operator relational_expr )* { DebugLocation(102, 4); PushFollow(Follow._relational_expr_in_and_expression637); relational_expr15=relational_expr(); PopFollow(); stream_relational_expr.Add(relational_expr15.Tree); DebugLocation(102, 20); // Queries\\PomonaQuery.g:102:20: ( and_operator relational_expr )* try { DebugEnterSubRule(5); while (true) { int alt5=2; try { DebugEnterDecision(5, false); int LA5_1 = input.LA(1); if ((LA5_1==42||LA5_1==60)) { alt5 = 1; } } finally { DebugExitDecision(5); } switch ( alt5 ) { case 1: DebugEnterAlt(1); // Queries\\PomonaQuery.g:102:22: and_operator relational_expr { DebugLocation(102, 22); PushFollow(Follow._and_operator_in_and_expression641); and_operator16=and_operator(); PopFollow(); stream_and_operator.Add(and_operator16.Tree); DebugLocation(102, 35); PushFollow(Follow._relational_expr_in_and_expression643); relational_expr17=relational_expr(); PopFollow(); stream_relational_expr.Add(relational_expr17.Tree); } break; default: goto loop5; } } loop5: ; } finally { DebugExitSubRule(5); } { // AST REWRITE // elements: relational_expr // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: retval.Tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null); root_0 = (object)adaptor.Nil(); // 102:54: -> ^( AND_OP ( relational_expr )+ ) { DebugLocation(102, 57); // Queries\\PomonaQuery.g:102:57: ^( AND_OP ( relational_expr )+ ) { object root_1 = (object)adaptor.Nil(); DebugLocation(102, 59); root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(AND_OP, "AND_OP"), root_1); DebugLocation(102, 66); if (!(stream_relational_expr.HasNext)) { throw new RewriteEarlyExitException(); } while ( stream_relational_expr.HasNext ) { DebugLocation(102, 66); adaptor.AddChild(root_1, stream_relational_expr.NextTree()); } stream_relational_expr.Reset(); adaptor.AddChild(root_0, root_1); } } retval.Tree = root_0; } } retval.Stop = (IToken)input.LT(-1); retval.Tree = (object)adaptor.RulePostProcessing(root_0); adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop); } catch (RecognitionException re) { ReportError(re); Recover(input,re); retval.Tree = (object)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re); } finally { TraceOut("and_expression", 7); LeaveRule("and_expression", 7); LeaveRule_and_expression(); } DebugLocation(103, 1); } finally { DebugExitRule(GrammarFileName, "and_expression"); } return retval; }
private AstParserRuleReturnScope<CommonTree, IToken> type_template_type() { EnterRule_type_template_type(); EnterRule("type_template_type", 21); TraceIn("type_template_type", 21); AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>(); retval.Start = (IToken)input.LT(1); CommonTree root_0 = default(CommonTree); IToken char_literal221 = default(IToken); IToken WS222 = default(IToken); IToken WS224 = default(IToken); IToken char_literal225 = default(IToken); IToken WS226 = default(IToken); IToken WS228 = default(IToken); IToken char_literal229 = default(IToken); AstParserRuleReturnScope<CommonTree, IToken> type_ident220 = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> type_name223 = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> type_name227 = default(AstParserRuleReturnScope<CommonTree, IToken>); CommonTree char_literal221_tree = default(CommonTree); CommonTree WS222_tree = default(CommonTree); CommonTree WS224_tree = default(CommonTree); CommonTree char_literal225_tree = default(CommonTree); CommonTree WS226_tree = default(CommonTree); CommonTree WS228_tree = default(CommonTree); CommonTree char_literal229_tree = default(CommonTree); RewriteRuleITokenStream stream_125=new RewriteRuleITokenStream(adaptor,"token 125"); RewriteRuleITokenStream stream_115=new RewriteRuleITokenStream(adaptor,"token 115"); RewriteRuleITokenStream stream_WS=new RewriteRuleITokenStream(adaptor,"token WS"); RewriteRuleITokenStream stream_100=new RewriteRuleITokenStream(adaptor,"token 100"); RewriteRuleSubtreeStream stream_type_name=new RewriteRuleSubtreeStream(adaptor,"rule type_name"); RewriteRuleSubtreeStream stream_type_ident=new RewriteRuleSubtreeStream(adaptor,"rule type_ident"); try { DebugEnterRule(GrammarFileName, "type_template_type"); DebugLocation(328, 1); try { // SugarCpp.g:329:2: ( type_ident ( '<' ( ( WS )* type_name ( ( WS )* ',' ( WS )* type_name )* )? ( WS )* '>' -> ^( Type_Template type_ident ( type_name )* ) | -> type_ident ) ) DebugEnterAlt(1); // SugarCpp.g:329:4: type_ident ( '<' ( ( WS )* type_name ( ( WS )* ',' ( WS )* type_name )* )? ( WS )* '>' -> ^( Type_Template type_ident ( type_name )* ) | -> type_ident ) { DebugLocation(329, 4); PushFollow(Follow._type_ident_in_type_template_type2135); type_ident220=type_ident(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_type_ident.Add(type_ident220.Tree); DebugLocation(329, 15); // SugarCpp.g:329:15: ( '<' ( ( WS )* type_name ( ( WS )* ',' ( WS )* type_name )* )? ( WS )* '>' -> ^( Type_Template type_ident ( type_name )* ) | -> type_ident ) int alt152=2; try { DebugEnterSubRule(152); try { DebugEnterDecision(152, false); int LA152_0 = input.LA(1); if ((LA152_0==115)) { alt152 = 1; } else if ((LA152_0==DEDENT||(LA152_0>=IDENT && LA152_0<=INDENT)||LA152_0==NEWLINE||LA152_0==WS||LA152_0==91||(LA152_0>=93 && LA152_0<=95)||LA152_0==100||LA152_0==105||(LA152_0>=113 && LA152_0<=114)||LA152_0==121||(LA152_0>=124 && LA152_0<=125)||(LA152_0>=132 && LA152_0<=133)||LA152_0==138||LA152_0==144||(LA152_0>=149 && LA152_0<=150)||LA152_0==152||LA152_0==165||LA152_0==169||(LA152_0>=171 && LA152_0<=172)||(LA152_0>=175 && LA152_0<=176)||(LA152_0>=180 && LA152_0<=181)||LA152_0==186)) { alt152 = 2; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 152, 0, input); DebugRecognitionException(nvae); throw nvae; } } finally { DebugExitDecision(152); } switch (alt152) { case 1: DebugEnterAlt(1); // SugarCpp.g:329:17: '<' ( ( WS )* type_name ( ( WS )* ',' ( WS )* type_name )* )? ( WS )* '>' { DebugLocation(329, 17); char_literal221=(IToken)Match(input,115,Follow._115_in_type_template_type2139); if (state.failed) return retval; if (state.backtracking == 0) stream_115.Add(char_literal221); DebugLocation(329, 21); // SugarCpp.g:329:21: ( ( WS )* type_name ( ( WS )* ',' ( WS )* type_name )* )? int alt150=2; try { DebugEnterSubRule(150); try { DebugEnterDecision(150, false); try { alt150 = dfa150.Predict(input); } catch (NoViableAltException nvae) { DebugRecognitionException(nvae); throw; } } finally { DebugExitDecision(150); } switch (alt150) { case 1: DebugEnterAlt(1); // SugarCpp.g:329:22: ( WS )* type_name ( ( WS )* ',' ( WS )* type_name )* { DebugLocation(329, 22); // SugarCpp.g:329:22: ( WS )* try { DebugEnterSubRule(146); while (true) { int alt146=2; try { DebugEnterDecision(146, false); int LA146_0 = input.LA(1); if ((LA146_0==WS)) { alt146 = 1; } } finally { DebugExitDecision(146); } switch ( alt146 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:329:22: WS { DebugLocation(329, 22); WS222=(IToken)Match(input,WS,Follow._WS_in_type_template_type2142); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS222); } break; default: goto loop146; } } loop146: ; } finally { DebugExitSubRule(146); } DebugLocation(329, 26); PushFollow(Follow._type_name_in_type_template_type2145); type_name223=type_name(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_type_name.Add(type_name223.Tree); DebugLocation(329, 36); // SugarCpp.g:329:36: ( ( WS )* ',' ( WS )* type_name )* try { DebugEnterSubRule(149); while (true) { int alt149=2; try { DebugEnterDecision(149, false); try { alt149 = dfa149.Predict(input); } catch (NoViableAltException nvae) { DebugRecognitionException(nvae); throw; } } finally { DebugExitDecision(149); } switch ( alt149 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:329:37: ( WS )* ',' ( WS )* type_name { DebugLocation(329, 37); // SugarCpp.g:329:37: ( WS )* try { DebugEnterSubRule(147); while (true) { int alt147=2; try { DebugEnterDecision(147, false); int LA147_0 = input.LA(1); if ((LA147_0==WS)) { alt147 = 1; } } finally { DebugExitDecision(147); } switch ( alt147 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:329:37: WS { DebugLocation(329, 37); WS224=(IToken)Match(input,WS,Follow._WS_in_type_template_type2148); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS224); } break; default: goto loop147; } } loop147: ; } finally { DebugExitSubRule(147); } DebugLocation(329, 41); char_literal225=(IToken)Match(input,100,Follow._100_in_type_template_type2151); if (state.failed) return retval; if (state.backtracking == 0) stream_100.Add(char_literal225); DebugLocation(329, 45); // SugarCpp.g:329:45: ( WS )* try { DebugEnterSubRule(148); while (true) { int alt148=2; try { DebugEnterDecision(148, false); int LA148_0 = input.LA(1); if ((LA148_0==WS)) { alt148 = 1; } } finally { DebugExitDecision(148); } switch ( alt148 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:329:45: WS { DebugLocation(329, 45); WS226=(IToken)Match(input,WS,Follow._WS_in_type_template_type2153); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS226); } break; default: goto loop148; } } loop148: ; } finally { DebugExitSubRule(148); } DebugLocation(329, 49); PushFollow(Follow._type_name_in_type_template_type2156); type_name227=type_name(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_type_name.Add(type_name227.Tree); } break; default: goto loop149; } } loop149: ; } finally { DebugExitSubRule(149); } } break; } } finally { DebugExitSubRule(150); } DebugLocation(329, 63); // SugarCpp.g:329:63: ( WS )* try { DebugEnterSubRule(151); while (true) { int alt151=2; try { DebugEnterDecision(151, false); int LA151_0 = input.LA(1); if ((LA151_0==WS)) { alt151 = 1; } } finally { DebugExitDecision(151); } switch ( alt151 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:329:63: WS { DebugLocation(329, 63); WS228=(IToken)Match(input,WS,Follow._WS_in_type_template_type2162); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS228); } break; default: goto loop151; } } loop151: ; } finally { DebugExitSubRule(151); } DebugLocation(329, 67); char_literal229=(IToken)Match(input,125,Follow._125_in_type_template_type2165); if (state.failed) return retval; if (state.backtracking == 0) stream_125.Add(char_literal229); { // AST REWRITE // elements: type_ident, type_name // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: if (state.backtracking == 0) { retval.Tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null); root_0 = (CommonTree)adaptor.Nil(); // 329:71: -> ^( Type_Template type_ident ( type_name )* ) { DebugLocation(329, 74); // SugarCpp.g:329:74: ^( Type_Template type_ident ( type_name )* ) { CommonTree root_1 = (CommonTree)adaptor.Nil(); DebugLocation(329, 76); root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(Type_Template, "Type_Template"), root_1); DebugLocation(329, 90); adaptor.AddChild(root_1, stream_type_ident.NextTree()); DebugLocation(329, 101); // SugarCpp.g:329:101: ( type_name )* while ( stream_type_name.HasNext ) { DebugLocation(329, 101); adaptor.AddChild(root_1, stream_type_name.NextTree()); } stream_type_name.Reset(); adaptor.AddChild(root_0, root_1); } } retval.Tree = root_0; } } } break; case 2: DebugEnterAlt(2); // SugarCpp.g:330:8: { { // AST REWRITE // elements: type_ident // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: if (state.backtracking == 0) { retval.Tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null); root_0 = (CommonTree)adaptor.Nil(); // 330:8: -> type_ident { DebugLocation(330, 11); adaptor.AddChild(root_0, stream_type_ident.NextTree()); } retval.Tree = root_0; } } } break; } } finally { DebugExitSubRule(152); } } retval.Stop = (IToken)input.LT(-1); if (state.backtracking == 0) { retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0); adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop); } } catch (RecognitionException re) { ReportError(re); Recover(input,re); retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re); } finally { TraceOut("type_template_type", 21); LeaveRule("type_template_type", 21); LeaveRule_type_template_type(); } DebugLocation(332, 1); } finally { DebugExitRule(GrammarFileName, "type_template_type"); } return retval; }
private AstParserRuleReturnScope<object, IToken> as_expression() { EnterRule_as_expression(); EnterRule("as_expression", 3); TraceIn("as_expression", 3); AstParserRuleReturnScope<object, IToken> retval = new AstParserRuleReturnScope<object, IToken>(); retval.Start = (IToken)input.LT(1); object root_0 = default(object); IToken string_literal5 = default(IToken); AstParserRuleReturnScope<object, IToken> lambda_expression4 = default(AstParserRuleReturnScope<object, IToken>); AstParserRuleReturnScope<object, IToken> lambda_expression6 = default(AstParserRuleReturnScope<object, IToken>); object string_literal5_tree = default(object); RewriteRuleITokenStream stream_61=new RewriteRuleITokenStream(adaptor,"token 61"); RewriteRuleSubtreeStream stream_lambda_expression=new RewriteRuleSubtreeStream(adaptor,"rule lambda_expression"); try { DebugEnterRule(GrammarFileName, "as_expression"); DebugLocation(85, 1); try { // Queries\\PomonaQuery.g:86:2: ( lambda_expression ( 'as' lambda_expression )? -> ^( AS_OP ( lambda_expression )+ ) ) DebugEnterAlt(1); // Queries\\PomonaQuery.g:86:4: lambda_expression ( 'as' lambda_expression )? { DebugLocation(86, 4); PushFollow(Follow._lambda_expression_in_as_expression530); lambda_expression4=lambda_expression(); PopFollow(); stream_lambda_expression.Add(lambda_expression4.Tree); DebugLocation(86, 22); // Queries\\PomonaQuery.g:86:22: ( 'as' lambda_expression )? int alt1=2; try { DebugEnterSubRule(1); try { DebugEnterDecision(1, false); int LA1_1 = input.LA(1); if ((LA1_1==61)) { alt1 = 1; } } finally { DebugExitDecision(1); } switch (alt1) { case 1: DebugEnterAlt(1); // Queries\\PomonaQuery.g:86:24: 'as' lambda_expression { DebugLocation(86, 24); string_literal5=(IToken)Match(input,61,Follow._61_in_as_expression534); stream_61.Add(string_literal5); DebugLocation(86, 29); PushFollow(Follow._lambda_expression_in_as_expression536); lambda_expression6=lambda_expression(); PopFollow(); stream_lambda_expression.Add(lambda_expression6.Tree); } break; } } finally { DebugExitSubRule(1); } { // AST REWRITE // elements: lambda_expression // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: retval.Tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null); root_0 = (object)adaptor.Nil(); // 86:50: -> ^( AS_OP ( lambda_expression )+ ) { DebugLocation(86, 53); // Queries\\PomonaQuery.g:86:53: ^( AS_OP ( lambda_expression )+ ) { object root_1 = (object)adaptor.Nil(); DebugLocation(86, 55); root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(AS_OP, "AS_OP"), root_1); DebugLocation(86, 61); if (!(stream_lambda_expression.HasNext)) { throw new RewriteEarlyExitException(); } while ( stream_lambda_expression.HasNext ) { DebugLocation(86, 61); adaptor.AddChild(root_1, stream_lambda_expression.NextTree()); } stream_lambda_expression.Reset(); adaptor.AddChild(root_0, root_1); } } retval.Tree = root_0; } } retval.Stop = (IToken)input.LT(-1); retval.Tree = (object)adaptor.RulePostProcessing(root_0); adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop); } catch (RecognitionException re) { ReportError(re); Recover(input,re); retval.Tree = (object)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re); } finally { TraceOut("as_expression", 3); LeaveRule("as_expression", 3); LeaveRule_as_expression(); } DebugLocation(87, 1); } finally { DebugExitRule(GrammarFileName, "as_expression"); } return retval; }
private AstParserRuleReturnScope<CommonTree, IToken> bracket_expr_list() { EnterRule_bracket_expr_list(); EnterRule("bracket_expr_list", 94); TraceIn("bracket_expr_list", 94); AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>(); retval.Start = (IToken)input.LT(1); CommonTree root_0 = default(CommonTree); IToken char_literal849 = default(IToken); IToken WS850 = default(IToken); IToken WS852 = default(IToken); IToken char_literal853 = default(IToken); IToken WS854 = default(IToken); IToken WS856 = default(IToken); IToken char_literal857 = default(IToken); IToken WS858 = default(IToken); IToken NEWLINE859 = default(IToken); IToken INDENT860 = default(IToken); IToken NEWLINE861 = default(IToken); IToken WS863 = default(IToken); IToken char_literal864 = default(IToken); IToken WS865 = default(IToken); IToken NEWLINE866 = default(IToken); IToken WS867 = default(IToken); IToken WS869 = default(IToken); IToken NEWLINE870 = default(IToken); IToken WS871 = default(IToken); IToken char_literal872 = default(IToken); IToken WS873 = default(IToken); IToken NEWLINE874 = default(IToken); IToken DEDENT875 = default(IToken); IToken DEDENT876 = default(IToken); IToken NEWLINE877 = default(IToken); IToken WS878 = default(IToken); IToken char_literal879 = default(IToken); IToken WS880 = default(IToken); IToken WS882 = default(IToken); IToken char_literal883 = default(IToken); IToken WS884 = default(IToken); IToken NEWLINE885 = default(IToken); IToken WS886 = default(IToken); IToken WS888 = default(IToken); IToken char_literal889 = default(IToken); AstParserRuleReturnScope<CommonTree, IToken> expr851 = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> expr855 = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> expr862 = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> expr868 = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> expr881 = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> expr887 = default(AstParserRuleReturnScope<CommonTree, IToken>); CommonTree char_literal849_tree = default(CommonTree); CommonTree WS850_tree = default(CommonTree); CommonTree WS852_tree = default(CommonTree); CommonTree char_literal853_tree = default(CommonTree); CommonTree WS854_tree = default(CommonTree); CommonTree WS856_tree = default(CommonTree); CommonTree char_literal857_tree = default(CommonTree); CommonTree WS858_tree = default(CommonTree); CommonTree NEWLINE859_tree = default(CommonTree); CommonTree INDENT860_tree = default(CommonTree); CommonTree NEWLINE861_tree = default(CommonTree); CommonTree WS863_tree = default(CommonTree); CommonTree char_literal864_tree = default(CommonTree); CommonTree WS865_tree = default(CommonTree); CommonTree NEWLINE866_tree = default(CommonTree); CommonTree WS867_tree = default(CommonTree); CommonTree WS869_tree = default(CommonTree); CommonTree NEWLINE870_tree = default(CommonTree); CommonTree WS871_tree = default(CommonTree); CommonTree char_literal872_tree = default(CommonTree); CommonTree WS873_tree = default(CommonTree); CommonTree NEWLINE874_tree = default(CommonTree); CommonTree DEDENT875_tree = default(CommonTree); CommonTree DEDENT876_tree = default(CommonTree); CommonTree NEWLINE877_tree = default(CommonTree); CommonTree WS878_tree = default(CommonTree); CommonTree char_literal879_tree = default(CommonTree); CommonTree WS880_tree = default(CommonTree); CommonTree WS882_tree = default(CommonTree); CommonTree char_literal883_tree = default(CommonTree); CommonTree WS884_tree = default(CommonTree); CommonTree NEWLINE885_tree = default(CommonTree); CommonTree WS886_tree = default(CommonTree); CommonTree WS888_tree = default(CommonTree); CommonTree char_literal889_tree = default(CommonTree); RewriteRuleITokenStream stream_94=new RewriteRuleITokenStream(adaptor,"token 94"); RewriteRuleITokenStream stream_WS=new RewriteRuleITokenStream(adaptor,"token WS"); RewriteRuleITokenStream stream_DEDENT=new RewriteRuleITokenStream(adaptor,"token DEDENT"); RewriteRuleITokenStream stream_93=new RewriteRuleITokenStream(adaptor,"token 93"); RewriteRuleITokenStream stream_NEWLINE=new RewriteRuleITokenStream(adaptor,"token NEWLINE"); RewriteRuleITokenStream stream_INDENT=new RewriteRuleITokenStream(adaptor,"token INDENT"); RewriteRuleITokenStream stream_100=new RewriteRuleITokenStream(adaptor,"token 100"); RewriteRuleSubtreeStream stream_expr=new RewriteRuleSubtreeStream(adaptor,"rule expr"); try { DebugEnterRule(GrammarFileName, "bracket_expr_list"); DebugLocation(702, 1); try { // SugarCpp.g:703:2: ( '(' ( ( WS )* expr ( ( WS )* ',' ( WS )* expr )* )? ( ( WS )* ')' -> ^( Expr_Args ( expr )* ) | ( WS )* ( NEWLINE )+ ( INDENT ( NEWLINE )* expr ( ( ( WS )* ',' | ( WS )* NEWLINE )+ ( WS )* expr )* ( ( WS )* NEWLINE )* ( ( WS )* ')' ( WS )* ( NEWLINE )* DEDENT | DEDENT ( NEWLINE )* ( WS )* ')' ) -> ^( Expr_Args ( expr )* ) | ( ( WS )* expr ( ( ( WS )* ',' | ( WS )* NEWLINE )+ ( WS )* expr )* )? ( WS )* ')' -> ^( Expr_Args ( expr )* ) ) ) ) DebugEnterAlt(1); // SugarCpp.g:703:4: '(' ( ( WS )* expr ( ( WS )* ',' ( WS )* expr )* )? ( ( WS )* ')' -> ^( Expr_Args ( expr )* ) | ( WS )* ( NEWLINE )+ ( INDENT ( NEWLINE )* expr ( ( ( WS )* ',' | ( WS )* NEWLINE )+ ( WS )* expr )* ( ( WS )* NEWLINE )* ( ( WS )* ')' ( WS )* ( NEWLINE )* DEDENT | DEDENT ( NEWLINE )* ( WS )* ')' ) -> ^( Expr_Args ( expr )* ) | ( ( WS )* expr ( ( ( WS )* ',' | ( WS )* NEWLINE )+ ( WS )* expr )* )? ( WS )* ')' -> ^( Expr_Args ( expr )* ) ) ) { DebugLocation(703, 4); char_literal849=(IToken)Match(input,93,Follow._93_in_bracket_expr_list8046); if (state.failed) return retval; if (state.backtracking == 0) stream_93.Add(char_literal849); DebugLocation(703, 8); // SugarCpp.g:703:8: ( ( WS )* expr ( ( WS )* ',' ( WS )* expr )* )? int alt556=2; try { DebugEnterSubRule(556); try { DebugEnterDecision(556, false); try { alt556 = dfa556.Predict(input); } catch (NoViableAltException nvae) { DebugRecognitionException(nvae); throw; } } finally { DebugExitDecision(556); } switch (alt556) { case 1: DebugEnterAlt(1); // SugarCpp.g:703:9: ( WS )* expr ( ( WS )* ',' ( WS )* expr )* { DebugLocation(703, 9); // SugarCpp.g:703:9: ( WS )* try { DebugEnterSubRule(552); while (true) { int alt552=2; try { DebugEnterDecision(552, false); int LA552_0 = input.LA(1); if ((LA552_0==WS)) { alt552 = 1; } } finally { DebugExitDecision(552); } switch ( alt552 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:703:9: WS { DebugLocation(703, 9); WS850=(IToken)Match(input,WS,Follow._WS_in_bracket_expr_list8049); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS850); } break; default: goto loop552; } } loop552: ; } finally { DebugExitSubRule(552); } DebugLocation(703, 13); PushFollow(Follow._expr_in_bracket_expr_list8052); expr851=expr(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_expr.Add(expr851.Tree); DebugLocation(703, 18); // SugarCpp.g:703:18: ( ( WS )* ',' ( WS )* expr )* try { DebugEnterSubRule(555); while (true) { int alt555=2; try { DebugEnterDecision(555, false); try { alt555 = dfa555.Predict(input); } catch (NoViableAltException nvae) { DebugRecognitionException(nvae); throw; } } finally { DebugExitDecision(555); } switch ( alt555 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:703:19: ( WS )* ',' ( WS )* expr { DebugLocation(703, 19); // SugarCpp.g:703:19: ( WS )* try { DebugEnterSubRule(553); while (true) { int alt553=2; try { DebugEnterDecision(553, false); int LA553_0 = input.LA(1); if ((LA553_0==WS)) { alt553 = 1; } } finally { DebugExitDecision(553); } switch ( alt553 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:703:19: WS { DebugLocation(703, 19); WS852=(IToken)Match(input,WS,Follow._WS_in_bracket_expr_list8055); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS852); } break; default: goto loop553; } } loop553: ; } finally { DebugExitSubRule(553); } DebugLocation(703, 23); char_literal853=(IToken)Match(input,100,Follow._100_in_bracket_expr_list8058); if (state.failed) return retval; if (state.backtracking == 0) stream_100.Add(char_literal853); DebugLocation(703, 27); // SugarCpp.g:703:27: ( WS )* try { DebugEnterSubRule(554); while (true) { int alt554=2; try { DebugEnterDecision(554, false); int LA554_0 = input.LA(1); if ((LA554_0==WS)) { alt554 = 1; } } finally { DebugExitDecision(554); } switch ( alt554 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:703:27: WS { DebugLocation(703, 27); WS854=(IToken)Match(input,WS,Follow._WS_in_bracket_expr_list8060); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS854); } break; default: goto loop554; } } loop554: ; } finally { DebugExitSubRule(554); } DebugLocation(703, 31); PushFollow(Follow._expr_in_bracket_expr_list8063); expr855=expr(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_expr.Add(expr855.Tree); } break; default: goto loop555; } } loop555: ; } finally { DebugExitSubRule(555); } } break; } } finally { DebugExitSubRule(556); } DebugLocation(703, 40); // SugarCpp.g:703:40: ( ( WS )* ')' -> ^( Expr_Args ( expr )* ) | ( WS )* ( NEWLINE )+ ( INDENT ( NEWLINE )* expr ( ( ( WS )* ',' | ( WS )* NEWLINE )+ ( WS )* expr )* ( ( WS )* NEWLINE )* ( ( WS )* ')' ( WS )* ( NEWLINE )* DEDENT | DEDENT ( NEWLINE )* ( WS )* ')' ) -> ^( Expr_Args ( expr )* ) | ( ( WS )* expr ( ( ( WS )* ',' | ( WS )* NEWLINE )+ ( WS )* expr )* )? ( WS )* ')' -> ^( Expr_Args ( expr )* ) ) ) int alt583=2; try { DebugEnterSubRule(583); try { DebugEnterDecision(583, false); try { alt583 = dfa583.Predict(input); } catch (NoViableAltException nvae) { DebugRecognitionException(nvae); throw; } } finally { DebugExitDecision(583); } switch (alt583) { case 1: DebugEnterAlt(1); // SugarCpp.g:703:42: ( WS )* ')' { DebugLocation(703, 42); // SugarCpp.g:703:42: ( WS )* try { DebugEnterSubRule(557); while (true) { int alt557=2; try { DebugEnterDecision(557, false); int LA557_0 = input.LA(1); if ((LA557_0==WS)) { alt557 = 1; } } finally { DebugExitDecision(557); } switch ( alt557 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:703:42: WS { DebugLocation(703, 42); WS856=(IToken)Match(input,WS,Follow._WS_in_bracket_expr_list8071); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS856); } break; default: goto loop557; } } loop557: ; } finally { DebugExitSubRule(557); } DebugLocation(703, 46); char_literal857=(IToken)Match(input,94,Follow._94_in_bracket_expr_list8074); if (state.failed) return retval; if (state.backtracking == 0) stream_94.Add(char_literal857); { // AST REWRITE // elements: expr // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: if (state.backtracking == 0) { retval.Tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null); root_0 = (CommonTree)adaptor.Nil(); // 703:50: -> ^( Expr_Args ( expr )* ) { DebugLocation(703, 53); // SugarCpp.g:703:53: ^( Expr_Args ( expr )* ) { CommonTree root_1 = (CommonTree)adaptor.Nil(); DebugLocation(703, 55); root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(Expr_Args, "Expr_Args"), root_1); DebugLocation(703, 65); // SugarCpp.g:703:65: ( expr )* while ( stream_expr.HasNext ) { DebugLocation(703, 65); adaptor.AddChild(root_1, stream_expr.NextTree()); } stream_expr.Reset(); adaptor.AddChild(root_0, root_1); } } retval.Tree = root_0; } } } break; case 2: DebugEnterAlt(2); // SugarCpp.g:704:24: ( WS )* ( NEWLINE )+ ( INDENT ( NEWLINE )* expr ( ( ( WS )* ',' | ( WS )* NEWLINE )+ ( WS )* expr )* ( ( WS )* NEWLINE )* ( ( WS )* ')' ( WS )* ( NEWLINE )* DEDENT | DEDENT ( NEWLINE )* ( WS )* ')' ) -> ^( Expr_Args ( expr )* ) | ( ( WS )* expr ( ( ( WS )* ',' | ( WS )* NEWLINE )+ ( WS )* expr )* )? ( WS )* ')' -> ^( Expr_Args ( expr )* ) ) { DebugLocation(704, 24); // SugarCpp.g:704:24: ( WS )* try { DebugEnterSubRule(558); while (true) { int alt558=2; try { DebugEnterDecision(558, false); int LA558_0 = input.LA(1); if ((LA558_0==WS)) { alt558 = 1; } } finally { DebugExitDecision(558); } switch ( alt558 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:704:24: WS { DebugLocation(704, 24); WS858=(IToken)Match(input,WS,Follow._WS_in_bracket_expr_list8108); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS858); } break; default: goto loop558; } } loop558: ; } finally { DebugExitSubRule(558); } DebugLocation(704, 28); // SugarCpp.g:704:28: ( NEWLINE )+ int cnt559=0; try { DebugEnterSubRule(559); while (true) { int alt559=2; try { DebugEnterDecision(559, false); int LA559_0 = input.LA(1); if ((LA559_0==NEWLINE)) { alt559 = 1; } } finally { DebugExitDecision(559); } switch (alt559) { case 1: DebugEnterAlt(1); // SugarCpp.g:704:28: NEWLINE { DebugLocation(704, 28); NEWLINE859=(IToken)Match(input,NEWLINE,Follow._NEWLINE_in_bracket_expr_list8111); if (state.failed) return retval; if (state.backtracking == 0) stream_NEWLINE.Add(NEWLINE859); } break; default: if (cnt559 >= 1) goto loop559; if (state.backtracking>0) {state.failed=true; return retval;} EarlyExitException eee559 = new EarlyExitException( 559, input ); DebugRecognitionException(eee559); throw eee559; } cnt559++; } loop559: ; } finally { DebugExitSubRule(559); } DebugLocation(704, 37); // SugarCpp.g:704:37: ( INDENT ( NEWLINE )* expr ( ( ( WS )* ',' | ( WS )* NEWLINE )+ ( WS )* expr )* ( ( WS )* NEWLINE )* ( ( WS )* ')' ( WS )* ( NEWLINE )* DEDENT | DEDENT ( NEWLINE )* ( WS )* ')' ) -> ^( Expr_Args ( expr )* ) | ( ( WS )* expr ( ( ( WS )* ',' | ( WS )* NEWLINE )+ ( WS )* expr )* )? ( WS )* ')' -> ^( Expr_Args ( expr )* ) ) int alt582=2; try { DebugEnterSubRule(582); try { DebugEnterDecision(582, false); int LA582_0 = input.LA(1); if ((LA582_0==INDENT)) { alt582 = 1; } else if ((LA582_0==IDENT||LA582_0==NUMBER||LA582_0==STRING||(LA582_0>=WS && LA582_0<=86)||LA582_0==91||(LA582_0>=93 && LA582_0<=95)||(LA582_0>=97 && LA582_0<=98)||(LA582_0>=101 && LA582_0<=102)||(LA582_0>=131 && LA582_0<=132)||LA582_0==155||LA582_0==158||(LA582_0>=160 && LA582_0<=161)||LA582_0==186)) { alt582 = 2; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 582, 0, input); DebugRecognitionException(nvae); throw nvae; } } finally { DebugExitDecision(582); } switch (alt582) { case 1: DebugEnterAlt(1); // SugarCpp.g:704:39: INDENT ( NEWLINE )* expr ( ( ( WS )* ',' | ( WS )* NEWLINE )+ ( WS )* expr )* ( ( WS )* NEWLINE )* ( ( WS )* ')' ( WS )* ( NEWLINE )* DEDENT | DEDENT ( NEWLINE )* ( WS )* ')' ) { DebugLocation(704, 39); INDENT860=(IToken)Match(input,INDENT,Follow._INDENT_in_bracket_expr_list8116); if (state.failed) return retval; if (state.backtracking == 0) stream_INDENT.Add(INDENT860); DebugLocation(704, 46); // SugarCpp.g:704:46: ( NEWLINE )* try { DebugEnterSubRule(560); while (true) { int alt560=2; try { DebugEnterDecision(560, false); int LA560_0 = input.LA(1); if ((LA560_0==NEWLINE)) { alt560 = 1; } } finally { DebugExitDecision(560); } switch ( alt560 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:704:46: NEWLINE { DebugLocation(704, 46); NEWLINE861=(IToken)Match(input,NEWLINE,Follow._NEWLINE_in_bracket_expr_list8118); if (state.failed) return retval; if (state.backtracking == 0) stream_NEWLINE.Add(NEWLINE861); } break; default: goto loop560; } } loop560: ; } finally { DebugExitSubRule(560); } DebugLocation(704, 55); PushFollow(Follow._expr_in_bracket_expr_list8121); expr862=expr(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_expr.Add(expr862.Tree); DebugLocation(704, 60); // SugarCpp.g:704:60: ( ( ( WS )* ',' | ( WS )* NEWLINE )+ ( WS )* expr )* try { DebugEnterSubRule(565); while (true) { int alt565=2; try { DebugEnterDecision(565, false); try { alt565 = dfa565.Predict(input); } catch (NoViableAltException nvae) { DebugRecognitionException(nvae); throw; } } finally { DebugExitDecision(565); } switch ( alt565 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:704:61: ( ( WS )* ',' | ( WS )* NEWLINE )+ ( WS )* expr { DebugLocation(704, 61); // SugarCpp.g:704:61: ( ( WS )* ',' | ( WS )* NEWLINE )+ int cnt563=0; try { DebugEnterSubRule(563); while (true) { int alt563=3; try { DebugEnterDecision(563, false); try { alt563 = dfa563.Predict(input); } catch (NoViableAltException nvae) { DebugRecognitionException(nvae); throw; } } finally { DebugExitDecision(563); } switch (alt563) { case 1: DebugEnterAlt(1); // SugarCpp.g:704:62: ( WS )* ',' { DebugLocation(704, 62); // SugarCpp.g:704:62: ( WS )* try { DebugEnterSubRule(561); while (true) { int alt561=2; try { DebugEnterDecision(561, false); int LA561_0 = input.LA(1); if ((LA561_0==WS)) { alt561 = 1; } } finally { DebugExitDecision(561); } switch ( alt561 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:704:62: WS { DebugLocation(704, 62); WS863=(IToken)Match(input,WS,Follow._WS_in_bracket_expr_list8125); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS863); } break; default: goto loop561; } } loop561: ; } finally { DebugExitSubRule(561); } DebugLocation(704, 66); char_literal864=(IToken)Match(input,100,Follow._100_in_bracket_expr_list8128); if (state.failed) return retval; if (state.backtracking == 0) stream_100.Add(char_literal864); } break; case 2: DebugEnterAlt(2); // SugarCpp.g:704:72: ( WS )* NEWLINE { DebugLocation(704, 72); // SugarCpp.g:704:72: ( WS )* try { DebugEnterSubRule(562); while (true) { int alt562=2; try { DebugEnterDecision(562, false); int LA562_0 = input.LA(1); if ((LA562_0==WS)) { alt562 = 1; } } finally { DebugExitDecision(562); } switch ( alt562 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:704:72: WS { DebugLocation(704, 72); WS865=(IToken)Match(input,WS,Follow._WS_in_bracket_expr_list8132); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS865); } break; default: goto loop562; } } loop562: ; } finally { DebugExitSubRule(562); } DebugLocation(704, 76); NEWLINE866=(IToken)Match(input,NEWLINE,Follow._NEWLINE_in_bracket_expr_list8135); if (state.failed) return retval; if (state.backtracking == 0) stream_NEWLINE.Add(NEWLINE866); } break; default: if (cnt563 >= 1) goto loop563; if (state.backtracking>0) {state.failed=true; return retval;} EarlyExitException eee563 = new EarlyExitException( 563, input ); DebugRecognitionException(eee563); throw eee563; } cnt563++; } loop563: ; } finally { DebugExitSubRule(563); } DebugLocation(704, 86); // SugarCpp.g:704:86: ( WS )* try { DebugEnterSubRule(564); while (true) { int alt564=2; try { DebugEnterDecision(564, false); int LA564_0 = input.LA(1); if ((LA564_0==WS)) { alt564 = 1; } } finally { DebugExitDecision(564); } switch ( alt564 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:704:86: WS { DebugLocation(704, 86); WS867=(IToken)Match(input,WS,Follow._WS_in_bracket_expr_list8139); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS867); } break; default: goto loop564; } } loop564: ; } finally { DebugExitSubRule(564); } DebugLocation(704, 90); PushFollow(Follow._expr_in_bracket_expr_list8142); expr868=expr(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_expr.Add(expr868.Tree); } break; default: goto loop565; } } loop565: ; } finally { DebugExitSubRule(565); } DebugLocation(704, 97); // SugarCpp.g:704:97: ( ( WS )* NEWLINE )* try { DebugEnterSubRule(567); while (true) { int alt567=2; try { DebugEnterDecision(567, false); try { alt567 = dfa567.Predict(input); } catch (NoViableAltException nvae) { DebugRecognitionException(nvae); throw; } } finally { DebugExitDecision(567); } switch ( alt567 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:704:98: ( WS )* NEWLINE { DebugLocation(704, 98); // SugarCpp.g:704:98: ( WS )* try { DebugEnterSubRule(566); while (true) { int alt566=2; try { DebugEnterDecision(566, false); int LA566_0 = input.LA(1); if ((LA566_0==WS)) { alt566 = 1; } } finally { DebugExitDecision(566); } switch ( alt566 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:704:98: WS { DebugLocation(704, 98); WS869=(IToken)Match(input,WS,Follow._WS_in_bracket_expr_list8147); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS869); } break; default: goto loop566; } } loop566: ; } finally { DebugExitSubRule(566); } DebugLocation(704, 102); NEWLINE870=(IToken)Match(input,NEWLINE,Follow._NEWLINE_in_bracket_expr_list8150); if (state.failed) return retval; if (state.backtracking == 0) stream_NEWLINE.Add(NEWLINE870); } break; default: goto loop567; } } loop567: ; } finally { DebugExitSubRule(567); } DebugLocation(704, 112); // SugarCpp.g:704:112: ( ( WS )* ')' ( WS )* ( NEWLINE )* DEDENT | DEDENT ( NEWLINE )* ( WS )* ')' ) int alt573=2; try { DebugEnterSubRule(573); try { DebugEnterDecision(573, false); int LA573_0 = input.LA(1); if ((LA573_0==WS||LA573_0==94)) { alt573 = 1; } else if ((LA573_0==DEDENT)) { alt573 = 2; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 573, 0, input); DebugRecognitionException(nvae); throw nvae; } } finally { DebugExitDecision(573); } switch (alt573) { case 1: DebugEnterAlt(1); // SugarCpp.g:704:114: ( WS )* ')' ( WS )* ( NEWLINE )* DEDENT { DebugLocation(704, 114); // SugarCpp.g:704:114: ( WS )* try { DebugEnterSubRule(568); while (true) { int alt568=2; try { DebugEnterDecision(568, false); int LA568_0 = input.LA(1); if ((LA568_0==WS)) { alt568 = 1; } } finally { DebugExitDecision(568); } switch ( alt568 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:704:114: WS { DebugLocation(704, 114); WS871=(IToken)Match(input,WS,Follow._WS_in_bracket_expr_list8156); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS871); } break; default: goto loop568; } } loop568: ; } finally { DebugExitSubRule(568); } DebugLocation(704, 118); char_literal872=(IToken)Match(input,94,Follow._94_in_bracket_expr_list8159); if (state.failed) return retval; if (state.backtracking == 0) stream_94.Add(char_literal872); DebugLocation(704, 122); // SugarCpp.g:704:122: ( WS )* try { DebugEnterSubRule(569); while (true) { int alt569=2; try { DebugEnterDecision(569, false); int LA569_0 = input.LA(1); if ((LA569_0==WS)) { alt569 = 1; } } finally { DebugExitDecision(569); } switch ( alt569 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:704:122: WS { DebugLocation(704, 122); WS873=(IToken)Match(input,WS,Follow._WS_in_bracket_expr_list8161); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS873); } break; default: goto loop569; } } loop569: ; } finally { DebugExitSubRule(569); } DebugLocation(704, 126); // SugarCpp.g:704:126: ( NEWLINE )* try { DebugEnterSubRule(570); while (true) { int alt570=2; try { DebugEnterDecision(570, false); int LA570_0 = input.LA(1); if ((LA570_0==NEWLINE)) { alt570 = 1; } } finally { DebugExitDecision(570); } switch ( alt570 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:704:126: NEWLINE { DebugLocation(704, 126); NEWLINE874=(IToken)Match(input,NEWLINE,Follow._NEWLINE_in_bracket_expr_list8164); if (state.failed) return retval; if (state.backtracking == 0) stream_NEWLINE.Add(NEWLINE874); } break; default: goto loop570; } } loop570: ; } finally { DebugExitSubRule(570); } DebugLocation(704, 135); DEDENT875=(IToken)Match(input,DEDENT,Follow._DEDENT_in_bracket_expr_list8167); if (state.failed) return retval; if (state.backtracking == 0) stream_DEDENT.Add(DEDENT875); } break; case 2: DebugEnterAlt(2); // SugarCpp.g:705:101: DEDENT ( NEWLINE )* ( WS )* ')' { DebugLocation(705, 101); DEDENT876=(IToken)Match(input,DEDENT,Follow._DEDENT_in_bracket_expr_list8269); if (state.failed) return retval; if (state.backtracking == 0) stream_DEDENT.Add(DEDENT876); DebugLocation(705, 108); // SugarCpp.g:705:108: ( NEWLINE )* try { DebugEnterSubRule(571); while (true) { int alt571=2; try { DebugEnterDecision(571, false); int LA571_0 = input.LA(1); if ((LA571_0==NEWLINE)) { alt571 = 1; } } finally { DebugExitDecision(571); } switch ( alt571 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:705:108: NEWLINE { DebugLocation(705, 108); NEWLINE877=(IToken)Match(input,NEWLINE,Follow._NEWLINE_in_bracket_expr_list8271); if (state.failed) return retval; if (state.backtracking == 0) stream_NEWLINE.Add(NEWLINE877); } break; default: goto loop571; } } loop571: ; } finally { DebugExitSubRule(571); } DebugLocation(705, 117); // SugarCpp.g:705:117: ( WS )* try { DebugEnterSubRule(572); while (true) { int alt572=2; try { DebugEnterDecision(572, false); int LA572_0 = input.LA(1); if ((LA572_0==WS)) { alt572 = 1; } } finally { DebugExitDecision(572); } switch ( alt572 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:705:117: WS { DebugLocation(705, 117); WS878=(IToken)Match(input,WS,Follow._WS_in_bracket_expr_list8274); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS878); } break; default: goto loop572; } } loop572: ; } finally { DebugExitSubRule(572); } DebugLocation(705, 121); char_literal879=(IToken)Match(input,94,Follow._94_in_bracket_expr_list8277); if (state.failed) return retval; if (state.backtracking == 0) stream_94.Add(char_literal879); } break; } } finally { DebugExitSubRule(573); } { // AST REWRITE // elements: expr // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: if (state.backtracking == 0) { retval.Tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null); root_0 = (CommonTree)adaptor.Nil(); // 706:50: -> ^( Expr_Args ( expr )* ) { DebugLocation(706, 53); // SugarCpp.g:706:53: ^( Expr_Args ( expr )* ) { CommonTree root_1 = (CommonTree)adaptor.Nil(); DebugLocation(706, 55); root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(Expr_Args, "Expr_Args"), root_1); DebugLocation(706, 65); // SugarCpp.g:706:65: ( expr )* while ( stream_expr.HasNext ) { DebugLocation(706, 65); adaptor.AddChild(root_1, stream_expr.NextTree()); } stream_expr.Reset(); adaptor.AddChild(root_0, root_1); } } retval.Tree = root_0; } } } break; case 2: DebugEnterAlt(2); // SugarCpp.g:707:30: ( ( WS )* expr ( ( ( WS )* ',' | ( WS )* NEWLINE )+ ( WS )* expr )* )? ( WS )* ')' { DebugLocation(707, 30); // SugarCpp.g:707:30: ( ( WS )* expr ( ( ( WS )* ',' | ( WS )* NEWLINE )+ ( WS )* expr )* )? int alt580=2; try { DebugEnterSubRule(580); try { DebugEnterDecision(580, false); try { alt580 = dfa580.Predict(input); } catch (NoViableAltException nvae) { DebugRecognitionException(nvae); throw; } } finally { DebugExitDecision(580); } switch (alt580) { case 1: DebugEnterAlt(1); // SugarCpp.g:707:31: ( WS )* expr ( ( ( WS )* ',' | ( WS )* NEWLINE )+ ( WS )* expr )* { DebugLocation(707, 31); // SugarCpp.g:707:31: ( WS )* try { DebugEnterSubRule(574); while (true) { int alt574=2; try { DebugEnterDecision(574, false); int LA574_0 = input.LA(1); if ((LA574_0==WS)) { alt574 = 1; } } finally { DebugExitDecision(574); } switch ( alt574 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:707:31: WS { DebugLocation(707, 31); WS880=(IToken)Match(input,WS,Follow._WS_in_bracket_expr_list8367); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS880); } break; default: goto loop574; } } loop574: ; } finally { DebugExitSubRule(574); } DebugLocation(707, 35); PushFollow(Follow._expr_in_bracket_expr_list8370); expr881=expr(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_expr.Add(expr881.Tree); DebugLocation(707, 40); // SugarCpp.g:707:40: ( ( ( WS )* ',' | ( WS )* NEWLINE )+ ( WS )* expr )* try { DebugEnterSubRule(579); while (true) { int alt579=2; try { DebugEnterDecision(579, false); try { alt579 = dfa579.Predict(input); } catch (NoViableAltException nvae) { DebugRecognitionException(nvae); throw; } } finally { DebugExitDecision(579); } switch ( alt579 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:707:41: ( ( WS )* ',' | ( WS )* NEWLINE )+ ( WS )* expr { DebugLocation(707, 41); // SugarCpp.g:707:41: ( ( WS )* ',' | ( WS )* NEWLINE )+ int cnt577=0; try { DebugEnterSubRule(577); while (true) { int alt577=3; try { DebugEnterDecision(577, false); try { alt577 = dfa577.Predict(input); } catch (NoViableAltException nvae) { DebugRecognitionException(nvae); throw; } } finally { DebugExitDecision(577); } switch (alt577) { case 1: DebugEnterAlt(1); // SugarCpp.g:707:42: ( WS )* ',' { DebugLocation(707, 42); // SugarCpp.g:707:42: ( WS )* try { DebugEnterSubRule(575); while (true) { int alt575=2; try { DebugEnterDecision(575, false); int LA575_0 = input.LA(1); if ((LA575_0==WS)) { alt575 = 1; } } finally { DebugExitDecision(575); } switch ( alt575 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:707:42: WS { DebugLocation(707, 42); WS882=(IToken)Match(input,WS,Follow._WS_in_bracket_expr_list8374); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS882); } break; default: goto loop575; } } loop575: ; } finally { DebugExitSubRule(575); } DebugLocation(707, 47); char_literal883=(IToken)Match(input,100,Follow._100_in_bracket_expr_list8378); if (state.failed) return retval; if (state.backtracking == 0) stream_100.Add(char_literal883); } break; case 2: DebugEnterAlt(2); // SugarCpp.g:707:53: ( WS )* NEWLINE { DebugLocation(707, 53); // SugarCpp.g:707:53: ( WS )* try { DebugEnterSubRule(576); while (true) { int alt576=2; try { DebugEnterDecision(576, false); int LA576_0 = input.LA(1); if ((LA576_0==WS)) { alt576 = 1; } } finally { DebugExitDecision(576); } switch ( alt576 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:707:53: WS { DebugLocation(707, 53); WS884=(IToken)Match(input,WS,Follow._WS_in_bracket_expr_list8382); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS884); } break; default: goto loop576; } } loop576: ; } finally { DebugExitSubRule(576); } DebugLocation(707, 58); NEWLINE885=(IToken)Match(input,NEWLINE,Follow._NEWLINE_in_bracket_expr_list8386); if (state.failed) return retval; if (state.backtracking == 0) stream_NEWLINE.Add(NEWLINE885); } break; default: if (cnt577 >= 1) goto loop577; if (state.backtracking>0) {state.failed=true; return retval;} EarlyExitException eee577 = new EarlyExitException( 577, input ); DebugRecognitionException(eee577); throw eee577; } cnt577++; } loop577: ; } finally { DebugExitSubRule(577); } DebugLocation(707, 68); // SugarCpp.g:707:68: ( WS )* try { DebugEnterSubRule(578); while (true) { int alt578=2; try { DebugEnterDecision(578, false); int LA578_0 = input.LA(1); if ((LA578_0==WS)) { alt578 = 1; } } finally { DebugExitDecision(578); } switch ( alt578 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:707:68: WS { DebugLocation(707, 68); WS886=(IToken)Match(input,WS,Follow._WS_in_bracket_expr_list8390); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS886); } break; default: goto loop578; } } loop578: ; } finally { DebugExitSubRule(578); } DebugLocation(707, 72); PushFollow(Follow._expr_in_bracket_expr_list8393); expr887=expr(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_expr.Add(expr887.Tree); } break; default: goto loop579; } } loop579: ; } finally { DebugExitSubRule(579); } } break; } } finally { DebugExitSubRule(580); } DebugLocation(707, 81); // SugarCpp.g:707:81: ( WS )* try { DebugEnterSubRule(581); while (true) { int alt581=2; try { DebugEnterDecision(581, false); int LA581_0 = input.LA(1); if ((LA581_0==WS)) { alt581 = 1; } } finally { DebugExitDecision(581); } switch ( alt581 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:707:81: WS { DebugLocation(707, 81); WS888=(IToken)Match(input,WS,Follow._WS_in_bracket_expr_list8399); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS888); } break; default: goto loop581; } } loop581: ; } finally { DebugExitSubRule(581); } DebugLocation(707, 85); char_literal889=(IToken)Match(input,94,Follow._94_in_bracket_expr_list8402); if (state.failed) return retval; if (state.backtracking == 0) stream_94.Add(char_literal889); { // AST REWRITE // elements: expr // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: if (state.backtracking == 0) { retval.Tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null); root_0 = (CommonTree)adaptor.Nil(); // 707:89: -> ^( Expr_Args ( expr )* ) { DebugLocation(707, 92); // SugarCpp.g:707:92: ^( Expr_Args ( expr )* ) { CommonTree root_1 = (CommonTree)adaptor.Nil(); DebugLocation(707, 94); root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(Expr_Args, "Expr_Args"), root_1); DebugLocation(707, 104); // SugarCpp.g:707:104: ( expr )* while ( stream_expr.HasNext ) { DebugLocation(707, 104); adaptor.AddChild(root_1, stream_expr.NextTree()); } stream_expr.Reset(); adaptor.AddChild(root_0, root_1); } } retval.Tree = root_0; } } } break; } } finally { DebugExitSubRule(582); } } break; } } finally { DebugExitSubRule(583); } } retval.Stop = (IToken)input.LT(-1); if (state.backtracking == 0) { retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0); adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop); } } catch (RecognitionException re) { ReportError(re); Recover(input,re); retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re); } finally { TraceOut("bracket_expr_list", 94); LeaveRule("bracket_expr_list", 94); LeaveRule_bracket_expr_list(); } DebugLocation(710, 1); } finally { DebugExitRule(GrammarFileName, "bracket_expr_list"); } return retval; }
private AstParserRuleReturnScope<CommonTree, IToken> import_def() { EnterRule_import_def(); EnterRule("import_def", 11); TraceIn("import_def", 11); AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>(); retval.Start = (IToken)input.LT(1); CommonTree root_0 = default(CommonTree); IToken string_literal89 = default(IToken); IToken WS90 = default(IToken); IToken STRING91 = default(IToken); IToken WS92 = default(IToken); IToken NEWLINE93 = default(IToken); IToken INDENT94 = default(IToken); IToken NEWLINE95 = default(IToken); IToken STRING96 = default(IToken); IToken WS97 = default(IToken); IToken NEWLINE98 = default(IToken); IToken DEDENT99 = default(IToken); AstParserRuleReturnScope<CommonTree, IToken> attribute88 = default(AstParserRuleReturnScope<CommonTree, IToken>); CommonTree string_literal89_tree = default(CommonTree); CommonTree WS90_tree = default(CommonTree); CommonTree STRING91_tree = default(CommonTree); CommonTree WS92_tree = default(CommonTree); CommonTree NEWLINE93_tree = default(CommonTree); CommonTree INDENT94_tree = default(CommonTree); CommonTree NEWLINE95_tree = default(CommonTree); CommonTree STRING96_tree = default(CommonTree); CommonTree WS97_tree = default(CommonTree); CommonTree NEWLINE98_tree = default(CommonTree); CommonTree DEDENT99_tree = default(CommonTree); RewriteRuleITokenStream stream_151=new RewriteRuleITokenStream(adaptor,"token 151"); RewriteRuleITokenStream stream_WS=new RewriteRuleITokenStream(adaptor,"token WS"); RewriteRuleITokenStream stream_DEDENT=new RewriteRuleITokenStream(adaptor,"token DEDENT"); RewriteRuleITokenStream stream_NEWLINE=new RewriteRuleITokenStream(adaptor,"token NEWLINE"); RewriteRuleITokenStream stream_INDENT=new RewriteRuleITokenStream(adaptor,"token INDENT"); RewriteRuleITokenStream stream_STRING=new RewriteRuleITokenStream(adaptor,"token STRING"); RewriteRuleSubtreeStream stream_attribute=new RewriteRuleSubtreeStream(adaptor,"rule attribute"); try { DebugEnterRule(GrammarFileName, "import_def"); DebugLocation(272, 1); try { // SugarCpp.g:273:2: ( ( attribute )? 'import' ( ( WS )* STRING )? ( ( WS )* ( NEWLINE )+ INDENT ( NEWLINE )* ( STRING ( WS )* ( NEWLINE )+ )* DEDENT )? -> ^( Import ( attribute )? ( STRING )* ) ) DebugEnterAlt(1); // SugarCpp.g:273:4: ( attribute )? 'import' ( ( WS )* STRING )? ( ( WS )* ( NEWLINE )+ INDENT ( NEWLINE )* ( STRING ( WS )* ( NEWLINE )+ )* DEDENT )? { DebugLocation(273, 4); // SugarCpp.g:273:4: ( attribute )? int alt54=2; try { DebugEnterSubRule(54); try { DebugEnterDecision(54, false); int LA54_0 = input.LA(1); if ((LA54_0==132)) { alt54 = 1; } } finally { DebugExitDecision(54); } switch (alt54) { case 1: DebugEnterAlt(1); // SugarCpp.g:273:4: attribute { DebugLocation(273, 4); PushFollow(Follow._attribute_in_import_def1278); attribute88=attribute(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_attribute.Add(attribute88.Tree); } break; } } finally { DebugExitSubRule(54); } DebugLocation(273, 15); string_literal89=(IToken)Match(input,151,Follow._151_in_import_def1281); if (state.failed) return retval; if (state.backtracking == 0) stream_151.Add(string_literal89); DebugLocation(273, 24); // SugarCpp.g:273:24: ( ( WS )* STRING )? int alt56=2; try { DebugEnterSubRule(56); try { DebugEnterDecision(56, false); try { alt56 = dfa56.Predict(input); } catch (NoViableAltException nvae) { DebugRecognitionException(nvae); throw; } } finally { DebugExitDecision(56); } switch (alt56) { case 1: DebugEnterAlt(1); // SugarCpp.g:273:25: ( WS )* STRING { DebugLocation(273, 25); // SugarCpp.g:273:25: ( WS )* try { DebugEnterSubRule(55); while (true) { int alt55=2; try { DebugEnterDecision(55, false); int LA55_0 = input.LA(1); if ((LA55_0==WS)) { alt55 = 1; } } finally { DebugExitDecision(55); } switch ( alt55 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:273:25: WS { DebugLocation(273, 25); WS90=(IToken)Match(input,WS,Follow._WS_in_import_def1284); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS90); } break; default: goto loop55; } } loop55: ; } finally { DebugExitSubRule(55); } DebugLocation(273, 29); STRING91=(IToken)Match(input,STRING,Follow._STRING_in_import_def1287); if (state.failed) return retval; if (state.backtracking == 0) stream_STRING.Add(STRING91); } break; } } finally { DebugExitSubRule(56); } DebugLocation(273, 38); // SugarCpp.g:273:38: ( ( WS )* ( NEWLINE )+ INDENT ( NEWLINE )* ( STRING ( WS )* ( NEWLINE )+ )* DEDENT )? int alt63=2; try { DebugEnterSubRule(63); try { DebugEnterDecision(63, false); try { alt63 = dfa63.Predict(input); } catch (NoViableAltException nvae) { DebugRecognitionException(nvae); throw; } } finally { DebugExitDecision(63); } switch (alt63) { case 1: DebugEnterAlt(1); // SugarCpp.g:273:39: ( WS )* ( NEWLINE )+ INDENT ( NEWLINE )* ( STRING ( WS )* ( NEWLINE )+ )* DEDENT { DebugLocation(273, 39); // SugarCpp.g:273:39: ( WS )* try { DebugEnterSubRule(57); while (true) { int alt57=2; try { DebugEnterDecision(57, false); int LA57_0 = input.LA(1); if ((LA57_0==WS)) { alt57 = 1; } } finally { DebugExitDecision(57); } switch ( alt57 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:273:39: WS { DebugLocation(273, 39); WS92=(IToken)Match(input,WS,Follow._WS_in_import_def1292); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS92); } break; default: goto loop57; } } loop57: ; } finally { DebugExitSubRule(57); } DebugLocation(273, 43); // SugarCpp.g:273:43: ( NEWLINE )+ int cnt58=0; try { DebugEnterSubRule(58); while (true) { int alt58=2; try { DebugEnterDecision(58, false); int LA58_0 = input.LA(1); if ((LA58_0==NEWLINE)) { alt58 = 1; } } finally { DebugExitDecision(58); } switch (alt58) { case 1: DebugEnterAlt(1); // SugarCpp.g:273:43: NEWLINE { DebugLocation(273, 43); NEWLINE93=(IToken)Match(input,NEWLINE,Follow._NEWLINE_in_import_def1295); if (state.failed) return retval; if (state.backtracking == 0) stream_NEWLINE.Add(NEWLINE93); } break; default: if (cnt58 >= 1) goto loop58; if (state.backtracking>0) {state.failed=true; return retval;} EarlyExitException eee58 = new EarlyExitException( 58, input ); DebugRecognitionException(eee58); throw eee58; } cnt58++; } loop58: ; } finally { DebugExitSubRule(58); } DebugLocation(273, 52); INDENT94=(IToken)Match(input,INDENT,Follow._INDENT_in_import_def1298); if (state.failed) return retval; if (state.backtracking == 0) stream_INDENT.Add(INDENT94); DebugLocation(273, 59); // SugarCpp.g:273:59: ( NEWLINE )* try { DebugEnterSubRule(59); while (true) { int alt59=2; try { DebugEnterDecision(59, false); int LA59_0 = input.LA(1); if ((LA59_0==NEWLINE)) { alt59 = 1; } } finally { DebugExitDecision(59); } switch ( alt59 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:273:59: NEWLINE { DebugLocation(273, 59); NEWLINE95=(IToken)Match(input,NEWLINE,Follow._NEWLINE_in_import_def1300); if (state.failed) return retval; if (state.backtracking == 0) stream_NEWLINE.Add(NEWLINE95); } break; default: goto loop59; } } loop59: ; } finally { DebugExitSubRule(59); } DebugLocation(273, 68); // SugarCpp.g:273:68: ( STRING ( WS )* ( NEWLINE )+ )* try { DebugEnterSubRule(62); while (true) { int alt62=2; try { DebugEnterDecision(62, false); int LA62_0 = input.LA(1); if ((LA62_0==STRING)) { alt62 = 1; } } finally { DebugExitDecision(62); } switch ( alt62 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:273:69: STRING ( WS )* ( NEWLINE )+ { DebugLocation(273, 69); STRING96=(IToken)Match(input,STRING,Follow._STRING_in_import_def1304); if (state.failed) return retval; if (state.backtracking == 0) stream_STRING.Add(STRING96); DebugLocation(273, 76); // SugarCpp.g:273:76: ( WS )* try { DebugEnterSubRule(60); while (true) { int alt60=2; try { DebugEnterDecision(60, false); int LA60_0 = input.LA(1); if ((LA60_0==WS)) { alt60 = 1; } } finally { DebugExitDecision(60); } switch ( alt60 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:273:76: WS { DebugLocation(273, 76); WS97=(IToken)Match(input,WS,Follow._WS_in_import_def1306); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS97); } break; default: goto loop60; } } loop60: ; } finally { DebugExitSubRule(60); } DebugLocation(273, 80); // SugarCpp.g:273:80: ( NEWLINE )+ int cnt61=0; try { DebugEnterSubRule(61); while (true) { int alt61=2; try { DebugEnterDecision(61, false); int LA61_0 = input.LA(1); if ((LA61_0==NEWLINE)) { alt61 = 1; } } finally { DebugExitDecision(61); } switch (alt61) { case 1: DebugEnterAlt(1); // SugarCpp.g:273:80: NEWLINE { DebugLocation(273, 80); NEWLINE98=(IToken)Match(input,NEWLINE,Follow._NEWLINE_in_import_def1309); if (state.failed) return retval; if (state.backtracking == 0) stream_NEWLINE.Add(NEWLINE98); } break; default: if (cnt61 >= 1) goto loop61; if (state.backtracking>0) {state.failed=true; return retval;} EarlyExitException eee61 = new EarlyExitException( 61, input ); DebugRecognitionException(eee61); throw eee61; } cnt61++; } loop61: ; } finally { DebugExitSubRule(61); } } break; default: goto loop62; } } loop62: ; } finally { DebugExitSubRule(62); } DebugLocation(273, 91); DEDENT99=(IToken)Match(input,DEDENT,Follow._DEDENT_in_import_def1314); if (state.failed) return retval; if (state.backtracking == 0) stream_DEDENT.Add(DEDENT99); } break; } } finally { DebugExitSubRule(63); } { // AST REWRITE // elements: STRING, attribute // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: if (state.backtracking == 0) { retval.Tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null); root_0 = (CommonTree)adaptor.Nil(); // 273:100: -> ^( Import ( attribute )? ( STRING )* ) { DebugLocation(273, 103); // SugarCpp.g:273:103: ^( Import ( attribute )? ( STRING )* ) { CommonTree root_1 = (CommonTree)adaptor.Nil(); DebugLocation(273, 105); root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(Import, "Import"), root_1); DebugLocation(273, 112); // SugarCpp.g:273:112: ( attribute )? if (stream_attribute.HasNext) { DebugLocation(273, 112); adaptor.AddChild(root_1, stream_attribute.NextTree()); } stream_attribute.Reset(); DebugLocation(273, 123); // SugarCpp.g:273:123: ( STRING )* while ( stream_STRING.HasNext ) { DebugLocation(273, 123); adaptor.AddChild(root_1, stream_STRING.NextNode()); } stream_STRING.Reset(); adaptor.AddChild(root_0, root_1); } } retval.Tree = root_0; } } } retval.Stop = (IToken)input.LT(-1); if (state.backtracking == 0) { retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0); adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop); } } catch (RecognitionException re) { ReportError(re); Recover(input,re); retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re); } finally { TraceOut("import_def", 11); LeaveRule("import_def", 11); LeaveRule_import_def(); } DebugLocation(274, 1); } finally { DebugExitRule(GrammarFileName, "import_def"); } return retval; }
private AstParserRuleReturnScope<CommonTree, IToken> global_typedef() { EnterRule_global_typedef(); EnterRule("global_typedef", 10); TraceIn("global_typedef", 10); AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>(); retval.Start = (IToken)input.LT(1); CommonTree root_0 = default(CommonTree); IToken string_literal81 = default(IToken); IToken WS82 = default(IToken); IToken WS84 = default(IToken); IToken char_literal85 = default(IToken); IToken WS86 = default(IToken); AstParserRuleReturnScope<CommonTree, IToken> attribute80 = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> ident83 = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> type_name87 = default(AstParserRuleReturnScope<CommonTree, IToken>); CommonTree string_literal81_tree = default(CommonTree); CommonTree WS82_tree = default(CommonTree); CommonTree WS84_tree = default(CommonTree); CommonTree char_literal85_tree = default(CommonTree); CommonTree WS86_tree = default(CommonTree); RewriteRuleITokenStream stream_174=new RewriteRuleITokenStream(adaptor,"token 174"); RewriteRuleITokenStream stream_WS=new RewriteRuleITokenStream(adaptor,"token WS"); RewriteRuleITokenStream stream_121=new RewriteRuleITokenStream(adaptor,"token 121"); RewriteRuleSubtreeStream stream_ident=new RewriteRuleSubtreeStream(adaptor,"rule ident"); RewriteRuleSubtreeStream stream_type_name=new RewriteRuleSubtreeStream(adaptor,"rule type_name"); RewriteRuleSubtreeStream stream_attribute=new RewriteRuleSubtreeStream(adaptor,"rule attribute"); try { DebugEnterRule(GrammarFileName, "global_typedef"); DebugLocation(268, 1); try { // SugarCpp.g:269:2: ( ( attribute )? 'typedef' ( WS )* ident ( WS )* '=' ( WS )* type_name -> ^( Stmt_Typedef ( attribute )? type_name ident ) ) DebugEnterAlt(1); // SugarCpp.g:269:4: ( attribute )? 'typedef' ( WS )* ident ( WS )* '=' ( WS )* type_name { DebugLocation(269, 4); // SugarCpp.g:269:4: ( attribute )? int alt50=2; try { DebugEnterSubRule(50); try { DebugEnterDecision(50, false); int LA50_0 = input.LA(1); if ((LA50_0==132)) { alt50 = 1; } } finally { DebugExitDecision(50); } switch (alt50) { case 1: DebugEnterAlt(1); // SugarCpp.g:269:4: attribute { DebugLocation(269, 4); PushFollow(Follow._attribute_in_global_typedef1236); attribute80=attribute(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_attribute.Add(attribute80.Tree); } break; } } finally { DebugExitSubRule(50); } DebugLocation(269, 15); string_literal81=(IToken)Match(input,174,Follow._174_in_global_typedef1239); if (state.failed) return retval; if (state.backtracking == 0) stream_174.Add(string_literal81); DebugLocation(269, 25); // SugarCpp.g:269:25: ( WS )* try { DebugEnterSubRule(51); while (true) { int alt51=2; try { DebugEnterDecision(51, false); int LA51_0 = input.LA(1); if ((LA51_0==WS)) { alt51 = 1; } } finally { DebugExitDecision(51); } switch ( alt51 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:269:25: WS { DebugLocation(269, 25); WS82=(IToken)Match(input,WS,Follow._WS_in_global_typedef1241); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS82); } break; default: goto loop51; } } loop51: ; } finally { DebugExitSubRule(51); } DebugLocation(269, 29); PushFollow(Follow._ident_in_global_typedef1244); ident83=ident(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_ident.Add(ident83.Tree); DebugLocation(269, 35); // SugarCpp.g:269:35: ( WS )* try { DebugEnterSubRule(52); while (true) { int alt52=2; try { DebugEnterDecision(52, false); int LA52_0 = input.LA(1); if ((LA52_0==WS)) { alt52 = 1; } } finally { DebugExitDecision(52); } switch ( alt52 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:269:35: WS { DebugLocation(269, 35); WS84=(IToken)Match(input,WS,Follow._WS_in_global_typedef1246); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS84); } break; default: goto loop52; } } loop52: ; } finally { DebugExitSubRule(52); } DebugLocation(269, 39); char_literal85=(IToken)Match(input,121,Follow._121_in_global_typedef1249); if (state.failed) return retval; if (state.backtracking == 0) stream_121.Add(char_literal85); DebugLocation(269, 43); // SugarCpp.g:269:43: ( WS )* try { DebugEnterSubRule(53); while (true) { int alt53=2; try { DebugEnterDecision(53, false); int LA53_0 = input.LA(1); if ((LA53_0==WS)) { alt53 = 1; } } finally { DebugExitDecision(53); } switch ( alt53 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:269:43: WS { DebugLocation(269, 43); WS86=(IToken)Match(input,WS,Follow._WS_in_global_typedef1251); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS86); } break; default: goto loop53; } } loop53: ; } finally { DebugExitSubRule(53); } DebugLocation(269, 47); PushFollow(Follow._type_name_in_global_typedef1254); type_name87=type_name(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_type_name.Add(type_name87.Tree); { // AST REWRITE // elements: ident, type_name, attribute // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: if (state.backtracking == 0) { retval.Tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null); root_0 = (CommonTree)adaptor.Nil(); // 269:57: -> ^( Stmt_Typedef ( attribute )? type_name ident ) { DebugLocation(269, 60); // SugarCpp.g:269:60: ^( Stmt_Typedef ( attribute )? type_name ident ) { CommonTree root_1 = (CommonTree)adaptor.Nil(); DebugLocation(269, 62); root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(Stmt_Typedef, "Stmt_Typedef"), root_1); DebugLocation(269, 75); // SugarCpp.g:269:75: ( attribute )? if (stream_attribute.HasNext) { DebugLocation(269, 75); adaptor.AddChild(root_1, stream_attribute.NextTree()); } stream_attribute.Reset(); DebugLocation(269, 86); adaptor.AddChild(root_1, stream_type_name.NextTree()); DebugLocation(269, 96); adaptor.AddChild(root_1, stream_ident.NextTree()); adaptor.AddChild(root_0, root_1); } } retval.Tree = root_0; } } } retval.Stop = (IToken)input.LT(-1); if (state.backtracking == 0) { retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0); adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop); } } catch (RecognitionException re) { ReportError(re); Recover(input,re); retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re); } finally { TraceOut("global_typedef", 10); LeaveRule("global_typedef", 10); LeaveRule_global_typedef(); } DebugLocation(270, 1); } finally { DebugExitRule(GrammarFileName, "global_typedef"); } return retval; }
private AstParserRuleReturnScope<CommonTree, IToken> square_expr_list() { EnterRule_square_expr_list(); EnterRule("square_expr_list", 93); TraceIn("square_expr_list", 93); AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>(); retval.Start = (IToken)input.LT(1); CommonTree root_0 = default(CommonTree); IToken char_literal840 = default(IToken); IToken WS841 = default(IToken); IToken WS843 = default(IToken); IToken char_literal844 = default(IToken); IToken WS845 = default(IToken); IToken WS847 = default(IToken); IToken char_literal848 = default(IToken); AstParserRuleReturnScope<CommonTree, IToken> expr842 = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> expr846 = default(AstParserRuleReturnScope<CommonTree, IToken>); CommonTree char_literal840_tree = default(CommonTree); CommonTree WS841_tree = default(CommonTree); CommonTree WS843_tree = default(CommonTree); CommonTree char_literal844_tree = default(CommonTree); CommonTree WS845_tree = default(CommonTree); CommonTree WS847_tree = default(CommonTree); CommonTree char_literal848_tree = default(CommonTree); RewriteRuleITokenStream stream_132=new RewriteRuleITokenStream(adaptor,"token 132"); RewriteRuleITokenStream stream_133=new RewriteRuleITokenStream(adaptor,"token 133"); RewriteRuleITokenStream stream_WS=new RewriteRuleITokenStream(adaptor,"token WS"); RewriteRuleITokenStream stream_100=new RewriteRuleITokenStream(adaptor,"token 100"); RewriteRuleSubtreeStream stream_expr=new RewriteRuleSubtreeStream(adaptor,"rule expr"); try { DebugEnterRule(GrammarFileName, "square_expr_list"); DebugLocation(698, 1); try { // SugarCpp.g:699:2: ( '[' ( WS )* expr ( ( WS )* ',' ( WS )* expr )* ( WS )* ']' -> ^( Expr_Args ( expr )* ) ) DebugEnterAlt(1); // SugarCpp.g:699:4: '[' ( WS )* expr ( ( WS )* ',' ( WS )* expr )* ( WS )* ']' { DebugLocation(699, 4); char_literal840=(IToken)Match(input,132,Follow._132_in_square_expr_list8003); if (state.failed) return retval; if (state.backtracking == 0) stream_132.Add(char_literal840); DebugLocation(699, 8); // SugarCpp.g:699:8: ( WS )* try { DebugEnterSubRule(547); while (true) { int alt547=2; try { DebugEnterDecision(547, false); int LA547_0 = input.LA(1); if ((LA547_0==WS)) { alt547 = 1; } } finally { DebugExitDecision(547); } switch ( alt547 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:699:8: WS { DebugLocation(699, 8); WS841=(IToken)Match(input,WS,Follow._WS_in_square_expr_list8005); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS841); } break; default: goto loop547; } } loop547: ; } finally { DebugExitSubRule(547); } DebugLocation(699, 12); PushFollow(Follow._expr_in_square_expr_list8008); expr842=expr(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_expr.Add(expr842.Tree); DebugLocation(699, 17); // SugarCpp.g:699:17: ( ( WS )* ',' ( WS )* expr )* try { DebugEnterSubRule(550); while (true) { int alt550=2; try { DebugEnterDecision(550, false); try { alt550 = dfa550.Predict(input); } catch (NoViableAltException nvae) { DebugRecognitionException(nvae); throw; } } finally { DebugExitDecision(550); } switch ( alt550 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:699:18: ( WS )* ',' ( WS )* expr { DebugLocation(699, 18); // SugarCpp.g:699:18: ( WS )* try { DebugEnterSubRule(548); while (true) { int alt548=2; try { DebugEnterDecision(548, false); int LA548_0 = input.LA(1); if ((LA548_0==WS)) { alt548 = 1; } } finally { DebugExitDecision(548); } switch ( alt548 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:699:18: WS { DebugLocation(699, 18); WS843=(IToken)Match(input,WS,Follow._WS_in_square_expr_list8011); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS843); } break; default: goto loop548; } } loop548: ; } finally { DebugExitSubRule(548); } DebugLocation(699, 22); char_literal844=(IToken)Match(input,100,Follow._100_in_square_expr_list8014); if (state.failed) return retval; if (state.backtracking == 0) stream_100.Add(char_literal844); DebugLocation(699, 26); // SugarCpp.g:699:26: ( WS )* try { DebugEnterSubRule(549); while (true) { int alt549=2; try { DebugEnterDecision(549, false); int LA549_0 = input.LA(1); if ((LA549_0==WS)) { alt549 = 1; } } finally { DebugExitDecision(549); } switch ( alt549 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:699:26: WS { DebugLocation(699, 26); WS845=(IToken)Match(input,WS,Follow._WS_in_square_expr_list8016); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS845); } break; default: goto loop549; } } loop549: ; } finally { DebugExitSubRule(549); } DebugLocation(699, 30); PushFollow(Follow._expr_in_square_expr_list8019); expr846=expr(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_expr.Add(expr846.Tree); } break; default: goto loop550; } } loop550: ; } finally { DebugExitSubRule(550); } DebugLocation(699, 37); // SugarCpp.g:699:37: ( WS )* try { DebugEnterSubRule(551); while (true) { int alt551=2; try { DebugEnterDecision(551, false); int LA551_0 = input.LA(1); if ((LA551_0==WS)) { alt551 = 1; } } finally { DebugExitDecision(551); } switch ( alt551 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:699:37: WS { DebugLocation(699, 37); WS847=(IToken)Match(input,WS,Follow._WS_in_square_expr_list8023); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS847); } break; default: goto loop551; } } loop551: ; } finally { DebugExitSubRule(551); } DebugLocation(699, 41); char_literal848=(IToken)Match(input,133,Follow._133_in_square_expr_list8026); if (state.failed) return retval; if (state.backtracking == 0) stream_133.Add(char_literal848); { // AST REWRITE // elements: expr // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: if (state.backtracking == 0) { retval.Tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null); root_0 = (CommonTree)adaptor.Nil(); // 699:45: -> ^( Expr_Args ( expr )* ) { DebugLocation(699, 48); // SugarCpp.g:699:48: ^( Expr_Args ( expr )* ) { CommonTree root_1 = (CommonTree)adaptor.Nil(); DebugLocation(699, 50); root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(Expr_Args, "Expr_Args"), root_1); DebugLocation(699, 60); // SugarCpp.g:699:60: ( expr )* while ( stream_expr.HasNext ) { DebugLocation(699, 60); adaptor.AddChild(root_1, stream_expr.NextTree()); } stream_expr.Reset(); adaptor.AddChild(root_0, root_1); } } retval.Tree = root_0; } } } retval.Stop = (IToken)input.LT(-1); if (state.backtracking == 0) { retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0); adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop); } } catch (RecognitionException re) { ReportError(re); Recover(input,re); retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re); } finally { TraceOut("square_expr_list", 93); LeaveRule("square_expr_list", 93); LeaveRule_square_expr_list(); } DebugLocation(700, 1); } finally { DebugExitRule(GrammarFileName, "square_expr_list"); } return retval; }
private AstParserRuleReturnScope<CommonTree, IToken> global_using() { EnterRule_global_using(); EnterRule("global_using", 9); TraceIn("global_using", 9); AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>(); retval.Start = (IToken)input.LT(1); CommonTree root_0 = default(CommonTree); IToken string_literal77 = default(IToken); IToken WS78 = default(IToken); AstParserRuleReturnScope<CommonTree, IToken> attribute76 = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> stmt_using_item79 = default(AstParserRuleReturnScope<CommonTree, IToken>); CommonTree string_literal77_tree = default(CommonTree); CommonTree WS78_tree = default(CommonTree); RewriteRuleITokenStream stream_WS=new RewriteRuleITokenStream(adaptor,"token WS"); RewriteRuleITokenStream stream_177=new RewriteRuleITokenStream(adaptor,"token 177"); RewriteRuleSubtreeStream stream_attribute=new RewriteRuleSubtreeStream(adaptor,"rule attribute"); RewriteRuleSubtreeStream stream_stmt_using_item=new RewriteRuleSubtreeStream(adaptor,"rule stmt_using_item"); try { DebugEnterRule(GrammarFileName, "global_using"); DebugLocation(264, 1); try { // SugarCpp.g:265:2: ( ( attribute )? 'using' ( ( WS )* stmt_using_item )* -> ^( Stmt_Using ( attribute )? ( stmt_using_item )* ) ) DebugEnterAlt(1); // SugarCpp.g:265:4: ( attribute )? 'using' ( ( WS )* stmt_using_item )* { DebugLocation(265, 4); // SugarCpp.g:265:4: ( attribute )? int alt47=2; try { DebugEnterSubRule(47); try { DebugEnterDecision(47, false); int LA47_0 = input.LA(1); if ((LA47_0==132)) { alt47 = 1; } } finally { DebugExitDecision(47); } switch (alt47) { case 1: DebugEnterAlt(1); // SugarCpp.g:265:4: attribute { DebugLocation(265, 4); PushFollow(Follow._attribute_in_global_using1202); attribute76=attribute(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_attribute.Add(attribute76.Tree); } break; } } finally { DebugExitSubRule(47); } DebugLocation(265, 15); string_literal77=(IToken)Match(input,177,Follow._177_in_global_using1205); if (state.failed) return retval; if (state.backtracking == 0) stream_177.Add(string_literal77); DebugLocation(265, 23); // SugarCpp.g:265:23: ( ( WS )* stmt_using_item )* try { DebugEnterSubRule(49); while (true) { int alt49=2; try { DebugEnterDecision(49, false); try { alt49 = dfa49.Predict(input); } catch (NoViableAltException nvae) { DebugRecognitionException(nvae); throw; } } finally { DebugExitDecision(49); } switch ( alt49 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:265:24: ( WS )* stmt_using_item { DebugLocation(265, 24); // SugarCpp.g:265:24: ( WS )* try { DebugEnterSubRule(48); while (true) { int alt48=2; try { DebugEnterDecision(48, false); int LA48_0 = input.LA(1); if ((LA48_0==WS)) { alt48 = 1; } } finally { DebugExitDecision(48); } switch ( alt48 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:265:24: WS { DebugLocation(265, 24); WS78=(IToken)Match(input,WS,Follow._WS_in_global_using1208); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS78); } break; default: goto loop48; } } loop48: ; } finally { DebugExitSubRule(48); } DebugLocation(265, 28); PushFollow(Follow._stmt_using_item_in_global_using1211); stmt_using_item79=stmt_using_item(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_stmt_using_item.Add(stmt_using_item79.Tree); } break; default: goto loop49; } } loop49: ; } finally { DebugExitSubRule(49); } { // AST REWRITE // elements: stmt_using_item, attribute // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: if (state.backtracking == 0) { retval.Tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null); root_0 = (CommonTree)adaptor.Nil(); // 265:46: -> ^( Stmt_Using ( attribute )? ( stmt_using_item )* ) { DebugLocation(265, 49); // SugarCpp.g:265:49: ^( Stmt_Using ( attribute )? ( stmt_using_item )* ) { CommonTree root_1 = (CommonTree)adaptor.Nil(); DebugLocation(265, 51); root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(Stmt_Using, "Stmt_Using"), root_1); DebugLocation(265, 62); // SugarCpp.g:265:62: ( attribute )? if (stream_attribute.HasNext) { DebugLocation(265, 62); adaptor.AddChild(root_1, stream_attribute.NextTree()); } stream_attribute.Reset(); DebugLocation(265, 73); // SugarCpp.g:265:73: ( stmt_using_item )* while ( stream_stmt_using_item.HasNext ) { DebugLocation(265, 73); adaptor.AddChild(root_1, stream_stmt_using_item.NextTree()); } stream_stmt_using_item.Reset(); adaptor.AddChild(root_0, root_1); } } retval.Tree = root_0; } } } retval.Stop = (IToken)input.LT(-1); if (state.backtracking == 0) { retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0); adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop); } } catch (RecognitionException re) { ReportError(re); Recover(input,re); retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re); } finally { TraceOut("global_using", 9); LeaveRule("global_using", 9); LeaveRule_global_using(); } DebugLocation(266, 1); } finally { DebugExitRule(GrammarFileName, "global_using"); } return retval; }
private AstParserRuleReturnScope<CommonTree, IToken> lambda_expr() { EnterRule_lambda_expr(); EnterRule("lambda_expr", 69); TraceIn("lambda_expr", 69); AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>(); retval.Start = (IToken)input.LT(1); CommonTree root_0 = default(CommonTree); IToken char_literal721 = default(IToken); IToken WS722 = default(IToken); IToken WS724 = default(IToken); IToken char_literal725 = default(IToken); IToken WS726 = default(IToken); IToken WS728 = default(IToken); IToken WS730 = default(IToken); AstParserRuleReturnScope<CommonTree, IToken> func_args723 = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> lambda_type727 = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> lambda_expr_op729 = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> lambda_value731 = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> modify_expr732 = default(AstParserRuleReturnScope<CommonTree, IToken>); CommonTree char_literal721_tree = default(CommonTree); CommonTree WS722_tree = default(CommonTree); CommonTree WS724_tree = default(CommonTree); CommonTree char_literal725_tree = default(CommonTree); CommonTree WS726_tree = default(CommonTree); CommonTree WS728_tree = default(CommonTree); CommonTree WS730_tree = default(CommonTree); RewriteRuleITokenStream stream_94=new RewriteRuleITokenStream(adaptor,"token 94"); RewriteRuleITokenStream stream_WS=new RewriteRuleITokenStream(adaptor,"token WS"); RewriteRuleITokenStream stream_93=new RewriteRuleITokenStream(adaptor,"token 93"); RewriteRuleSubtreeStream stream_lambda_expr_op=new RewriteRuleSubtreeStream(adaptor,"rule lambda_expr_op"); RewriteRuleSubtreeStream stream_lambda_value=new RewriteRuleSubtreeStream(adaptor,"rule lambda_value"); RewriteRuleSubtreeStream stream_func_args=new RewriteRuleSubtreeStream(adaptor,"rule func_args"); RewriteRuleSubtreeStream stream_lambda_type=new RewriteRuleSubtreeStream(adaptor,"rule lambda_type"); try { DebugEnterRule(GrammarFileName, "lambda_expr"); DebugLocation(593, 1); try { // SugarCpp.g:594:2: ( '(' ( ( WS )* func_args )? ( WS )* ')' ( ( WS )* lambda_type )? ( WS )* lambda_expr_op ( WS )* lambda_value -> ^( Expr_Lambda lambda_expr_op ( func_args )? ( lambda_type )? lambda_value ) | modify_expr ) int alt465=2; try { DebugEnterDecision(465, false); try { alt465 = dfa465.Predict(input); } catch (NoViableAltException nvae) { DebugRecognitionException(nvae); throw; } } finally { DebugExitDecision(465); } switch (alt465) { case 1: DebugEnterAlt(1); // SugarCpp.g:594:4: '(' ( ( WS )* func_args )? ( WS )* ')' ( ( WS )* lambda_type )? ( WS )* lambda_expr_op ( WS )* lambda_value { DebugLocation(594, 4); char_literal721=(IToken)Match(input,93,Follow._93_in_lambda_expr6434); if (state.failed) return retval; if (state.backtracking == 0) stream_93.Add(char_literal721); DebugLocation(594, 8); // SugarCpp.g:594:8: ( ( WS )* func_args )? int alt459=2; try { DebugEnterSubRule(459); try { DebugEnterDecision(459, false); try { alt459 = dfa459.Predict(input); } catch (NoViableAltException nvae) { DebugRecognitionException(nvae); throw; } } finally { DebugExitDecision(459); } switch (alt459) { case 1: DebugEnterAlt(1); // SugarCpp.g:594:9: ( WS )* func_args { DebugLocation(594, 9); // SugarCpp.g:594:9: ( WS )* try { DebugEnterSubRule(458); while (true) { int alt458=2; try { DebugEnterDecision(458, false); int LA458_0 = input.LA(1); if ((LA458_0==WS)) { alt458 = 1; } } finally { DebugExitDecision(458); } switch ( alt458 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:594:9: WS { DebugLocation(594, 9); WS722=(IToken)Match(input,WS,Follow._WS_in_lambda_expr6437); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS722); } break; default: goto loop458; } } loop458: ; } finally { DebugExitSubRule(458); } DebugLocation(594, 13); PushFollow(Follow._func_args_in_lambda_expr6440); func_args723=func_args(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_func_args.Add(func_args723.Tree); } break; } } finally { DebugExitSubRule(459); } DebugLocation(594, 25); // SugarCpp.g:594:25: ( WS )* try { DebugEnterSubRule(460); while (true) { int alt460=2; try { DebugEnterDecision(460, false); int LA460_0 = input.LA(1); if ((LA460_0==WS)) { alt460 = 1; } } finally { DebugExitDecision(460); } switch ( alt460 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:594:25: WS { DebugLocation(594, 25); WS724=(IToken)Match(input,WS,Follow._WS_in_lambda_expr6444); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS724); } break; default: goto loop460; } } loop460: ; } finally { DebugExitSubRule(460); } DebugLocation(594, 29); char_literal725=(IToken)Match(input,94,Follow._94_in_lambda_expr6447); if (state.failed) return retval; if (state.backtracking == 0) stream_94.Add(char_literal725); DebugLocation(594, 33); // SugarCpp.g:594:33: ( ( WS )* lambda_type )? int alt462=2; try { DebugEnterSubRule(462); try { DebugEnterDecision(462, false); try { alt462 = dfa462.Predict(input); } catch (NoViableAltException nvae) { DebugRecognitionException(nvae); throw; } } finally { DebugExitDecision(462); } switch (alt462) { case 1: DebugEnterAlt(1); // SugarCpp.g:594:34: ( WS )* lambda_type { DebugLocation(594, 34); // SugarCpp.g:594:34: ( WS )* try { DebugEnterSubRule(461); while (true) { int alt461=2; try { DebugEnterDecision(461, false); int LA461_0 = input.LA(1); if ((LA461_0==WS)) { alt461 = 1; } } finally { DebugExitDecision(461); } switch ( alt461 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:594:34: WS { DebugLocation(594, 34); WS726=(IToken)Match(input,WS,Follow._WS_in_lambda_expr6450); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS726); } break; default: goto loop461; } } loop461: ; } finally { DebugExitSubRule(461); } DebugLocation(594, 38); PushFollow(Follow._lambda_type_in_lambda_expr6453); lambda_type727=lambda_type(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_lambda_type.Add(lambda_type727.Tree); } break; } } finally { DebugExitSubRule(462); } DebugLocation(594, 52); // SugarCpp.g:594:52: ( WS )* try { DebugEnterSubRule(463); while (true) { int alt463=2; try { DebugEnterDecision(463, false); int LA463_0 = input.LA(1); if ((LA463_0==WS)) { alt463 = 1; } } finally { DebugExitDecision(463); } switch ( alt463 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:594:52: WS { DebugLocation(594, 52); WS728=(IToken)Match(input,WS,Follow._WS_in_lambda_expr6457); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS728); } break; default: goto loop463; } } loop463: ; } finally { DebugExitSubRule(463); } DebugLocation(594, 56); PushFollow(Follow._lambda_expr_op_in_lambda_expr6460); lambda_expr_op729=lambda_expr_op(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_lambda_expr_op.Add(lambda_expr_op729.Tree); DebugLocation(594, 71); // SugarCpp.g:594:71: ( WS )* try { DebugEnterSubRule(464); while (true) { int alt464=2; try { DebugEnterDecision(464, false); int LA464_0 = input.LA(1); if ((LA464_0==WS)) { alt464 = 1; } } finally { DebugExitDecision(464); } switch ( alt464 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:594:71: WS { DebugLocation(594, 71); WS730=(IToken)Match(input,WS,Follow._WS_in_lambda_expr6462); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS730); } break; default: goto loop464; } } loop464: ; } finally { DebugExitSubRule(464); } DebugLocation(594, 75); PushFollow(Follow._lambda_value_in_lambda_expr6465); lambda_value731=lambda_value(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_lambda_value.Add(lambda_value731.Tree); { // AST REWRITE // elements: lambda_type, func_args, lambda_expr_op, lambda_value // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: if (state.backtracking == 0) { retval.Tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null); root_0 = (CommonTree)adaptor.Nil(); // 594:88: -> ^( Expr_Lambda lambda_expr_op ( func_args )? ( lambda_type )? lambda_value ) { DebugLocation(594, 91); // SugarCpp.g:594:91: ^( Expr_Lambda lambda_expr_op ( func_args )? ( lambda_type )? lambda_value ) { CommonTree root_1 = (CommonTree)adaptor.Nil(); DebugLocation(594, 93); root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(Expr_Lambda, "Expr_Lambda"), root_1); DebugLocation(594, 105); adaptor.AddChild(root_1, stream_lambda_expr_op.NextTree()); DebugLocation(594, 120); // SugarCpp.g:594:120: ( func_args )? if (stream_func_args.HasNext) { DebugLocation(594, 120); adaptor.AddChild(root_1, stream_func_args.NextTree()); } stream_func_args.Reset(); DebugLocation(594, 131); // SugarCpp.g:594:131: ( lambda_type )? if (stream_lambda_type.HasNext) { DebugLocation(594, 131); adaptor.AddChild(root_1, stream_lambda_type.NextTree()); } stream_lambda_type.Reset(); DebugLocation(594, 144); adaptor.AddChild(root_1, stream_lambda_value.NextTree()); adaptor.AddChild(root_0, root_1); } } retval.Tree = root_0; } } } break; case 2: DebugEnterAlt(2); // SugarCpp.g:595:4: modify_expr { root_0 = (CommonTree)adaptor.Nil(); DebugLocation(595, 4); PushFollow(Follow._modify_expr_in_lambda_expr6486); modify_expr732=modify_expr(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) adaptor.AddChild(root_0, modify_expr732.Tree); } break; } retval.Stop = (IToken)input.LT(-1); if (state.backtracking == 0) { retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0); adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop); } } catch (RecognitionException re) { ReportError(re); Recover(input,re); retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re); } finally { TraceOut("lambda_expr", 69); LeaveRule("lambda_expr", 69); LeaveRule_lambda_expr(); } DebugLocation(596, 1); } finally { DebugExitRule(GrammarFileName, "lambda_expr"); } return retval; }
private AstParserRuleReturnScope<CommonTree, IToken> list_expr() { EnterRule_list_expr(); EnterRule("list_expr", 65); TraceIn("list_expr", 65); AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>(); retval.Start = (IToken)input.LT(1); CommonTree root_0 = default(CommonTree); IToken char_literal674 = default(IToken); IToken WS675 = default(IToken); IToken WS677 = default(IToken); IToken string_literal678 = default(IToken); IToken WS679 = default(IToken); IToken WS681 = default(IToken); IToken char_literal682 = default(IToken); IToken WS683 = default(IToken); IToken WS685 = default(IToken); IToken char_literal686 = default(IToken); IToken WS687 = default(IToken); IToken char_literal688 = default(IToken); IToken WS689 = default(IToken); IToken char_literal691 = default(IToken); IToken WS692 = default(IToken); IToken char_literal693 = default(IToken); IToken NEWLINE694 = default(IToken); IToken INDENT695 = default(IToken); IToken DEDENT696 = default(IToken); IToken WS698 = default(IToken); IToken char_literal699 = default(IToken); IToken NEWLINE700 = default(IToken); IToken INDENT701 = default(IToken); IToken DEDENT702 = default(IToken); IToken WS703 = default(IToken); IToken WS705 = default(IToken); IToken char_literal706 = default(IToken); IToken NEWLINE707 = default(IToken); IToken INDENT708 = default(IToken); IToken DEDENT709 = default(IToken); IToken char_literal710 = default(IToken); AstParserRuleReturnScope<CommonTree, IToken> feed_expr676 = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> for_item680 = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> for_item684 = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> type_name690 = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> feed_expr697 = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> feed_expr704 = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> lambda_expr711 = default(AstParserRuleReturnScope<CommonTree, IToken>); CommonTree char_literal674_tree = default(CommonTree); CommonTree WS675_tree = default(CommonTree); CommonTree WS677_tree = default(CommonTree); CommonTree string_literal678_tree = default(CommonTree); CommonTree WS679_tree = default(CommonTree); CommonTree WS681_tree = default(CommonTree); CommonTree char_literal682_tree = default(CommonTree); CommonTree WS683_tree = default(CommonTree); CommonTree WS685_tree = default(CommonTree); CommonTree char_literal686_tree = default(CommonTree); CommonTree WS687_tree = default(CommonTree); CommonTree char_literal688_tree = default(CommonTree); CommonTree WS689_tree = default(CommonTree); CommonTree char_literal691_tree = default(CommonTree); CommonTree WS692_tree = default(CommonTree); CommonTree char_literal693_tree = default(CommonTree); CommonTree NEWLINE694_tree = default(CommonTree); CommonTree INDENT695_tree = default(CommonTree); CommonTree DEDENT696_tree = default(CommonTree); CommonTree WS698_tree = default(CommonTree); CommonTree char_literal699_tree = default(CommonTree); CommonTree NEWLINE700_tree = default(CommonTree); CommonTree INDENT701_tree = default(CommonTree); CommonTree DEDENT702_tree = default(CommonTree); CommonTree WS703_tree = default(CommonTree); CommonTree WS705_tree = default(CommonTree); CommonTree char_literal706_tree = default(CommonTree); CommonTree NEWLINE707_tree = default(CommonTree); CommonTree INDENT708_tree = default(CommonTree); CommonTree DEDENT709_tree = default(CommonTree); CommonTree char_literal710_tree = default(CommonTree); RewriteRuleITokenStream stream_132=new RewriteRuleITokenStream(adaptor,"token 132"); RewriteRuleITokenStream stream_133=new RewriteRuleITokenStream(adaptor,"token 133"); RewriteRuleITokenStream stream_DEDENT=new RewriteRuleITokenStream(adaptor,"token DEDENT"); RewriteRuleITokenStream stream_WS=new RewriteRuleITokenStream(adaptor,"token WS"); RewriteRuleITokenStream stream_NEWLINE=new RewriteRuleITokenStream(adaptor,"token NEWLINE"); RewriteRuleITokenStream stream_149=new RewriteRuleITokenStream(adaptor,"token 149"); RewriteRuleITokenStream stream_111=new RewriteRuleITokenStream(adaptor,"token 111"); RewriteRuleITokenStream stream_INDENT=new RewriteRuleITokenStream(adaptor,"token INDENT"); RewriteRuleITokenStream stream_100=new RewriteRuleITokenStream(adaptor,"token 100"); RewriteRuleSubtreeStream stream_feed_expr=new RewriteRuleSubtreeStream(adaptor,"rule feed_expr"); RewriteRuleSubtreeStream stream_type_name=new RewriteRuleSubtreeStream(adaptor,"rule type_name"); RewriteRuleSubtreeStream stream_for_item=new RewriteRuleSubtreeStream(adaptor,"rule for_item"); try { DebugEnterRule(GrammarFileName, "list_expr"); DebugLocation(577, 1); try { // SugarCpp.g:578:2: ( ( '[' ( WS )* feed_expr ( WS )* 'for' )=> '[' ( WS )* feed_expr ( WS )* 'for' ( WS )* for_item ( ( WS )* ',' ( WS )* for_item )* ( WS )* ']' ( WS )* ':' ( WS )* type_name -> ^( Expr_List_Generation ( type_name )? ^( Stmt_For ( for_item )* ^( Stmt_Block ) ) feed_expr ) | '[' ( ( WS | ',' | NEWLINE | INDENT | DEDENT )* feed_expr ( ( WS )* ( ',' | NEWLINE | INDENT | DEDENT )+ ( WS )* feed_expr )* )? ( WS | ',' | NEWLINE | INDENT | DEDENT )* ']' -> ^( Expr_List ( feed_expr )* ) | lambda_expr ) int alt453=3; try { DebugEnterDecision(453, false); int LA453_0 = input.LA(1); if ((LA453_0==132)) { int LA453_1 = input.LA(2); if ((EvaluatePredicate(synpred2_SugarCpp_fragment))) { alt453 = 1; } else if ((true)) { alt453 = 2; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 453, 1, input); DebugRecognitionException(nvae); throw nvae; } } else if ((LA453_0==IDENT||LA453_0==NUMBER||LA453_0==STRING||LA453_0==86||LA453_0==91||LA453_0==93||LA453_0==95||(LA453_0>=97 && LA453_0<=98)||(LA453_0>=101 && LA453_0<=102)||LA453_0==131||(LA453_0>=160 && LA453_0<=161)||LA453_0==186)) { alt453 = 3; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 453, 0, input); DebugRecognitionException(nvae); throw nvae; } } finally { DebugExitDecision(453); } switch (alt453) { case 1: DebugEnterAlt(1); // SugarCpp.g:578:4: ( '[' ( WS )* feed_expr ( WS )* 'for' )=> '[' ( WS )* feed_expr ( WS )* 'for' ( WS )* for_item ( ( WS )* ',' ( WS )* for_item )* ( WS )* ']' ( WS )* ':' ( WS )* type_name { DebugLocation(578, 37); char_literal674=(IToken)Match(input,132,Follow._132_in_list_expr6181); if (state.failed) return retval; if (state.backtracking == 0) stream_132.Add(char_literal674); DebugLocation(578, 41); // SugarCpp.g:578:41: ( WS )* try { DebugEnterSubRule(437); while (true) { int alt437=2; try { DebugEnterDecision(437, false); int LA437_0 = input.LA(1); if ((LA437_0==WS)) { alt437 = 1; } } finally { DebugExitDecision(437); } switch ( alt437 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:578:41: WS { DebugLocation(578, 41); WS675=(IToken)Match(input,WS,Follow._WS_in_list_expr6183); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS675); } break; default: goto loop437; } } loop437: ; } finally { DebugExitSubRule(437); } DebugLocation(578, 45); PushFollow(Follow._feed_expr_in_list_expr6186); feed_expr676=feed_expr(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_feed_expr.Add(feed_expr676.Tree); DebugLocation(578, 55); // SugarCpp.g:578:55: ( WS )* try { DebugEnterSubRule(438); while (true) { int alt438=2; try { DebugEnterDecision(438, false); int LA438_0 = input.LA(1); if ((LA438_0==WS)) { alt438 = 1; } } finally { DebugExitDecision(438); } switch ( alt438 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:578:55: WS { DebugLocation(578, 55); WS677=(IToken)Match(input,WS,Follow._WS_in_list_expr6188); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS677); } break; default: goto loop438; } } loop438: ; } finally { DebugExitSubRule(438); } DebugLocation(578, 59); string_literal678=(IToken)Match(input,149,Follow._149_in_list_expr6191); if (state.failed) return retval; if (state.backtracking == 0) stream_149.Add(string_literal678); DebugLocation(578, 65); // SugarCpp.g:578:65: ( WS )* try { DebugEnterSubRule(439); while (true) { int alt439=2; try { DebugEnterDecision(439, false); int LA439_0 = input.LA(1); if ((LA439_0==WS)) { alt439 = 1; } } finally { DebugExitDecision(439); } switch ( alt439 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:578:65: WS { DebugLocation(578, 65); WS679=(IToken)Match(input,WS,Follow._WS_in_list_expr6193); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS679); } break; default: goto loop439; } } loop439: ; } finally { DebugExitSubRule(439); } DebugLocation(578, 69); PushFollow(Follow._for_item_in_list_expr6196); for_item680=for_item(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_for_item.Add(for_item680.Tree); DebugLocation(578, 78); // SugarCpp.g:578:78: ( ( WS )* ',' ( WS )* for_item )* try { DebugEnterSubRule(442); while (true) { int alt442=2; try { DebugEnterDecision(442, false); try { alt442 = dfa442.Predict(input); } catch (NoViableAltException nvae) { DebugRecognitionException(nvae); throw; } } finally { DebugExitDecision(442); } switch ( alt442 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:578:79: ( WS )* ',' ( WS )* for_item { DebugLocation(578, 79); // SugarCpp.g:578:79: ( WS )* try { DebugEnterSubRule(440); while (true) { int alt440=2; try { DebugEnterDecision(440, false); int LA440_0 = input.LA(1); if ((LA440_0==WS)) { alt440 = 1; } } finally { DebugExitDecision(440); } switch ( alt440 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:578:79: WS { DebugLocation(578, 79); WS681=(IToken)Match(input,WS,Follow._WS_in_list_expr6199); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS681); } break; default: goto loop440; } } loop440: ; } finally { DebugExitSubRule(440); } DebugLocation(578, 83); char_literal682=(IToken)Match(input,100,Follow._100_in_list_expr6202); if (state.failed) return retval; if (state.backtracking == 0) stream_100.Add(char_literal682); DebugLocation(578, 87); // SugarCpp.g:578:87: ( WS )* try { DebugEnterSubRule(441); while (true) { int alt441=2; try { DebugEnterDecision(441, false); int LA441_0 = input.LA(1); if ((LA441_0==WS)) { alt441 = 1; } } finally { DebugExitDecision(441); } switch ( alt441 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:578:87: WS { DebugLocation(578, 87); WS683=(IToken)Match(input,WS,Follow._WS_in_list_expr6204); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS683); } break; default: goto loop441; } } loop441: ; } finally { DebugExitSubRule(441); } DebugLocation(578, 91); PushFollow(Follow._for_item_in_list_expr6207); for_item684=for_item(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_for_item.Add(for_item684.Tree); } break; default: goto loop442; } } loop442: ; } finally { DebugExitSubRule(442); } DebugLocation(578, 102); // SugarCpp.g:578:102: ( WS )* try { DebugEnterSubRule(443); while (true) { int alt443=2; try { DebugEnterDecision(443, false); int LA443_0 = input.LA(1); if ((LA443_0==WS)) { alt443 = 1; } } finally { DebugExitDecision(443); } switch ( alt443 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:578:102: WS { DebugLocation(578, 102); WS685=(IToken)Match(input,WS,Follow._WS_in_list_expr6211); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS685); } break; default: goto loop443; } } loop443: ; } finally { DebugExitSubRule(443); } DebugLocation(578, 106); char_literal686=(IToken)Match(input,133,Follow._133_in_list_expr6214); if (state.failed) return retval; if (state.backtracking == 0) stream_133.Add(char_literal686); DebugLocation(578, 110); // SugarCpp.g:578:110: ( WS )* try { DebugEnterSubRule(444); while (true) { int alt444=2; try { DebugEnterDecision(444, false); int LA444_0 = input.LA(1); if ((LA444_0==WS)) { alt444 = 1; } } finally { DebugExitDecision(444); } switch ( alt444 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:578:110: WS { DebugLocation(578, 110); WS687=(IToken)Match(input,WS,Follow._WS_in_list_expr6216); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS687); } break; default: goto loop444; } } loop444: ; } finally { DebugExitSubRule(444); } DebugLocation(578, 114); char_literal688=(IToken)Match(input,111,Follow._111_in_list_expr6219); if (state.failed) return retval; if (state.backtracking == 0) stream_111.Add(char_literal688); DebugLocation(578, 118); // SugarCpp.g:578:118: ( WS )* try { DebugEnterSubRule(445); while (true) { int alt445=2; try { DebugEnterDecision(445, false); int LA445_0 = input.LA(1); if ((LA445_0==WS)) { alt445 = 1; } } finally { DebugExitDecision(445); } switch ( alt445 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:578:118: WS { DebugLocation(578, 118); WS689=(IToken)Match(input,WS,Follow._WS_in_list_expr6221); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS689); } break; default: goto loop445; } } loop445: ; } finally { DebugExitSubRule(445); } DebugLocation(578, 122); PushFollow(Follow._type_name_in_list_expr6224); type_name690=type_name(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_type_name.Add(type_name690.Tree); { // AST REWRITE // elements: for_item, feed_expr, type_name // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: if (state.backtracking == 0) { retval.Tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null); root_0 = (CommonTree)adaptor.Nil(); // 578:133: -> ^( Expr_List_Generation ( type_name )? ^( Stmt_For ( for_item )* ^( Stmt_Block ) ) feed_expr ) { DebugLocation(578, 136); // SugarCpp.g:578:136: ^( Expr_List_Generation ( type_name )? ^( Stmt_For ( for_item )* ^( Stmt_Block ) ) feed_expr ) { CommonTree root_1 = (CommonTree)adaptor.Nil(); DebugLocation(578, 138); root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(Expr_List_Generation, "Expr_List_Generation"), root_1); DebugLocation(578, 159); // SugarCpp.g:578:159: ( type_name )? if (stream_type_name.HasNext) { DebugLocation(578, 159); adaptor.AddChild(root_1, stream_type_name.NextTree()); } stream_type_name.Reset(); DebugLocation(578, 170); // SugarCpp.g:578:170: ^( Stmt_For ( for_item )* ^( Stmt_Block ) ) { CommonTree root_2 = (CommonTree)adaptor.Nil(); DebugLocation(578, 172); root_2 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(Stmt_For, "Stmt_For"), root_2); DebugLocation(578, 181); // SugarCpp.g:578:181: ( for_item )* while ( stream_for_item.HasNext ) { DebugLocation(578, 181); adaptor.AddChild(root_2, stream_for_item.NextTree()); } stream_for_item.Reset(); DebugLocation(578, 191); // SugarCpp.g:578:191: ^( Stmt_Block ) { CommonTree root_3 = (CommonTree)adaptor.Nil(); DebugLocation(578, 193); root_3 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(Stmt_Block, "Stmt_Block"), root_3); adaptor.AddChild(root_2, root_3); } adaptor.AddChild(root_1, root_2); } DebugLocation(578, 206); adaptor.AddChild(root_1, stream_feed_expr.NextTree()); adaptor.AddChild(root_0, root_1); } } retval.Tree = root_0; } } } break; case 2: DebugEnterAlt(2); // SugarCpp.g:579:4: '[' ( ( WS | ',' | NEWLINE | INDENT | DEDENT )* feed_expr ( ( WS )* ( ',' | NEWLINE | INDENT | DEDENT )+ ( WS )* feed_expr )* )? ( WS | ',' | NEWLINE | INDENT | DEDENT )* ']' { DebugLocation(579, 4); char_literal691=(IToken)Match(input,132,Follow._132_in_list_expr6252); if (state.failed) return retval; if (state.backtracking == 0) stream_132.Add(char_literal691); DebugLocation(579, 8); // SugarCpp.g:579:8: ( ( WS | ',' | NEWLINE | INDENT | DEDENT )* feed_expr ( ( WS )* ( ',' | NEWLINE | INDENT | DEDENT )+ ( WS )* feed_expr )* )? int alt451=2; try { DebugEnterSubRule(451); try { DebugEnterDecision(451, false); try { alt451 = dfa451.Predict(input); } catch (NoViableAltException nvae) { DebugRecognitionException(nvae); throw; } } finally { DebugExitDecision(451); } switch (alt451) { case 1: DebugEnterAlt(1); // SugarCpp.g:579:9: ( WS | ',' | NEWLINE | INDENT | DEDENT )* feed_expr ( ( WS )* ( ',' | NEWLINE | INDENT | DEDENT )+ ( WS )* feed_expr )* { DebugLocation(579, 9); // SugarCpp.g:579:9: ( WS | ',' | NEWLINE | INDENT | DEDENT )* try { DebugEnterSubRule(446); while (true) { int alt446=6; try { DebugEnterDecision(446, false); switch (input.LA(1)) { case WS: { alt446 = 1; } break; case 100: { alt446 = 2; } break; case NEWLINE: { alt446 = 3; } break; case INDENT: { alt446 = 4; } break; case DEDENT: { alt446 = 5; } break; } } finally { DebugExitDecision(446); } switch ( alt446 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:579:10: WS { DebugLocation(579, 10); WS692=(IToken)Match(input,WS,Follow._WS_in_list_expr6256); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS692); } break; case 2: DebugEnterAlt(2); // SugarCpp.g:579:15: ',' { DebugLocation(579, 15); char_literal693=(IToken)Match(input,100,Follow._100_in_list_expr6260); if (state.failed) return retval; if (state.backtracking == 0) stream_100.Add(char_literal693); } break; case 3: DebugEnterAlt(3); // SugarCpp.g:579:21: NEWLINE { DebugLocation(579, 21); NEWLINE694=(IToken)Match(input,NEWLINE,Follow._NEWLINE_in_list_expr6264); if (state.failed) return retval; if (state.backtracking == 0) stream_NEWLINE.Add(NEWLINE694); } break; case 4: DebugEnterAlt(4); // SugarCpp.g:579:31: INDENT { DebugLocation(579, 31); INDENT695=(IToken)Match(input,INDENT,Follow._INDENT_in_list_expr6268); if (state.failed) return retval; if (state.backtracking == 0) stream_INDENT.Add(INDENT695); } break; case 5: DebugEnterAlt(5); // SugarCpp.g:579:40: DEDENT { DebugLocation(579, 40); DEDENT696=(IToken)Match(input,DEDENT,Follow._DEDENT_in_list_expr6272); if (state.failed) return retval; if (state.backtracking == 0) stream_DEDENT.Add(DEDENT696); } break; default: goto loop446; } } loop446: ; } finally { DebugExitSubRule(446); } DebugLocation(579, 49); PushFollow(Follow._feed_expr_in_list_expr6276); feed_expr697=feed_expr(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_feed_expr.Add(feed_expr697.Tree); DebugLocation(579, 59); // SugarCpp.g:579:59: ( ( WS )* ( ',' | NEWLINE | INDENT | DEDENT )+ ( WS )* feed_expr )* try { DebugEnterSubRule(450); while (true) { int alt450=2; try { DebugEnterDecision(450, false); try { alt450 = dfa450.Predict(input); } catch (NoViableAltException nvae) { DebugRecognitionException(nvae); throw; } } finally { DebugExitDecision(450); } switch ( alt450 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:579:60: ( WS )* ( ',' | NEWLINE | INDENT | DEDENT )+ ( WS )* feed_expr { DebugLocation(579, 60); // SugarCpp.g:579:60: ( WS )* try { DebugEnterSubRule(447); while (true) { int alt447=2; try { DebugEnterDecision(447, false); int LA447_0 = input.LA(1); if ((LA447_0==WS)) { alt447 = 1; } } finally { DebugExitDecision(447); } switch ( alt447 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:579:60: WS { DebugLocation(579, 60); WS698=(IToken)Match(input,WS,Follow._WS_in_list_expr6279); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS698); } break; default: goto loop447; } } loop447: ; } finally { DebugExitSubRule(447); } DebugLocation(579, 64); // SugarCpp.g:579:64: ( ',' | NEWLINE | INDENT | DEDENT )+ int cnt448=0; try { DebugEnterSubRule(448); while (true) { int alt448=5; try { DebugEnterDecision(448, false); switch (input.LA(1)) { case 100: { alt448 = 1; } break; case NEWLINE: { alt448 = 2; } break; case INDENT: { alt448 = 3; } break; case DEDENT: { alt448 = 4; } break; } } finally { DebugExitDecision(448); } switch (alt448) { case 1: DebugEnterAlt(1); // SugarCpp.g:579:65: ',' { DebugLocation(579, 65); char_literal699=(IToken)Match(input,100,Follow._100_in_list_expr6283); if (state.failed) return retval; if (state.backtracking == 0) stream_100.Add(char_literal699); } break; case 2: DebugEnterAlt(2); // SugarCpp.g:579:71: NEWLINE { DebugLocation(579, 71); NEWLINE700=(IToken)Match(input,NEWLINE,Follow._NEWLINE_in_list_expr6287); if (state.failed) return retval; if (state.backtracking == 0) stream_NEWLINE.Add(NEWLINE700); } break; case 3: DebugEnterAlt(3); // SugarCpp.g:579:81: INDENT { DebugLocation(579, 81); INDENT701=(IToken)Match(input,INDENT,Follow._INDENT_in_list_expr6291); if (state.failed) return retval; if (state.backtracking == 0) stream_INDENT.Add(INDENT701); } break; case 4: DebugEnterAlt(4); // SugarCpp.g:579:90: DEDENT { DebugLocation(579, 90); DEDENT702=(IToken)Match(input,DEDENT,Follow._DEDENT_in_list_expr6295); if (state.failed) return retval; if (state.backtracking == 0) stream_DEDENT.Add(DEDENT702); } break; default: if (cnt448 >= 1) goto loop448; if (state.backtracking>0) {state.failed=true; return retval;} EarlyExitException eee448 = new EarlyExitException( 448, input ); DebugRecognitionException(eee448); throw eee448; } cnt448++; } loop448: ; } finally { DebugExitSubRule(448); } DebugLocation(579, 99); // SugarCpp.g:579:99: ( WS )* try { DebugEnterSubRule(449); while (true) { int alt449=2; try { DebugEnterDecision(449, false); int LA449_0 = input.LA(1); if ((LA449_0==WS)) { alt449 = 1; } } finally { DebugExitDecision(449); } switch ( alt449 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:579:99: WS { DebugLocation(579, 99); WS703=(IToken)Match(input,WS,Follow._WS_in_list_expr6299); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS703); } break; default: goto loop449; } } loop449: ; } finally { DebugExitSubRule(449); } DebugLocation(579, 103); PushFollow(Follow._feed_expr_in_list_expr6302); feed_expr704=feed_expr(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_feed_expr.Add(feed_expr704.Tree); } break; default: goto loop450; } } loop450: ; } finally { DebugExitSubRule(450); } } break; } } finally { DebugExitSubRule(451); } DebugLocation(579, 117); // SugarCpp.g:579:117: ( WS | ',' | NEWLINE | INDENT | DEDENT )* try { DebugEnterSubRule(452); while (true) { int alt452=6; try { DebugEnterDecision(452, false); switch (input.LA(1)) { case WS: { alt452 = 1; } break; case 100: { alt452 = 2; } break; case NEWLINE: { alt452 = 3; } break; case INDENT: { alt452 = 4; } break; case DEDENT: { alt452 = 5; } break; } } finally { DebugExitDecision(452); } switch ( alt452 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:579:118: WS { DebugLocation(579, 118); WS705=(IToken)Match(input,WS,Follow._WS_in_list_expr6309); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS705); } break; case 2: DebugEnterAlt(2); // SugarCpp.g:579:123: ',' { DebugLocation(579, 123); char_literal706=(IToken)Match(input,100,Follow._100_in_list_expr6313); if (state.failed) return retval; if (state.backtracking == 0) stream_100.Add(char_literal706); } break; case 3: DebugEnterAlt(3); // SugarCpp.g:579:129: NEWLINE { DebugLocation(579, 129); NEWLINE707=(IToken)Match(input,NEWLINE,Follow._NEWLINE_in_list_expr6317); if (state.failed) return retval; if (state.backtracking == 0) stream_NEWLINE.Add(NEWLINE707); } break; case 4: DebugEnterAlt(4); // SugarCpp.g:579:139: INDENT { DebugLocation(579, 139); INDENT708=(IToken)Match(input,INDENT,Follow._INDENT_in_list_expr6321); if (state.failed) return retval; if (state.backtracking == 0) stream_INDENT.Add(INDENT708); } break; case 5: DebugEnterAlt(5); // SugarCpp.g:579:148: DEDENT { DebugLocation(579, 148); DEDENT709=(IToken)Match(input,DEDENT,Follow._DEDENT_in_list_expr6325); if (state.failed) return retval; if (state.backtracking == 0) stream_DEDENT.Add(DEDENT709); } break; default: goto loop452; } } loop452: ; } finally { DebugExitSubRule(452); } DebugLocation(579, 157); char_literal710=(IToken)Match(input,133,Follow._133_in_list_expr6329); if (state.failed) return retval; if (state.backtracking == 0) stream_133.Add(char_literal710); { // AST REWRITE // elements: feed_expr // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: if (state.backtracking == 0) { retval.Tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null); root_0 = (CommonTree)adaptor.Nil(); // 579:161: -> ^( Expr_List ( feed_expr )* ) { DebugLocation(579, 164); // SugarCpp.g:579:164: ^( Expr_List ( feed_expr )* ) { CommonTree root_1 = (CommonTree)adaptor.Nil(); DebugLocation(579, 166); root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(Expr_List, "Expr_List"), root_1); DebugLocation(579, 176); // SugarCpp.g:579:176: ( feed_expr )* while ( stream_feed_expr.HasNext ) { DebugLocation(579, 176); adaptor.AddChild(root_1, stream_feed_expr.NextTree()); } stream_feed_expr.Reset(); adaptor.AddChild(root_0, root_1); } } retval.Tree = root_0; } } } break; case 3: DebugEnterAlt(3); // SugarCpp.g:580:4: lambda_expr { root_0 = (CommonTree)adaptor.Nil(); DebugLocation(580, 4); PushFollow(Follow._lambda_expr_in_list_expr6343); lambda_expr711=lambda_expr(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) adaptor.AddChild(root_0, lambda_expr711.Tree); } break; } retval.Stop = (IToken)input.LT(-1); if (state.backtracking == 0) { retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0); adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop); } } catch (RecognitionException re) { ReportError(re); Recover(input,re); retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re); } finally { TraceOut("list_expr", 65); LeaveRule("list_expr", 65); LeaveRule_list_expr(); } DebugLocation(581, 1); } finally { DebugExitRule(GrammarFileName, "list_expr"); } return retval; }
private AstParserRuleReturnScope<CommonTree, IToken> type_name() { EnterRule_type_name(); EnterRule("type_name", 17); TraceIn("type_name", 17); AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>(); retval.Start = (IToken)input.LT(1); CommonTree root_0 = default(CommonTree); IToken WS178 = default(IToken); IToken string_literal179 = default(IToken); IToken WS180 = default(IToken); IToken char_literal182 = default(IToken); IToken WS183 = default(IToken); IToken char_literal184 = default(IToken); IToken char_literal185 = default(IToken); IToken WS186 = default(IToken); IToken WS188 = default(IToken); IToken char_literal189 = default(IToken); IToken WS190 = default(IToken); IToken string_literal191 = default(IToken); IToken WS192 = default(IToken); IToken char_literal194 = default(IToken); IToken WS195 = default(IToken); IToken char_literal196 = default(IToken); AstParserRuleReturnScope<CommonTree, IToken> type_single177 = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> type_name181 = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> type_list187 = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> type_name193 = default(AstParserRuleReturnScope<CommonTree, IToken>); CommonTree WS178_tree = default(CommonTree); CommonTree string_literal179_tree = default(CommonTree); CommonTree WS180_tree = default(CommonTree); CommonTree char_literal182_tree = default(CommonTree); CommonTree WS183_tree = default(CommonTree); CommonTree char_literal184_tree = default(CommonTree); CommonTree char_literal185_tree = default(CommonTree); CommonTree WS186_tree = default(CommonTree); CommonTree WS188_tree = default(CommonTree); CommonTree char_literal189_tree = default(CommonTree); CommonTree WS190_tree = default(CommonTree); CommonTree string_literal191_tree = default(CommonTree); CommonTree WS192_tree = default(CommonTree); CommonTree char_literal194_tree = default(CommonTree); CommonTree WS195_tree = default(CommonTree); CommonTree char_literal196_tree = default(CommonTree); RewriteRuleITokenStream stream_94=new RewriteRuleITokenStream(adaptor,"token 94"); RewriteRuleITokenStream stream_WS=new RewriteRuleITokenStream(adaptor,"token WS"); RewriteRuleITokenStream stream_93=new RewriteRuleITokenStream(adaptor,"token 93"); RewriteRuleITokenStream stream_105=new RewriteRuleITokenStream(adaptor,"token 105"); RewriteRuleSubtreeStream stream_type_name=new RewriteRuleSubtreeStream(adaptor,"rule type_name"); RewriteRuleSubtreeStream stream_type_list=new RewriteRuleSubtreeStream(adaptor,"rule type_list"); RewriteRuleSubtreeStream stream_type_single=new RewriteRuleSubtreeStream(adaptor,"rule type_single"); try { DebugEnterRule(GrammarFileName, "type_name"); DebugLocation(300, 1); try { // SugarCpp.g:301:2: ( type_single ( ( WS )* '->' ( WS )* ( type_name | '(' ( WS )* ')' ) -> ^( Type_Func ^( Type_List type_single ) ( type_name )? ) | -> type_single ) | '(' ( ( WS )* type_list )? ( WS )* ')' ( WS )* '->' ( WS )* ( type_name | '(' ( WS )* ')' ) -> ^( Type_Func ( type_list )? ( type_name )? ) ) int alt128=2; try { DebugEnterDecision(128, false); int LA128_0 = input.LA(1); if ((LA128_0==IDENT||LA128_0==142||LA128_0==156||(LA128_0>=166 && LA128_0<=167)||LA128_0==170)) { alt128 = 1; } else if ((LA128_0==93)) { alt128 = 2; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 128, 0, input); DebugRecognitionException(nvae); throw nvae; } } finally { DebugExitDecision(128); } switch (alt128) { case 1: DebugEnterAlt(1); // SugarCpp.g:301:4: type_single ( ( WS )* '->' ( WS )* ( type_name | '(' ( WS )* ')' ) -> ^( Type_Func ^( Type_List type_single ) ( type_name )? ) | -> type_single ) { DebugLocation(301, 4); PushFollow(Follow._type_single_in_type_name1777); type_single177=type_single(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_type_single.Add(type_single177.Tree); DebugLocation(301, 16); // SugarCpp.g:301:16: ( ( WS )* '->' ( WS )* ( type_name | '(' ( WS )* ')' ) -> ^( Type_Func ^( Type_List type_single ) ( type_name )? ) | -> type_single ) int alt120=2; try { DebugEnterSubRule(120); try { DebugEnterDecision(120, false); try { alt120 = dfa120.Predict(input); } catch (NoViableAltException nvae) { DebugRecognitionException(nvae); throw; } } finally { DebugExitDecision(120); } switch (alt120) { case 1: DebugEnterAlt(1); // SugarCpp.g:301:18: ( WS )* '->' ( WS )* ( type_name | '(' ( WS )* ')' ) { DebugLocation(301, 18); // SugarCpp.g:301:18: ( WS )* try { DebugEnterSubRule(116); while (true) { int alt116=2; try { DebugEnterDecision(116, false); int LA116_0 = input.LA(1); if ((LA116_0==WS)) { alt116 = 1; } } finally { DebugExitDecision(116); } switch ( alt116 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:301:18: WS { DebugLocation(301, 18); WS178=(IToken)Match(input,WS,Follow._WS_in_type_name1781); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS178); } break; default: goto loop116; } } loop116: ; } finally { DebugExitSubRule(116); } DebugLocation(301, 22); string_literal179=(IToken)Match(input,105,Follow._105_in_type_name1784); if (state.failed) return retval; if (state.backtracking == 0) stream_105.Add(string_literal179); DebugLocation(301, 27); // SugarCpp.g:301:27: ( WS )* try { DebugEnterSubRule(117); while (true) { int alt117=2; try { DebugEnterDecision(117, false); int LA117_0 = input.LA(1); if ((LA117_0==WS)) { alt117 = 1; } } finally { DebugExitDecision(117); } switch ( alt117 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:301:27: WS { DebugLocation(301, 27); WS180=(IToken)Match(input,WS,Follow._WS_in_type_name1786); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS180); } break; default: goto loop117; } } loop117: ; } finally { DebugExitSubRule(117); } DebugLocation(301, 31); // SugarCpp.g:301:31: ( type_name | '(' ( WS )* ')' ) int alt119=2; try { DebugEnterSubRule(119); try { DebugEnterDecision(119, false); try { alt119 = dfa119.Predict(input); } catch (NoViableAltException nvae) { DebugRecognitionException(nvae); throw; } } finally { DebugExitDecision(119); } switch (alt119) { case 1: DebugEnterAlt(1); // SugarCpp.g:301:32: type_name { DebugLocation(301, 32); PushFollow(Follow._type_name_in_type_name1790); type_name181=type_name(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_type_name.Add(type_name181.Tree); } break; case 2: DebugEnterAlt(2); // SugarCpp.g:301:44: '(' ( WS )* ')' { DebugLocation(301, 44); char_literal182=(IToken)Match(input,93,Follow._93_in_type_name1794); if (state.failed) return retval; if (state.backtracking == 0) stream_93.Add(char_literal182); DebugLocation(301, 48); // SugarCpp.g:301:48: ( WS )* try { DebugEnterSubRule(118); while (true) { int alt118=2; try { DebugEnterDecision(118, false); int LA118_0 = input.LA(1); if ((LA118_0==WS)) { alt118 = 1; } } finally { DebugExitDecision(118); } switch ( alt118 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:301:48: WS { DebugLocation(301, 48); WS183=(IToken)Match(input,WS,Follow._WS_in_type_name1796); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS183); } break; default: goto loop118; } } loop118: ; } finally { DebugExitSubRule(118); } DebugLocation(301, 52); char_literal184=(IToken)Match(input,94,Follow._94_in_type_name1799); if (state.failed) return retval; if (state.backtracking == 0) stream_94.Add(char_literal184); } break; } } finally { DebugExitSubRule(119); } { // AST REWRITE // elements: type_name, type_single // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: if (state.backtracking == 0) { retval.Tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null); root_0 = (CommonTree)adaptor.Nil(); // 301:57: -> ^( Type_Func ^( Type_List type_single ) ( type_name )? ) { DebugLocation(301, 60); // SugarCpp.g:301:60: ^( Type_Func ^( Type_List type_single ) ( type_name )? ) { CommonTree root_1 = (CommonTree)adaptor.Nil(); DebugLocation(301, 62); root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(Type_Func, "Type_Func"), root_1); DebugLocation(301, 72); // SugarCpp.g:301:72: ^( Type_List type_single ) { CommonTree root_2 = (CommonTree)adaptor.Nil(); DebugLocation(301, 74); root_2 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(Type_List, "Type_List"), root_2); DebugLocation(301, 84); adaptor.AddChild(root_2, stream_type_single.NextTree()); adaptor.AddChild(root_1, root_2); } DebugLocation(301, 97); // SugarCpp.g:301:97: ( type_name )? if (stream_type_name.HasNext) { DebugLocation(301, 97); adaptor.AddChild(root_1, stream_type_name.NextTree()); } stream_type_name.Reset(); adaptor.AddChild(root_0, root_1); } } retval.Tree = root_0; } } } break; case 2: DebugEnterAlt(2); // SugarCpp.g:302:9: { { // AST REWRITE // elements: type_single // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: if (state.backtracking == 0) { retval.Tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null); root_0 = (CommonTree)adaptor.Nil(); // 302:9: -> type_single { DebugLocation(302, 12); adaptor.AddChild(root_0, stream_type_single.NextTree()); } retval.Tree = root_0; } } } break; } } finally { DebugExitSubRule(120); } } break; case 2: DebugEnterAlt(2); // SugarCpp.g:304:4: '(' ( ( WS )* type_list )? ( WS )* ')' ( WS )* '->' ( WS )* ( type_name | '(' ( WS )* ')' ) { DebugLocation(304, 4); char_literal185=(IToken)Match(input,93,Follow._93_in_type_name1840); if (state.failed) return retval; if (state.backtracking == 0) stream_93.Add(char_literal185); DebugLocation(304, 8); // SugarCpp.g:304:8: ( ( WS )* type_list )? int alt122=2; try { DebugEnterSubRule(122); try { DebugEnterDecision(122, false); try { alt122 = dfa122.Predict(input); } catch (NoViableAltException nvae) { DebugRecognitionException(nvae); throw; } } finally { DebugExitDecision(122); } switch (alt122) { case 1: DebugEnterAlt(1); // SugarCpp.g:304:9: ( WS )* type_list { DebugLocation(304, 9); // SugarCpp.g:304:9: ( WS )* try { DebugEnterSubRule(121); while (true) { int alt121=2; try { DebugEnterDecision(121, false); int LA121_0 = input.LA(1); if ((LA121_0==WS)) { alt121 = 1; } } finally { DebugExitDecision(121); } switch ( alt121 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:304:9: WS { DebugLocation(304, 9); WS186=(IToken)Match(input,WS,Follow._WS_in_type_name1843); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS186); } break; default: goto loop121; } } loop121: ; } finally { DebugExitSubRule(121); } DebugLocation(304, 13); PushFollow(Follow._type_list_in_type_name1846); type_list187=type_list(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_type_list.Add(type_list187.Tree); } break; } } finally { DebugExitSubRule(122); } DebugLocation(304, 25); // SugarCpp.g:304:25: ( WS )* try { DebugEnterSubRule(123); while (true) { int alt123=2; try { DebugEnterDecision(123, false); int LA123_0 = input.LA(1); if ((LA123_0==WS)) { alt123 = 1; } } finally { DebugExitDecision(123); } switch ( alt123 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:304:25: WS { DebugLocation(304, 25); WS188=(IToken)Match(input,WS,Follow._WS_in_type_name1850); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS188); } break; default: goto loop123; } } loop123: ; } finally { DebugExitSubRule(123); } DebugLocation(304, 29); char_literal189=(IToken)Match(input,94,Follow._94_in_type_name1853); if (state.failed) return retval; if (state.backtracking == 0) stream_94.Add(char_literal189); DebugLocation(304, 33); // SugarCpp.g:304:33: ( WS )* try { DebugEnterSubRule(124); while (true) { int alt124=2; try { DebugEnterDecision(124, false); int LA124_0 = input.LA(1); if ((LA124_0==WS)) { alt124 = 1; } } finally { DebugExitDecision(124); } switch ( alt124 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:304:33: WS { DebugLocation(304, 33); WS190=(IToken)Match(input,WS,Follow._WS_in_type_name1855); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS190); } break; default: goto loop124; } } loop124: ; } finally { DebugExitSubRule(124); } DebugLocation(304, 37); string_literal191=(IToken)Match(input,105,Follow._105_in_type_name1858); if (state.failed) return retval; if (state.backtracking == 0) stream_105.Add(string_literal191); DebugLocation(304, 42); // SugarCpp.g:304:42: ( WS )* try { DebugEnterSubRule(125); while (true) { int alt125=2; try { DebugEnterDecision(125, false); int LA125_0 = input.LA(1); if ((LA125_0==WS)) { alt125 = 1; } } finally { DebugExitDecision(125); } switch ( alt125 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:304:42: WS { DebugLocation(304, 42); WS192=(IToken)Match(input,WS,Follow._WS_in_type_name1860); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS192); } break; default: goto loop125; } } loop125: ; } finally { DebugExitSubRule(125); } DebugLocation(304, 46); // SugarCpp.g:304:46: ( type_name | '(' ( WS )* ')' ) int alt127=2; try { DebugEnterSubRule(127); try { DebugEnterDecision(127, false); try { alt127 = dfa127.Predict(input); } catch (NoViableAltException nvae) { DebugRecognitionException(nvae); throw; } } finally { DebugExitDecision(127); } switch (alt127) { case 1: DebugEnterAlt(1); // SugarCpp.g:304:47: type_name { DebugLocation(304, 47); PushFollow(Follow._type_name_in_type_name1864); type_name193=type_name(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_type_name.Add(type_name193.Tree); } break; case 2: DebugEnterAlt(2); // SugarCpp.g:304:59: '(' ( WS )* ')' { DebugLocation(304, 59); char_literal194=(IToken)Match(input,93,Follow._93_in_type_name1868); if (state.failed) return retval; if (state.backtracking == 0) stream_93.Add(char_literal194); DebugLocation(304, 63); // SugarCpp.g:304:63: ( WS )* try { DebugEnterSubRule(126); while (true) { int alt126=2; try { DebugEnterDecision(126, false); int LA126_0 = input.LA(1); if ((LA126_0==WS)) { alt126 = 1; } } finally { DebugExitDecision(126); } switch ( alt126 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:304:63: WS { DebugLocation(304, 63); WS195=(IToken)Match(input,WS,Follow._WS_in_type_name1870); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS195); } break; default: goto loop126; } } loop126: ; } finally { DebugExitSubRule(126); } DebugLocation(304, 67); char_literal196=(IToken)Match(input,94,Follow._94_in_type_name1873); if (state.failed) return retval; if (state.backtracking == 0) stream_94.Add(char_literal196); } break; } } finally { DebugExitSubRule(127); } { // AST REWRITE // elements: type_name, type_list // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: if (state.backtracking == 0) { retval.Tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null); root_0 = (CommonTree)adaptor.Nil(); // 304:72: -> ^( Type_Func ( type_list )? ( type_name )? ) { DebugLocation(304, 75); // SugarCpp.g:304:75: ^( Type_Func ( type_list )? ( type_name )? ) { CommonTree root_1 = (CommonTree)adaptor.Nil(); DebugLocation(304, 77); root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(Type_Func, "Type_Func"), root_1); DebugLocation(304, 87); // SugarCpp.g:304:87: ( type_list )? if (stream_type_list.HasNext) { DebugLocation(304, 87); adaptor.AddChild(root_1, stream_type_list.NextTree()); } stream_type_list.Reset(); DebugLocation(304, 98); // SugarCpp.g:304:98: ( type_name )? if (stream_type_name.HasNext) { DebugLocation(304, 98); adaptor.AddChild(root_1, stream_type_name.NextTree()); } stream_type_name.Reset(); adaptor.AddChild(root_0, root_1); } } retval.Tree = root_0; } } } break; } retval.Stop = (IToken)input.LT(-1); if (state.backtracking == 0) { retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0); adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop); } } catch (RecognitionException re) { ReportError(re); Recover(input,re); retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re); } finally { TraceOut("type_name", 17); LeaveRule("type_name", 17); LeaveRule_type_name(); } DebugLocation(305, 1); } finally { DebugExitRule(GrammarFileName, "type_name"); } return retval; }
private AstParserRuleReturnScope<CommonTree, IToken> atom_expr() { EnterRule_atom_expr(); EnterRule("atom_expr", 96); TraceIn("atom_expr", 96); AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>(); retval.Start = (IToken)input.LT(1); CommonTree root_0 = default(CommonTree); IToken NUMBER915 = default(IToken); IToken STRING917 = default(IToken); IToken char_literal918 = default(IToken); IToken WS919 = default(IToken); IToken char_literal921 = default(IToken); IToken WS922 = default(IToken); IToken WS923 = default(IToken); IToken char_literal924 = default(IToken); IToken WS925 = default(IToken); IToken WS927 = default(IToken); IToken char_literal928 = default(IToken); IToken WS929 = default(IToken); IToken char_literal930 = default(IToken); AstParserRuleReturnScope<CommonTree, IToken> a = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> ident916 = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> ident920 = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> expr926 = default(AstParserRuleReturnScope<CommonTree, IToken>); CommonTree NUMBER915_tree = default(CommonTree); CommonTree STRING917_tree = default(CommonTree); CommonTree char_literal918_tree = default(CommonTree); CommonTree WS919_tree = default(CommonTree); CommonTree char_literal921_tree = default(CommonTree); CommonTree WS922_tree = default(CommonTree); CommonTree WS923_tree = default(CommonTree); CommonTree char_literal924_tree = default(CommonTree); CommonTree WS925_tree = default(CommonTree); CommonTree WS927_tree = default(CommonTree); CommonTree char_literal928_tree = default(CommonTree); CommonTree WS929_tree = default(CommonTree); CommonTree char_literal930_tree = default(CommonTree); RewriteRuleITokenStream stream_94=new RewriteRuleITokenStream(adaptor,"token 94"); RewriteRuleITokenStream stream_WS=new RewriteRuleITokenStream(adaptor,"token WS"); RewriteRuleITokenStream stream_93=new RewriteRuleITokenStream(adaptor,"token 93"); RewriteRuleITokenStream stream_131=new RewriteRuleITokenStream(adaptor,"token 131"); RewriteRuleITokenStream stream_100=new RewriteRuleITokenStream(adaptor,"token 100"); RewriteRuleSubtreeStream stream_ident=new RewriteRuleSubtreeStream(adaptor,"rule ident"); RewriteRuleSubtreeStream stream_expr=new RewriteRuleSubtreeStream(adaptor,"rule expr"); try { DebugEnterRule(GrammarFileName, "atom_expr"); DebugLocation(724, 1); try { // SugarCpp.g:725:2: ( NUMBER | ident | STRING | '@' ( WS )* ident -> ^( '@' ident ) | '(' ( WS )* a= expr ( ( ( WS )* ',' ( WS )* expr )+ ( WS )* ')' -> ^( Expr_Tuple ( expr )+ ) | ( WS )* ')' -> ^( Expr_Bracket expr ) ) ) int alt605=5; try { DebugEnterDecision(605, false); switch (input.LA(1)) { case NUMBER: { alt605 = 1; } break; case IDENT: { alt605 = 2; } break; case STRING: { alt605 = 3; } break; case 131: { alt605 = 4; } break; case 93: { alt605 = 5; } break; default: { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 605, 0, input); DebugRecognitionException(nvae); throw nvae; } } } finally { DebugExitDecision(605); } switch (alt605) { case 1: DebugEnterAlt(1); // SugarCpp.g:725:4: NUMBER { root_0 = (CommonTree)adaptor.Nil(); DebugLocation(725, 4); NUMBER915=(IToken)Match(input,NUMBER,Follow._NUMBER_in_atom_expr8741); if (state.failed) return retval; if (state.backtracking == 0) { NUMBER915_tree = (CommonTree)adaptor.Create(NUMBER915); adaptor.AddChild(root_0, NUMBER915_tree); } } break; case 2: DebugEnterAlt(2); // SugarCpp.g:726:4: ident { root_0 = (CommonTree)adaptor.Nil(); DebugLocation(726, 4); PushFollow(Follow._ident_in_atom_expr8746); ident916=ident(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) adaptor.AddChild(root_0, ident916.Tree); } break; case 3: DebugEnterAlt(3); // SugarCpp.g:727:4: STRING { root_0 = (CommonTree)adaptor.Nil(); DebugLocation(727, 4); STRING917=(IToken)Match(input,STRING,Follow._STRING_in_atom_expr8751); if (state.failed) return retval; if (state.backtracking == 0) { STRING917_tree = (CommonTree)adaptor.Create(STRING917); adaptor.AddChild(root_0, STRING917_tree); } } break; case 4: DebugEnterAlt(4); // SugarCpp.g:728:4: '@' ( WS )* ident { DebugLocation(728, 4); char_literal918=(IToken)Match(input,131,Follow._131_in_atom_expr8756); if (state.failed) return retval; if (state.backtracking == 0) stream_131.Add(char_literal918); DebugLocation(728, 8); // SugarCpp.g:728:8: ( WS )* try { DebugEnterSubRule(597); while (true) { int alt597=2; try { DebugEnterDecision(597, false); int LA597_0 = input.LA(1); if ((LA597_0==WS)) { alt597 = 1; } } finally { DebugExitDecision(597); } switch ( alt597 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:728:8: WS { DebugLocation(728, 8); WS919=(IToken)Match(input,WS,Follow._WS_in_atom_expr8758); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS919); } break; default: goto loop597; } } loop597: ; } finally { DebugExitSubRule(597); } DebugLocation(728, 12); PushFollow(Follow._ident_in_atom_expr8761); ident920=ident(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_ident.Add(ident920.Tree); { // AST REWRITE // elements: 131, ident // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: if (state.backtracking == 0) { retval.Tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null); root_0 = (CommonTree)adaptor.Nil(); // 728:18: -> ^( '@' ident ) { DebugLocation(728, 21); // SugarCpp.g:728:21: ^( '@' ident ) { CommonTree root_1 = (CommonTree)adaptor.Nil(); DebugLocation(728, 23); root_1 = (CommonTree)adaptor.BecomeRoot(stream_131.NextNode(), root_1); DebugLocation(728, 27); adaptor.AddChild(root_1, stream_ident.NextTree()); adaptor.AddChild(root_0, root_1); } } retval.Tree = root_0; } } } break; case 5: DebugEnterAlt(5); // SugarCpp.g:729:4: '(' ( WS )* a= expr ( ( ( WS )* ',' ( WS )* expr )+ ( WS )* ')' -> ^( Expr_Tuple ( expr )+ ) | ( WS )* ')' -> ^( Expr_Bracket expr ) ) { DebugLocation(729, 4); char_literal921=(IToken)Match(input,93,Follow._93_in_atom_expr8774); if (state.failed) return retval; if (state.backtracking == 0) stream_93.Add(char_literal921); DebugLocation(729, 8); // SugarCpp.g:729:8: ( WS )* try { DebugEnterSubRule(598); while (true) { int alt598=2; try { DebugEnterDecision(598, false); int LA598_0 = input.LA(1); if ((LA598_0==WS)) { alt598 = 1; } } finally { DebugExitDecision(598); } switch ( alt598 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:729:8: WS { DebugLocation(729, 8); WS922=(IToken)Match(input,WS,Follow._WS_in_atom_expr8776); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS922); } break; default: goto loop598; } } loop598: ; } finally { DebugExitSubRule(598); } DebugLocation(729, 13); PushFollow(Follow._expr_in_atom_expr8781); a=expr(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_expr.Add(a.Tree); DebugLocation(729, 19); // SugarCpp.g:729:19: ( ( ( WS )* ',' ( WS )* expr )+ ( WS )* ')' -> ^( Expr_Tuple ( expr )+ ) | ( WS )* ')' -> ^( Expr_Bracket expr ) ) int alt604=2; try { DebugEnterSubRule(604); try { DebugEnterDecision(604, false); try { alt604 = dfa604.Predict(input); } catch (NoViableAltException nvae) { DebugRecognitionException(nvae); throw; } } finally { DebugExitDecision(604); } switch (alt604) { case 1: DebugEnterAlt(1); // SugarCpp.g:729:21: ( ( WS )* ',' ( WS )* expr )+ ( WS )* ')' { DebugLocation(729, 21); // SugarCpp.g:729:21: ( ( WS )* ',' ( WS )* expr )+ int cnt601=0; try { DebugEnterSubRule(601); while (true) { int alt601=2; try { DebugEnterDecision(601, false); try { alt601 = dfa601.Predict(input); } catch (NoViableAltException nvae) { DebugRecognitionException(nvae); throw; } } finally { DebugExitDecision(601); } switch (alt601) { case 1: DebugEnterAlt(1); // SugarCpp.g:729:22: ( WS )* ',' ( WS )* expr { DebugLocation(729, 22); // SugarCpp.g:729:22: ( WS )* try { DebugEnterSubRule(599); while (true) { int alt599=2; try { DebugEnterDecision(599, false); int LA599_0 = input.LA(1); if ((LA599_0==WS)) { alt599 = 1; } } finally { DebugExitDecision(599); } switch ( alt599 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:729:22: WS { DebugLocation(729, 22); WS923=(IToken)Match(input,WS,Follow._WS_in_atom_expr8786); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS923); } break; default: goto loop599; } } loop599: ; } finally { DebugExitSubRule(599); } DebugLocation(729, 26); char_literal924=(IToken)Match(input,100,Follow._100_in_atom_expr8789); if (state.failed) return retval; if (state.backtracking == 0) stream_100.Add(char_literal924); DebugLocation(729, 30); // SugarCpp.g:729:30: ( WS )* try { DebugEnterSubRule(600); while (true) { int alt600=2; try { DebugEnterDecision(600, false); int LA600_0 = input.LA(1); if ((LA600_0==WS)) { alt600 = 1; } } finally { DebugExitDecision(600); } switch ( alt600 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:729:30: WS { DebugLocation(729, 30); WS925=(IToken)Match(input,WS,Follow._WS_in_atom_expr8791); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS925); } break; default: goto loop600; } } loop600: ; } finally { DebugExitSubRule(600); } DebugLocation(729, 34); PushFollow(Follow._expr_in_atom_expr8794); expr926=expr(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_expr.Add(expr926.Tree); } break; default: if (cnt601 >= 1) goto loop601; if (state.backtracking>0) {state.failed=true; return retval;} EarlyExitException eee601 = new EarlyExitException( 601, input ); DebugRecognitionException(eee601); throw eee601; } cnt601++; } loop601: ; } finally { DebugExitSubRule(601); } DebugLocation(729, 41); // SugarCpp.g:729:41: ( WS )* try { DebugEnterSubRule(602); while (true) { int alt602=2; try { DebugEnterDecision(602, false); int LA602_0 = input.LA(1); if ((LA602_0==WS)) { alt602 = 1; } } finally { DebugExitDecision(602); } switch ( alt602 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:729:41: WS { DebugLocation(729, 41); WS927=(IToken)Match(input,WS,Follow._WS_in_atom_expr8798); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS927); } break; default: goto loop602; } } loop602: ; } finally { DebugExitSubRule(602); } DebugLocation(729, 45); char_literal928=(IToken)Match(input,94,Follow._94_in_atom_expr8801); if (state.failed) return retval; if (state.backtracking == 0) stream_94.Add(char_literal928); { // AST REWRITE // elements: expr // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: if (state.backtracking == 0) { retval.Tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null); root_0 = (CommonTree)adaptor.Nil(); // 729:49: -> ^( Expr_Tuple ( expr )+ ) { DebugLocation(729, 52); // SugarCpp.g:729:52: ^( Expr_Tuple ( expr )+ ) { CommonTree root_1 = (CommonTree)adaptor.Nil(); DebugLocation(729, 54); root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(Expr_Tuple, "Expr_Tuple"), root_1); DebugLocation(729, 65); if (!(stream_expr.HasNext)) { throw new RewriteEarlyExitException(); } while ( stream_expr.HasNext ) { DebugLocation(729, 65); adaptor.AddChild(root_1, stream_expr.NextTree()); } stream_expr.Reset(); adaptor.AddChild(root_0, root_1); } } retval.Tree = root_0; } } } break; case 2: DebugEnterAlt(2); // SugarCpp.g:730:21: ( WS )* ')' { DebugLocation(730, 21); // SugarCpp.g:730:21: ( WS )* try { DebugEnterSubRule(603); while (true) { int alt603=2; try { DebugEnterDecision(603, false); int LA603_0 = input.LA(1); if ((LA603_0==WS)) { alt603 = 1; } } finally { DebugExitDecision(603); } switch ( alt603 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:730:21: WS { DebugLocation(730, 21); WS929=(IToken)Match(input,WS,Follow._WS_in_atom_expr8832); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS929); } break; default: goto loop603; } } loop603: ; } finally { DebugExitSubRule(603); } DebugLocation(730, 25); char_literal930=(IToken)Match(input,94,Follow._94_in_atom_expr8835); if (state.failed) return retval; if (state.backtracking == 0) stream_94.Add(char_literal930); { // AST REWRITE // elements: expr // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: if (state.backtracking == 0) { retval.Tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null); root_0 = (CommonTree)adaptor.Nil(); // 730:29: -> ^( Expr_Bracket expr ) { DebugLocation(730, 32); // SugarCpp.g:730:32: ^( Expr_Bracket expr ) { CommonTree root_1 = (CommonTree)adaptor.Nil(); DebugLocation(730, 34); root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(Expr_Bracket, "Expr_Bracket"), root_1); DebugLocation(730, 47); adaptor.AddChild(root_1, stream_expr.NextTree()); adaptor.AddChild(root_0, root_1); } } retval.Tree = root_0; } } } break; } } finally { DebugExitSubRule(604); } } break; } retval.Stop = (IToken)input.LT(-1); if (state.backtracking == 0) { retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0); adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop); } } catch (RecognitionException re) { ReportError(re); Recover(input,re); retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re); } finally { TraceOut("atom_expr", 96); LeaveRule("atom_expr", 96); LeaveRule_atom_expr(); } DebugLocation(732, 1); } finally { DebugExitRule(GrammarFileName, "atom_expr"); } return retval; }
private AstParserRuleReturnScope<CommonTree, IToken> type_single() { EnterRule_type_single(); EnterRule("type_single", 18); TraceIn("type_single", 18); AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>(); retval.Start = (IToken)input.LT(1); CommonTree root_0 = default(CommonTree); IToken WS198 = default(IToken); IToken char_literal199 = default(IToken); IToken WS200 = default(IToken); IToken char_literal201 = default(IToken); IToken WS202 = default(IToken); IToken WS204 = default(IToken); IToken char_literal205 = default(IToken); IToken WS206 = default(IToken); IToken WS208 = default(IToken); IToken char_literal209 = default(IToken); IToken WS210 = default(IToken); IToken char_literal211 = default(IToken); IToken WS212 = default(IToken); IToken char_literal213 = default(IToken); AstParserRuleReturnScope<CommonTree, IToken> type_star197 = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> expr203 = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> expr207 = default(AstParserRuleReturnScope<CommonTree, IToken>); CommonTree WS198_tree = default(CommonTree); CommonTree char_literal199_tree = default(CommonTree); CommonTree WS200_tree = default(CommonTree); CommonTree char_literal201_tree = default(CommonTree); CommonTree WS202_tree = default(CommonTree); CommonTree WS204_tree = default(CommonTree); CommonTree char_literal205_tree = default(CommonTree); CommonTree WS206_tree = default(CommonTree); CommonTree WS208_tree = default(CommonTree); CommonTree char_literal209_tree = default(CommonTree); CommonTree WS210_tree = default(CommonTree); CommonTree char_literal211_tree = default(CommonTree); CommonTree WS212_tree = default(CommonTree); CommonTree char_literal213_tree = default(CommonTree); RewriteRuleITokenStream stream_132=new RewriteRuleITokenStream(adaptor,"token 132"); RewriteRuleITokenStream stream_133=new RewriteRuleITokenStream(adaptor,"token 133"); RewriteRuleITokenStream stream_WS=new RewriteRuleITokenStream(adaptor,"token WS"); RewriteRuleITokenStream stream_91=new RewriteRuleITokenStream(adaptor,"token 91"); RewriteRuleITokenStream stream_100=new RewriteRuleITokenStream(adaptor,"token 100"); RewriteRuleSubtreeStream stream_expr=new RewriteRuleSubtreeStream(adaptor,"rule expr"); RewriteRuleSubtreeStream stream_type_star=new RewriteRuleSubtreeStream(adaptor,"rule type_star"); try { DebugEnterRule(GrammarFileName, "type_single"); DebugLocation(307, 1); try { // SugarCpp.g:308:2: ( type_star ( ( WS )* '&' -> ^( Type_Ref type_star ) | ( WS )* '[' ( ( WS )* expr ( ( WS )* ',' ( WS )* expr )* ( WS )* ']' -> ^( Type_Array type_star ( expr )+ ) | ( ( WS )* ',' )* ( WS )* ']' -> ^( Type_Array type_star ( expr )+ ) ) | -> type_star ) ) DebugEnterAlt(1); // SugarCpp.g:308:4: type_star ( ( WS )* '&' -> ^( Type_Ref type_star ) | ( WS )* '[' ( ( WS )* expr ( ( WS )* ',' ( WS )* expr )* ( WS )* ']' -> ^( Type_Array type_star ( expr )+ ) | ( ( WS )* ',' )* ( WS )* ']' -> ^( Type_Array type_star ( expr )+ ) ) | -> type_star ) { DebugLocation(308, 4); PushFollow(Follow._type_star_in_type_single1897); type_star197=type_star(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_type_star.Add(type_star197.Tree); DebugLocation(308, 14); // SugarCpp.g:308:14: ( ( WS )* '&' -> ^( Type_Ref type_star ) | ( WS )* '[' ( ( WS )* expr ( ( WS )* ',' ( WS )* expr )* ( WS )* ']' -> ^( Type_Array type_star ( expr )+ ) | ( ( WS )* ',' )* ( WS )* ']' -> ^( Type_Array type_star ( expr )+ ) ) | -> type_star ) int alt140=3; try { DebugEnterSubRule(140); try { DebugEnterDecision(140, false); try { alt140 = dfa140.Predict(input); } catch (NoViableAltException nvae) { DebugRecognitionException(nvae); throw; } } finally { DebugExitDecision(140); } switch (alt140) { case 1: DebugEnterAlt(1); // SugarCpp.g:308:16: ( WS )* '&' { DebugLocation(308, 16); // SugarCpp.g:308:16: ( WS )* try { DebugEnterSubRule(129); while (true) { int alt129=2; try { DebugEnterDecision(129, false); int LA129_0 = input.LA(1); if ((LA129_0==WS)) { alt129 = 1; } } finally { DebugExitDecision(129); } switch ( alt129 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:308:16: WS { DebugLocation(308, 16); WS198=(IToken)Match(input,WS,Follow._WS_in_type_single1901); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS198); } break; default: goto loop129; } } loop129: ; } finally { DebugExitSubRule(129); } DebugLocation(308, 20); char_literal199=(IToken)Match(input,91,Follow._91_in_type_single1904); if (state.failed) return retval; if (state.backtracking == 0) stream_91.Add(char_literal199); { // AST REWRITE // elements: type_star // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: if (state.backtracking == 0) { retval.Tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null); root_0 = (CommonTree)adaptor.Nil(); // 308:24: -> ^( Type_Ref type_star ) { DebugLocation(308, 27); // SugarCpp.g:308:27: ^( Type_Ref type_star ) { CommonTree root_1 = (CommonTree)adaptor.Nil(); DebugLocation(308, 29); root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(Type_Ref, "Type_Ref"), root_1); DebugLocation(308, 38); adaptor.AddChild(root_1, stream_type_star.NextTree()); adaptor.AddChild(root_0, root_1); } } retval.Tree = root_0; } } } break; case 2: DebugEnterAlt(2); // SugarCpp.g:309:7: ( WS )* '[' ( ( WS )* expr ( ( WS )* ',' ( WS )* expr )* ( WS )* ']' -> ^( Type_Array type_star ( expr )+ ) | ( ( WS )* ',' )* ( WS )* ']' -> ^( Type_Array type_star ( expr )+ ) ) { DebugLocation(309, 7); // SugarCpp.g:309:7: ( WS )* try { DebugEnterSubRule(130); while (true) { int alt130=2; try { DebugEnterDecision(130, false); int LA130_0 = input.LA(1); if ((LA130_0==WS)) { alt130 = 1; } } finally { DebugExitDecision(130); } switch ( alt130 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:309:7: WS { DebugLocation(309, 7); WS200=(IToken)Match(input,WS,Follow._WS_in_type_single1920); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS200); } break; default: goto loop130; } } loop130: ; } finally { DebugExitSubRule(130); } DebugLocation(309, 11); char_literal201=(IToken)Match(input,132,Follow._132_in_type_single1923); if (state.failed) return retval; if (state.backtracking == 0) stream_132.Add(char_literal201); DebugLocation(309, 15); // SugarCpp.g:309:15: ( ( WS )* expr ( ( WS )* ',' ( WS )* expr )* ( WS )* ']' -> ^( Type_Array type_star ( expr )+ ) | ( ( WS )* ',' )* ( WS )* ']' -> ^( Type_Array type_star ( expr )+ ) ) int alt139=2; try { DebugEnterSubRule(139); try { DebugEnterDecision(139, false); try { alt139 = dfa139.Predict(input); } catch (NoViableAltException nvae) { DebugRecognitionException(nvae); throw; } } finally { DebugExitDecision(139); } switch (alt139) { case 1: DebugEnterAlt(1); // SugarCpp.g:309:17: ( WS )* expr ( ( WS )* ',' ( WS )* expr )* ( WS )* ']' { DebugLocation(309, 17); // SugarCpp.g:309:17: ( WS )* try { DebugEnterSubRule(131); while (true) { int alt131=2; try { DebugEnterDecision(131, false); int LA131_0 = input.LA(1); if ((LA131_0==WS)) { alt131 = 1; } } finally { DebugExitDecision(131); } switch ( alt131 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:309:17: WS { DebugLocation(309, 17); WS202=(IToken)Match(input,WS,Follow._WS_in_type_single1927); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS202); } break; default: goto loop131; } } loop131: ; } finally { DebugExitSubRule(131); } DebugLocation(309, 21); PushFollow(Follow._expr_in_type_single1930); expr203=expr(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_expr.Add(expr203.Tree); DebugLocation(309, 26); // SugarCpp.g:309:26: ( ( WS )* ',' ( WS )* expr )* try { DebugEnterSubRule(134); while (true) { int alt134=2; try { DebugEnterDecision(134, false); try { alt134 = dfa134.Predict(input); } catch (NoViableAltException nvae) { DebugRecognitionException(nvae); throw; } } finally { DebugExitDecision(134); } switch ( alt134 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:309:27: ( WS )* ',' ( WS )* expr { DebugLocation(309, 27); // SugarCpp.g:309:27: ( WS )* try { DebugEnterSubRule(132); while (true) { int alt132=2; try { DebugEnterDecision(132, false); int LA132_0 = input.LA(1); if ((LA132_0==WS)) { alt132 = 1; } } finally { DebugExitDecision(132); } switch ( alt132 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:309:27: WS { DebugLocation(309, 27); WS204=(IToken)Match(input,WS,Follow._WS_in_type_single1933); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS204); } break; default: goto loop132; } } loop132: ; } finally { DebugExitSubRule(132); } DebugLocation(309, 31); char_literal205=(IToken)Match(input,100,Follow._100_in_type_single1936); if (state.failed) return retval; if (state.backtracking == 0) stream_100.Add(char_literal205); DebugLocation(309, 35); // SugarCpp.g:309:35: ( WS )* try { DebugEnterSubRule(133); while (true) { int alt133=2; try { DebugEnterDecision(133, false); int LA133_0 = input.LA(1); if ((LA133_0==WS)) { alt133 = 1; } } finally { DebugExitDecision(133); } switch ( alt133 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:309:35: WS { DebugLocation(309, 35); WS206=(IToken)Match(input,WS,Follow._WS_in_type_single1938); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS206); } break; default: goto loop133; } } loop133: ; } finally { DebugExitSubRule(133); } DebugLocation(309, 39); PushFollow(Follow._expr_in_type_single1941); expr207=expr(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_expr.Add(expr207.Tree); } break; default: goto loop134; } } loop134: ; } finally { DebugExitSubRule(134); } DebugLocation(309, 46); // SugarCpp.g:309:46: ( WS )* try { DebugEnterSubRule(135); while (true) { int alt135=2; try { DebugEnterDecision(135, false); int LA135_0 = input.LA(1); if ((LA135_0==WS)) { alt135 = 1; } } finally { DebugExitDecision(135); } switch ( alt135 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:309:46: WS { DebugLocation(309, 46); WS208=(IToken)Match(input,WS,Follow._WS_in_type_single1945); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS208); } break; default: goto loop135; } } loop135: ; } finally { DebugExitSubRule(135); } DebugLocation(309, 50); char_literal209=(IToken)Match(input,133,Follow._133_in_type_single1948); if (state.failed) return retval; if (state.backtracking == 0) stream_133.Add(char_literal209); { // AST REWRITE // elements: type_star, expr // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: if (state.backtracking == 0) { retval.Tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null); root_0 = (CommonTree)adaptor.Nil(); // 309:54: -> ^( Type_Array type_star ( expr )+ ) { DebugLocation(309, 57); // SugarCpp.g:309:57: ^( Type_Array type_star ( expr )+ ) { CommonTree root_1 = (CommonTree)adaptor.Nil(); DebugLocation(309, 59); root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(Type_Array, "Type_Array"), root_1); DebugLocation(309, 70); adaptor.AddChild(root_1, stream_type_star.NextTree()); DebugLocation(309, 80); if (!(stream_expr.HasNext)) { throw new RewriteEarlyExitException(); } while ( stream_expr.HasNext ) { DebugLocation(309, 80); adaptor.AddChild(root_1, stream_expr.NextTree()); } stream_expr.Reset(); adaptor.AddChild(root_0, root_1); } } retval.Tree = root_0; } } } break; case 2: DebugEnterAlt(2); // SugarCpp.g:310:17: ( ( WS )* ',' )* ( WS )* ']' { DebugLocation(310, 17); // SugarCpp.g:310:17: ( ( WS )* ',' )* try { DebugEnterSubRule(137); while (true) { int alt137=2; try { DebugEnterDecision(137, false); try { alt137 = dfa137.Predict(input); } catch (NoViableAltException nvae) { DebugRecognitionException(nvae); throw; } } finally { DebugExitDecision(137); } switch ( alt137 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:310:18: ( WS )* ',' { DebugLocation(310, 18); // SugarCpp.g:310:18: ( WS )* try { DebugEnterSubRule(136); while (true) { int alt136=2; try { DebugEnterDecision(136, false); int LA136_0 = input.LA(1); if ((LA136_0==WS)) { alt136 = 1; } } finally { DebugExitDecision(136); } switch ( alt136 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:310:18: WS { DebugLocation(310, 18); WS210=(IToken)Match(input,WS,Follow._WS_in_type_single1978); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS210); } break; default: goto loop136; } } loop136: ; } finally { DebugExitSubRule(136); } DebugLocation(310, 22); char_literal211=(IToken)Match(input,100,Follow._100_in_type_single1981); if (state.failed) return retval; if (state.backtracking == 0) stream_100.Add(char_literal211); } break; default: goto loop137; } } loop137: ; } finally { DebugExitSubRule(137); } DebugLocation(310, 28); // SugarCpp.g:310:28: ( WS )* try { DebugEnterSubRule(138); while (true) { int alt138=2; try { DebugEnterDecision(138, false); int LA138_0 = input.LA(1); if ((LA138_0==WS)) { alt138 = 1; } } finally { DebugExitDecision(138); } switch ( alt138 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:310:28: WS { DebugLocation(310, 28); WS212=(IToken)Match(input,WS,Follow._WS_in_type_single1985); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS212); } break; default: goto loop138; } } loop138: ; } finally { DebugExitSubRule(138); } DebugLocation(310, 32); char_literal213=(IToken)Match(input,133,Follow._133_in_type_single1988); if (state.failed) return retval; if (state.backtracking == 0) stream_133.Add(char_literal213); { // AST REWRITE // elements: type_star, expr // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: if (state.backtracking == 0) { retval.Tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null); root_0 = (CommonTree)adaptor.Nil(); // 310:36: -> ^( Type_Array type_star ( expr )+ ) { DebugLocation(310, 39); // SugarCpp.g:310:39: ^( Type_Array type_star ( expr )+ ) { CommonTree root_1 = (CommonTree)adaptor.Nil(); DebugLocation(310, 41); root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(Type_Array, "Type_Array"), root_1); DebugLocation(310, 52); adaptor.AddChild(root_1, stream_type_star.NextTree()); DebugLocation(310, 62); if (!(stream_expr.HasNext)) { throw new RewriteEarlyExitException(); } while ( stream_expr.HasNext ) { DebugLocation(310, 62); adaptor.AddChild(root_1, stream_expr.NextTree()); } stream_expr.Reset(); adaptor.AddChild(root_0, root_1); } } retval.Tree = root_0; } } } break; } } finally { DebugExitSubRule(139); } } break; case 3: DebugEnterAlt(3); // SugarCpp.g:312:7: { { // AST REWRITE // elements: type_star // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: if (state.backtracking == 0) { retval.Tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null); root_0 = (CommonTree)adaptor.Nil(); // 312:7: -> type_star { DebugLocation(312, 10); adaptor.AddChild(root_0, stream_type_star.NextTree()); } retval.Tree = root_0; } } } break; } } finally { DebugExitSubRule(140); } } retval.Stop = (IToken)input.LT(-1); if (state.backtracking == 0) { retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0); adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop); } } catch (RecognitionException re) { ReportError(re); Recover(input,re); retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re); } finally { TraceOut("type_single", 18); LeaveRule("type_single", 18); LeaveRule_type_single(); } DebugLocation(314, 1); } finally { DebugExitRule(GrammarFileName, "type_single"); } return retval; }
private AstParserRuleReturnScope<CommonTree, IToken> global_block() { EnterRule_global_block(); EnterRule("global_block", 2); TraceIn("global_block", 2); AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>(); retval.Start = (IToken)input.LT(1); CommonTree root_0 = default(CommonTree); IToken WS5 = default(IToken); IToken NEWLINE6 = default(IToken); AstParserRuleReturnScope<CommonTree, IToken> node4 = default(AstParserRuleReturnScope<CommonTree, IToken>); CommonTree WS5_tree = default(CommonTree); CommonTree NEWLINE6_tree = default(CommonTree); RewriteRuleITokenStream stream_WS=new RewriteRuleITokenStream(adaptor,"token WS"); RewriteRuleITokenStream stream_NEWLINE=new RewriteRuleITokenStream(adaptor,"token NEWLINE"); RewriteRuleSubtreeStream stream_node=new RewriteRuleSubtreeStream(adaptor,"rule node"); try { DebugEnterRule(GrammarFileName, "global_block"); DebugLocation(218, 1); try { // SugarCpp.g:219:2: ( ( node ( WS )* ( NEWLINE )+ )* -> ^( Global_Block ( node )* ) ) DebugEnterAlt(1); // SugarCpp.g:219:4: ( node ( WS )* ( NEWLINE )+ )* { DebugLocation(219, 4); // SugarCpp.g:219:4: ( node ( WS )* ( NEWLINE )+ )* try { DebugEnterSubRule(4); while (true) { int alt4=2; try { DebugEnterDecision(4, false); int LA4_0 = input.LA(1); if ((LA4_0==IDENT||LA4_0==93||LA4_0==132||LA4_0==139||(LA4_0>=141 && LA4_0<=142)||(LA4_0>=146 && LA4_0<=147)||LA4_0==151||LA4_0==156||LA4_0==159||LA4_0==163||(LA4_0>=166 && LA4_0<=167)||LA4_0==170||LA4_0==174||(LA4_0>=177 && LA4_0<=178)||LA4_0==186)) { alt4 = 1; } } finally { DebugExitDecision(4); } switch ( alt4 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:219:5: node ( WS )* ( NEWLINE )+ { DebugLocation(219, 5); PushFollow(Follow._node_in_global_block597); node4=node(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_node.Add(node4.Tree); DebugLocation(219, 10); // SugarCpp.g:219:10: ( WS )* try { DebugEnterSubRule(2); while (true) { int alt2=2; try { DebugEnterDecision(2, false); int LA2_0 = input.LA(1); if ((LA2_0==WS)) { alt2 = 1; } } finally { DebugExitDecision(2); } switch ( alt2 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:219:10: WS { DebugLocation(219, 10); WS5=(IToken)Match(input,WS,Follow._WS_in_global_block599); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS5); } break; default: goto loop2; } } loop2: ; } finally { DebugExitSubRule(2); } DebugLocation(219, 14); // SugarCpp.g:219:14: ( NEWLINE )+ int cnt3=0; try { DebugEnterSubRule(3); while (true) { int alt3=2; try { DebugEnterDecision(3, false); int LA3_0 = input.LA(1); if ((LA3_0==NEWLINE)) { alt3 = 1; } } finally { DebugExitDecision(3); } switch (alt3) { case 1: DebugEnterAlt(1); // SugarCpp.g:219:14: NEWLINE { DebugLocation(219, 14); NEWLINE6=(IToken)Match(input,NEWLINE,Follow._NEWLINE_in_global_block602); if (state.failed) return retval; if (state.backtracking == 0) stream_NEWLINE.Add(NEWLINE6); } break; default: if (cnt3 >= 1) goto loop3; if (state.backtracking>0) {state.failed=true; return retval;} EarlyExitException eee3 = new EarlyExitException( 3, input ); DebugRecognitionException(eee3); throw eee3; } cnt3++; } loop3: ; } finally { DebugExitSubRule(3); } } break; default: goto loop4; } } loop4: ; } finally { DebugExitSubRule(4); } { // AST REWRITE // elements: node // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: if (state.backtracking == 0) { retval.Tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null); root_0 = (CommonTree)adaptor.Nil(); // 219:25: -> ^( Global_Block ( node )* ) { DebugLocation(219, 28); // SugarCpp.g:219:28: ^( Global_Block ( node )* ) { CommonTree root_1 = (CommonTree)adaptor.Nil(); DebugLocation(219, 30); root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(Global_Block, "Global_Block"), root_1); DebugLocation(219, 43); // SugarCpp.g:219:43: ( node )* while ( stream_node.HasNext ) { DebugLocation(219, 43); adaptor.AddChild(root_1, stream_node.NextTree()); } stream_node.Reset(); adaptor.AddChild(root_0, root_1); } } retval.Tree = root_0; } } } retval.Stop = (IToken)input.LT(-1); if (state.backtracking == 0) { retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0); adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop); } } catch (RecognitionException re) { ReportError(re); Recover(input,re); retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re); } finally { TraceOut("global_block", 2); LeaveRule("global_block", 2); LeaveRule_global_block(); } DebugLocation(220, 1); } finally { DebugExitRule(GrammarFileName, "global_block"); } return retval; }
private AstParserRuleReturnScope<CommonTree, IToken> attribute_args_list() { EnterRule_attribute_args_list(); EnterRule("attribute_args_list", 5); TraceIn("attribute_args_list", 5); AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>(); retval.Start = (IToken)input.LT(1); CommonTree root_0 = default(CommonTree); IToken char_literal18 = default(IToken); IToken WS19 = default(IToken); IToken WS21 = default(IToken); IToken char_literal22 = default(IToken); IToken WS23 = default(IToken); IToken WS25 = default(IToken); IToken char_literal26 = default(IToken); AstParserRuleReturnScope<CommonTree, IToken> attribute_args20 = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> attribute_args24 = default(AstParserRuleReturnScope<CommonTree, IToken>); CommonTree char_literal18_tree = default(CommonTree); CommonTree WS19_tree = default(CommonTree); CommonTree WS21_tree = default(CommonTree); CommonTree char_literal22_tree = default(CommonTree); CommonTree WS23_tree = default(CommonTree); CommonTree WS25_tree = default(CommonTree); CommonTree char_literal26_tree = default(CommonTree); RewriteRuleITokenStream stream_94=new RewriteRuleITokenStream(adaptor,"token 94"); RewriteRuleITokenStream stream_WS=new RewriteRuleITokenStream(adaptor,"token WS"); RewriteRuleITokenStream stream_93=new RewriteRuleITokenStream(adaptor,"token 93"); RewriteRuleITokenStream stream_100=new RewriteRuleITokenStream(adaptor,"token 100"); RewriteRuleSubtreeStream stream_attribute_args=new RewriteRuleSubtreeStream(adaptor,"rule attribute_args"); try { DebugEnterRule(GrammarFileName, "attribute_args_list"); DebugLocation(239, 1); try { // SugarCpp.g:240:2: ( '(' ( WS )* attribute_args ( ( WS )* ',' ( WS )* attribute_args )* ( WS )* ')' -> ( attribute_args )+ ) DebugEnterAlt(1); // SugarCpp.g:240:4: '(' ( WS )* attribute_args ( ( WS )* ',' ( WS )* attribute_args )* ( WS )* ')' { DebugLocation(240, 4); char_literal18=(IToken)Match(input,93,Follow._93_in_attribute_args_list692); if (state.failed) return retval; if (state.backtracking == 0) stream_93.Add(char_literal18); DebugLocation(240, 8); // SugarCpp.g:240:8: ( WS )* try { DebugEnterSubRule(7); while (true) { int alt7=2; try { DebugEnterDecision(7, false); int LA7_0 = input.LA(1); if ((LA7_0==WS)) { alt7 = 1; } } finally { DebugExitDecision(7); } switch ( alt7 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:240:8: WS { DebugLocation(240, 8); WS19=(IToken)Match(input,WS,Follow._WS_in_attribute_args_list694); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS19); } break; default: goto loop7; } } loop7: ; } finally { DebugExitSubRule(7); } DebugLocation(240, 12); PushFollow(Follow._attribute_args_in_attribute_args_list697); attribute_args20=attribute_args(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_attribute_args.Add(attribute_args20.Tree); DebugLocation(240, 27); // SugarCpp.g:240:27: ( ( WS )* ',' ( WS )* attribute_args )* try { DebugEnterSubRule(10); while (true) { int alt10=2; try { DebugEnterDecision(10, false); try { alt10 = dfa10.Predict(input); } catch (NoViableAltException nvae) { DebugRecognitionException(nvae); throw; } } finally { DebugExitDecision(10); } switch ( alt10 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:240:28: ( WS )* ',' ( WS )* attribute_args { DebugLocation(240, 28); // SugarCpp.g:240:28: ( WS )* try { DebugEnterSubRule(8); while (true) { int alt8=2; try { DebugEnterDecision(8, false); int LA8_0 = input.LA(1); if ((LA8_0==WS)) { alt8 = 1; } } finally { DebugExitDecision(8); } switch ( alt8 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:240:28: WS { DebugLocation(240, 28); WS21=(IToken)Match(input,WS,Follow._WS_in_attribute_args_list700); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS21); } break; default: goto loop8; } } loop8: ; } finally { DebugExitSubRule(8); } DebugLocation(240, 32); char_literal22=(IToken)Match(input,100,Follow._100_in_attribute_args_list703); if (state.failed) return retval; if (state.backtracking == 0) stream_100.Add(char_literal22); DebugLocation(240, 36); // SugarCpp.g:240:36: ( WS )* try { DebugEnterSubRule(9); while (true) { int alt9=2; try { DebugEnterDecision(9, false); int LA9_0 = input.LA(1); if ((LA9_0==WS)) { alt9 = 1; } } finally { DebugExitDecision(9); } switch ( alt9 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:240:36: WS { DebugLocation(240, 36); WS23=(IToken)Match(input,WS,Follow._WS_in_attribute_args_list705); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS23); } break; default: goto loop9; } } loop9: ; } finally { DebugExitSubRule(9); } DebugLocation(240, 40); PushFollow(Follow._attribute_args_in_attribute_args_list708); attribute_args24=attribute_args(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_attribute_args.Add(attribute_args24.Tree); } break; default: goto loop10; } } loop10: ; } finally { DebugExitSubRule(10); } DebugLocation(240, 57); // SugarCpp.g:240:57: ( WS )* try { DebugEnterSubRule(11); while (true) { int alt11=2; try { DebugEnterDecision(11, false); int LA11_0 = input.LA(1); if ((LA11_0==WS)) { alt11 = 1; } } finally { DebugExitDecision(11); } switch ( alt11 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:240:57: WS { DebugLocation(240, 57); WS25=(IToken)Match(input,WS,Follow._WS_in_attribute_args_list712); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS25); } break; default: goto loop11; } } loop11: ; } finally { DebugExitSubRule(11); } DebugLocation(240, 61); char_literal26=(IToken)Match(input,94,Follow._94_in_attribute_args_list715); if (state.failed) return retval; if (state.backtracking == 0) stream_94.Add(char_literal26); { // AST REWRITE // elements: attribute_args // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: if (state.backtracking == 0) { retval.Tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null); root_0 = (CommonTree)adaptor.Nil(); // 240:65: -> ( attribute_args )+ { DebugLocation(240, 68); if (!(stream_attribute_args.HasNext)) { throw new RewriteEarlyExitException(); } while ( stream_attribute_args.HasNext ) { DebugLocation(240, 68); adaptor.AddChild(root_0, stream_attribute_args.NextTree()); } stream_attribute_args.Reset(); } retval.Tree = root_0; } } } retval.Stop = (IToken)input.LT(-1); if (state.backtracking == 0) { retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0); adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop); } } catch (RecognitionException re) { ReportError(re); Recover(input,re); retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re); } finally { TraceOut("attribute_args_list", 5); LeaveRule("attribute_args_list", 5); LeaveRule_attribute_args_list(); } DebugLocation(241, 1); } finally { DebugExitRule(GrammarFileName, "attribute_args_list"); } return retval; }
private AstParserRuleReturnScope<CommonTree, IToken> lvalue() { EnterRule_lvalue(); EnterRule("lvalue", 101); TraceIn("lvalue", 101); AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>(); retval.Start = (IToken)input.LT(1); CommonTree root_0 = default(CommonTree); IToken char_literal958 = default(IToken); IToken WS959 = default(IToken); IToken WS961 = default(IToken); IToken char_literal962 = default(IToken); IToken WS963 = default(IToken); IToken WS965 = default(IToken); IToken char_literal966 = default(IToken); AstParserRuleReturnScope<CommonTree, IToken> lvalue_item960 = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> lvalue_item964 = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> lvalue_item967 = default(AstParserRuleReturnScope<CommonTree, IToken>); CommonTree char_literal958_tree = default(CommonTree); CommonTree WS959_tree = default(CommonTree); CommonTree WS961_tree = default(CommonTree); CommonTree char_literal962_tree = default(CommonTree); CommonTree WS963_tree = default(CommonTree); CommonTree WS965_tree = default(CommonTree); CommonTree char_literal966_tree = default(CommonTree); RewriteRuleITokenStream stream_94=new RewriteRuleITokenStream(adaptor,"token 94"); RewriteRuleITokenStream stream_WS=new RewriteRuleITokenStream(adaptor,"token WS"); RewriteRuleITokenStream stream_93=new RewriteRuleITokenStream(adaptor,"token 93"); RewriteRuleITokenStream stream_100=new RewriteRuleITokenStream(adaptor,"token 100"); RewriteRuleSubtreeStream stream_lvalue_item=new RewriteRuleSubtreeStream(adaptor,"rule lvalue_item"); try { DebugEnterRule(GrammarFileName, "lvalue"); DebugLocation(759, 1); try { // SugarCpp.g:760:2: ( '(' ( WS )* lvalue_item ( ( WS )* ',' ( WS )* lvalue_item )+ ( WS )* ')' -> ^( Match_Tuple ( lvalue_item )* ) | lvalue_item ) int alt624=2; try { DebugEnterDecision(624, false); int LA624_0 = input.LA(1); if ((LA624_0==93)) { alt624 = 1; } else if ((LA624_0==IDENT||LA624_0==86||LA624_0==91||LA624_0==95||(LA624_0>=97 && LA624_0<=98)||(LA624_0>=101 && LA624_0<=102)||LA624_0==131||LA624_0==161||LA624_0==186)) { alt624 = 2; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 624, 0, input); DebugRecognitionException(nvae); throw nvae; } } finally { DebugExitDecision(624); } switch (alt624) { case 1: DebugEnterAlt(1); // SugarCpp.g:760:4: '(' ( WS )* lvalue_item ( ( WS )* ',' ( WS )* lvalue_item )+ ( WS )* ')' { DebugLocation(760, 4); char_literal958=(IToken)Match(input,93,Follow._93_in_lvalue9181); if (state.failed) return retval; if (state.backtracking == 0) stream_93.Add(char_literal958); DebugLocation(760, 8); // SugarCpp.g:760:8: ( WS )* try { DebugEnterSubRule(619); while (true) { int alt619=2; try { DebugEnterDecision(619, false); int LA619_0 = input.LA(1); if ((LA619_0==WS)) { alt619 = 1; } } finally { DebugExitDecision(619); } switch ( alt619 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:760:8: WS { DebugLocation(760, 8); WS959=(IToken)Match(input,WS,Follow._WS_in_lvalue9183); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS959); } break; default: goto loop619; } } loop619: ; } finally { DebugExitSubRule(619); } DebugLocation(760, 12); PushFollow(Follow._lvalue_item_in_lvalue9186); lvalue_item960=lvalue_item(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_lvalue_item.Add(lvalue_item960.Tree); DebugLocation(760, 24); // SugarCpp.g:760:24: ( ( WS )* ',' ( WS )* lvalue_item )+ int cnt622=0; try { DebugEnterSubRule(622); while (true) { int alt622=2; try { DebugEnterDecision(622, false); try { alt622 = dfa622.Predict(input); } catch (NoViableAltException nvae) { DebugRecognitionException(nvae); throw; } } finally { DebugExitDecision(622); } switch (alt622) { case 1: DebugEnterAlt(1); // SugarCpp.g:760:25: ( WS )* ',' ( WS )* lvalue_item { DebugLocation(760, 25); // SugarCpp.g:760:25: ( WS )* try { DebugEnterSubRule(620); while (true) { int alt620=2; try { DebugEnterDecision(620, false); int LA620_0 = input.LA(1); if ((LA620_0==WS)) { alt620 = 1; } } finally { DebugExitDecision(620); } switch ( alt620 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:760:25: WS { DebugLocation(760, 25); WS961=(IToken)Match(input,WS,Follow._WS_in_lvalue9189); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS961); } break; default: goto loop620; } } loop620: ; } finally { DebugExitSubRule(620); } DebugLocation(760, 29); char_literal962=(IToken)Match(input,100,Follow._100_in_lvalue9192); if (state.failed) return retval; if (state.backtracking == 0) stream_100.Add(char_literal962); DebugLocation(760, 33); // SugarCpp.g:760:33: ( WS )* try { DebugEnterSubRule(621); while (true) { int alt621=2; try { DebugEnterDecision(621, false); int LA621_0 = input.LA(1); if ((LA621_0==WS)) { alt621 = 1; } } finally { DebugExitDecision(621); } switch ( alt621 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:760:33: WS { DebugLocation(760, 33); WS963=(IToken)Match(input,WS,Follow._WS_in_lvalue9194); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS963); } break; default: goto loop621; } } loop621: ; } finally { DebugExitSubRule(621); } DebugLocation(760, 37); PushFollow(Follow._lvalue_item_in_lvalue9197); lvalue_item964=lvalue_item(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_lvalue_item.Add(lvalue_item964.Tree); } break; default: if (cnt622 >= 1) goto loop622; if (state.backtracking>0) {state.failed=true; return retval;} EarlyExitException eee622 = new EarlyExitException( 622, input ); DebugRecognitionException(eee622); throw eee622; } cnt622++; } loop622: ; } finally { DebugExitSubRule(622); } DebugLocation(760, 51); // SugarCpp.g:760:51: ( WS )* try { DebugEnterSubRule(623); while (true) { int alt623=2; try { DebugEnterDecision(623, false); int LA623_0 = input.LA(1); if ((LA623_0==WS)) { alt623 = 1; } } finally { DebugExitDecision(623); } switch ( alt623 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:760:51: WS { DebugLocation(760, 51); WS965=(IToken)Match(input,WS,Follow._WS_in_lvalue9201); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS965); } break; default: goto loop623; } } loop623: ; } finally { DebugExitSubRule(623); } DebugLocation(760, 55); char_literal966=(IToken)Match(input,94,Follow._94_in_lvalue9204); if (state.failed) return retval; if (state.backtracking == 0) stream_94.Add(char_literal966); { // AST REWRITE // elements: lvalue_item // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: if (state.backtracking == 0) { retval.Tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null); root_0 = (CommonTree)adaptor.Nil(); // 760:59: -> ^( Match_Tuple ( lvalue_item )* ) { DebugLocation(760, 62); // SugarCpp.g:760:62: ^( Match_Tuple ( lvalue_item )* ) { CommonTree root_1 = (CommonTree)adaptor.Nil(); DebugLocation(760, 64); root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(Match_Tuple, "Match_Tuple"), root_1); DebugLocation(760, 76); // SugarCpp.g:760:76: ( lvalue_item )* while ( stream_lvalue_item.HasNext ) { DebugLocation(760, 76); adaptor.AddChild(root_1, stream_lvalue_item.NextTree()); } stream_lvalue_item.Reset(); adaptor.AddChild(root_0, root_1); } } retval.Tree = root_0; } } } break; case 2: DebugEnterAlt(2); // SugarCpp.g:761:4: lvalue_item { root_0 = (CommonTree)adaptor.Nil(); DebugLocation(761, 4); PushFollow(Follow._lvalue_item_in_lvalue9218); lvalue_item967=lvalue_item(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) adaptor.AddChild(root_0, lvalue_item967.Tree); } break; } retval.Stop = (IToken)input.LT(-1); if (state.backtracking == 0) { retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0); adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop); } } catch (RecognitionException re) { ReportError(re); Recover(input,re); retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re); } finally { TraceOut("lvalue", 101); LeaveRule("lvalue", 101); LeaveRule_lvalue(); } DebugLocation(762, 1); } finally { DebugExitRule(GrammarFileName, "lvalue"); } return retval; }
private AstParserRuleReturnScope<object, IToken> orderby_expr() { EnterRule_orderby_expr(); EnterRule("orderby_expr", 20); TraceIn("orderby_expr", 20); AstParserRuleReturnScope<object, IToken> retval = new AstParserRuleReturnScope<object, IToken>(); retval.Start = (IToken)input.LT(1); object root_0 = default(object); AstParserRuleReturnScope<object, IToken> exp84 = default(AstParserRuleReturnScope<object, IToken>); AstParserRuleReturnScope<object, IToken> sortorder_operator85 = default(AstParserRuleReturnScope<object, IToken>); RewriteRuleSubtreeStream stream_exp=new RewriteRuleSubtreeStream(adaptor,"rule exp"); RewriteRuleSubtreeStream stream_sortorder_operator=new RewriteRuleSubtreeStream(adaptor,"rule sortorder_operator"); try { DebugEnterRule(GrammarFileName, "orderby_expr"); DebugLocation(184, 1); try { // Queries\\PomonaQuery.g:185:2: ( exp ( sortorder_operator )? -> ^( ORDERBY_ASC exp ( sortorder_operator )? ) ) DebugEnterAlt(1); // Queries\\PomonaQuery.g:185:4: exp ( sortorder_operator )? { DebugLocation(185, 4); PushFollow(Follow._exp_in_orderby_expr1167); exp84=exp(); PopFollow(); stream_exp.Add(exp84.Tree); DebugLocation(185, 8); // Queries\\PomonaQuery.g:185:8: ( sortorder_operator )? int alt27=2; try { DebugEnterSubRule(27); try { DebugEnterDecision(27, false); int LA27_1 = input.LA(1); if (((LA27_1>=62 && LA27_1<=63))) { alt27 = 1; } } finally { DebugExitDecision(27); } switch (alt27) { case 1: DebugEnterAlt(1); // Queries\\PomonaQuery.g:185:9: sortorder_operator { DebugLocation(185, 9); PushFollow(Follow._sortorder_operator_in_orderby_expr1170); sortorder_operator85=sortorder_operator(); PopFollow(); stream_sortorder_operator.Add(sortorder_operator85.Tree); } break; } } finally { DebugExitSubRule(27); } { // AST REWRITE // elements: exp, sortorder_operator // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: retval.Tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null); root_0 = (object)adaptor.Nil(); // 185:30: -> ^( ORDERBY_ASC exp ( sortorder_operator )? ) { DebugLocation(185, 33); // Queries\\PomonaQuery.g:185:33: ^( ORDERBY_ASC exp ( sortorder_operator )? ) { object root_1 = (object)adaptor.Nil(); DebugLocation(185, 35); root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(ORDERBY_ASC, "ORDERBY_ASC"), root_1); DebugLocation(185, 47); adaptor.AddChild(root_1, stream_exp.NextTree()); DebugLocation(185, 51); // Queries\\PomonaQuery.g:185:51: ( sortorder_operator )? if (stream_sortorder_operator.HasNext) { DebugLocation(185, 51); adaptor.AddChild(root_1, stream_sortorder_operator.NextTree()); } stream_sortorder_operator.Reset(); adaptor.AddChild(root_0, root_1); } } retval.Tree = root_0; } } retval.Stop = (IToken)input.LT(-1); retval.Tree = (object)adaptor.RulePostProcessing(root_0); adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop); } catch (RecognitionException re) { ReportError(re); Recover(input,re); retval.Tree = (object)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re); } finally { TraceOut("orderby_expr", 20); LeaveRule("orderby_expr", 20); LeaveRule_orderby_expr(); } DebugLocation(186, 1); } finally { DebugExitRule(GrammarFileName, "orderby_expr"); } return retval; }
private AstParserRuleReturnScope<CommonTree, IToken> enum_def() { EnterRule_enum_def(); EnterRule("enum_def", 12); TraceIn("enum_def", 12); AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>(); retval.Start = (IToken)input.LT(1); CommonTree root_0 = default(CommonTree); IToken string_literal101 = default(IToken); IToken WS102 = default(IToken); IToken WS104 = default(IToken); IToken char_literal105 = default(IToken); IToken WS106 = default(IToken); IToken WS108 = default(IToken); IToken char_literal109 = default(IToken); IToken WS110 = default(IToken); AstParserRuleReturnScope<CommonTree, IToken> attribute100 = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> ident103 = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> ident107 = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> ident111 = default(AstParserRuleReturnScope<CommonTree, IToken>); CommonTree string_literal101_tree = default(CommonTree); CommonTree WS102_tree = default(CommonTree); CommonTree WS104_tree = default(CommonTree); CommonTree char_literal105_tree = default(CommonTree); CommonTree WS106_tree = default(CommonTree); CommonTree WS108_tree = default(CommonTree); CommonTree char_literal109_tree = default(CommonTree); CommonTree WS110_tree = default(CommonTree); RewriteRuleITokenStream stream_182=new RewriteRuleITokenStream(adaptor,"token 182"); RewriteRuleITokenStream stream_146=new RewriteRuleITokenStream(adaptor,"token 146"); RewriteRuleITokenStream stream_WS=new RewriteRuleITokenStream(adaptor,"token WS"); RewriteRuleITokenStream stream_121=new RewriteRuleITokenStream(adaptor,"token 121"); RewriteRuleSubtreeStream stream_ident=new RewriteRuleSubtreeStream(adaptor,"rule ident"); RewriteRuleSubtreeStream stream_attribute=new RewriteRuleSubtreeStream(adaptor,"rule attribute"); try { DebugEnterRule(GrammarFileName, "enum_def"); DebugLocation(276, 1); try { // SugarCpp.g:277:2: ( ( attribute )? 'enum' ( WS )* ident ( WS )* '=' ( ( WS )* ident ( ( WS )* '|' ( WS )* ident )* )? -> ^( Enum ( attribute )? ident ^( Ident_List ( ident )* ) ) ) DebugEnterAlt(1); // SugarCpp.g:277:4: ( attribute )? 'enum' ( WS )* ident ( WS )* '=' ( ( WS )* ident ( ( WS )* '|' ( WS )* ident )* )? { DebugLocation(277, 4); // SugarCpp.g:277:4: ( attribute )? int alt64=2; try { DebugEnterSubRule(64); try { DebugEnterDecision(64, false); int LA64_0 = input.LA(1); if ((LA64_0==132)) { alt64 = 1; } } finally { DebugExitDecision(64); } switch (alt64) { case 1: DebugEnterAlt(1); // SugarCpp.g:277:4: attribute { DebugLocation(277, 4); PushFollow(Follow._attribute_in_enum_def1339); attribute100=attribute(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_attribute.Add(attribute100.Tree); } break; } } finally { DebugExitSubRule(64); } DebugLocation(277, 15); string_literal101=(IToken)Match(input,146,Follow._146_in_enum_def1342); if (state.failed) return retval; if (state.backtracking == 0) stream_146.Add(string_literal101); DebugLocation(277, 22); // SugarCpp.g:277:22: ( WS )* try { DebugEnterSubRule(65); while (true) { int alt65=2; try { DebugEnterDecision(65, false); int LA65_0 = input.LA(1); if ((LA65_0==WS)) { alt65 = 1; } } finally { DebugExitDecision(65); } switch ( alt65 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:277:22: WS { DebugLocation(277, 22); WS102=(IToken)Match(input,WS,Follow._WS_in_enum_def1344); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS102); } break; default: goto loop65; } } loop65: ; } finally { DebugExitSubRule(65); } DebugLocation(277, 26); PushFollow(Follow._ident_in_enum_def1347); ident103=ident(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_ident.Add(ident103.Tree); DebugLocation(277, 32); // SugarCpp.g:277:32: ( WS )* try { DebugEnterSubRule(66); while (true) { int alt66=2; try { DebugEnterDecision(66, false); int LA66_0 = input.LA(1); if ((LA66_0==WS)) { alt66 = 1; } } finally { DebugExitDecision(66); } switch ( alt66 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:277:32: WS { DebugLocation(277, 32); WS104=(IToken)Match(input,WS,Follow._WS_in_enum_def1349); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS104); } break; default: goto loop66; } } loop66: ; } finally { DebugExitSubRule(66); } DebugLocation(277, 36); char_literal105=(IToken)Match(input,121,Follow._121_in_enum_def1352); if (state.failed) return retval; if (state.backtracking == 0) stream_121.Add(char_literal105); DebugLocation(277, 40); // SugarCpp.g:277:40: ( ( WS )* ident ( ( WS )* '|' ( WS )* ident )* )? int alt71=2; try { DebugEnterSubRule(71); try { DebugEnterDecision(71, false); try { alt71 = dfa71.Predict(input); } catch (NoViableAltException nvae) { DebugRecognitionException(nvae); throw; } } finally { DebugExitDecision(71); } switch (alt71) { case 1: DebugEnterAlt(1); // SugarCpp.g:277:41: ( WS )* ident ( ( WS )* '|' ( WS )* ident )* { DebugLocation(277, 41); // SugarCpp.g:277:41: ( WS )* try { DebugEnterSubRule(67); while (true) { int alt67=2; try { DebugEnterDecision(67, false); int LA67_0 = input.LA(1); if ((LA67_0==WS)) { alt67 = 1; } } finally { DebugExitDecision(67); } switch ( alt67 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:277:41: WS { DebugLocation(277, 41); WS106=(IToken)Match(input,WS,Follow._WS_in_enum_def1355); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS106); } break; default: goto loop67; } } loop67: ; } finally { DebugExitSubRule(67); } DebugLocation(277, 45); PushFollow(Follow._ident_in_enum_def1358); ident107=ident(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_ident.Add(ident107.Tree); DebugLocation(277, 51); // SugarCpp.g:277:51: ( ( WS )* '|' ( WS )* ident )* try { DebugEnterSubRule(70); while (true) { int alt70=2; try { DebugEnterDecision(70, false); try { alt70 = dfa70.Predict(input); } catch (NoViableAltException nvae) { DebugRecognitionException(nvae); throw; } } finally { DebugExitDecision(70); } switch ( alt70 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:277:52: ( WS )* '|' ( WS )* ident { DebugLocation(277, 52); // SugarCpp.g:277:52: ( WS )* try { DebugEnterSubRule(68); while (true) { int alt68=2; try { DebugEnterDecision(68, false); int LA68_0 = input.LA(1); if ((LA68_0==WS)) { alt68 = 1; } } finally { DebugExitDecision(68); } switch ( alt68 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:277:52: WS { DebugLocation(277, 52); WS108=(IToken)Match(input,WS,Follow._WS_in_enum_def1361); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS108); } break; default: goto loop68; } } loop68: ; } finally { DebugExitSubRule(68); } DebugLocation(277, 56); char_literal109=(IToken)Match(input,182,Follow._182_in_enum_def1364); if (state.failed) return retval; if (state.backtracking == 0) stream_182.Add(char_literal109); DebugLocation(277, 60); // SugarCpp.g:277:60: ( WS )* try { DebugEnterSubRule(69); while (true) { int alt69=2; try { DebugEnterDecision(69, false); int LA69_0 = input.LA(1); if ((LA69_0==WS)) { alt69 = 1; } } finally { DebugExitDecision(69); } switch ( alt69 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:277:60: WS { DebugLocation(277, 60); WS110=(IToken)Match(input,WS,Follow._WS_in_enum_def1366); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS110); } break; default: goto loop69; } } loop69: ; } finally { DebugExitSubRule(69); } DebugLocation(277, 64); PushFollow(Follow._ident_in_enum_def1369); ident111=ident(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_ident.Add(ident111.Tree); } break; default: goto loop70; } } loop70: ; } finally { DebugExitSubRule(70); } } break; } } finally { DebugExitSubRule(71); } { // AST REWRITE // elements: ident, ident, attribute // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: if (state.backtracking == 0) { retval.Tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null); root_0 = (CommonTree)adaptor.Nil(); // 277:74: -> ^( Enum ( attribute )? ident ^( Ident_List ( ident )* ) ) { DebugLocation(277, 77); // SugarCpp.g:277:77: ^( Enum ( attribute )? ident ^( Ident_List ( ident )* ) ) { CommonTree root_1 = (CommonTree)adaptor.Nil(); DebugLocation(277, 79); root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(Enum, "Enum"), root_1); DebugLocation(277, 84); // SugarCpp.g:277:84: ( attribute )? if (stream_attribute.HasNext) { DebugLocation(277, 84); adaptor.AddChild(root_1, stream_attribute.NextTree()); } stream_attribute.Reset(); DebugLocation(277, 95); adaptor.AddChild(root_1, stream_ident.NextTree()); DebugLocation(277, 101); // SugarCpp.g:277:101: ^( Ident_List ( ident )* ) { CommonTree root_2 = (CommonTree)adaptor.Nil(); DebugLocation(277, 103); root_2 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(Ident_List, "Ident_List"), root_2); DebugLocation(277, 114); // SugarCpp.g:277:114: ( ident )* while ( stream_ident.HasNext ) { DebugLocation(277, 114); adaptor.AddChild(root_2, stream_ident.NextTree()); } stream_ident.Reset(); adaptor.AddChild(root_1, root_2); } adaptor.AddChild(root_0, root_1); } } retval.Tree = root_0; } } } retval.Stop = (IToken)input.LT(-1); if (state.backtracking == 0) { retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0); adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop); } } catch (RecognitionException re) { ReportError(re); Recover(input,re); retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re); } finally { TraceOut("enum_def", 12); LeaveRule("enum_def", 12); LeaveRule_enum_def(); } DebugLocation(278, 1); } finally { DebugExitRule(GrammarFileName, "enum_def"); } return retval; }
private AstParserRuleReturnScope<object, IToken> or_expression() { EnterRule_or_expression(); EnterRule("or_expression", 5); TraceIn("or_expression", 5); AstParserRuleReturnScope<object, IToken> retval = new AstParserRuleReturnScope<object, IToken>(); retval.Start = (IToken)input.LT(1); object root_0 = default(object); IToken string_literal11 = default(IToken); IToken string_literal12 = default(IToken); AstParserRuleReturnScope<object, IToken> and_expression10 = default(AstParserRuleReturnScope<object, IToken>); AstParserRuleReturnScope<object, IToken> and_expression13 = default(AstParserRuleReturnScope<object, IToken>); object string_literal11_tree = default(object); object string_literal12_tree = default(object); RewriteRuleITokenStream stream_75=new RewriteRuleITokenStream(adaptor,"token 75"); RewriteRuleITokenStream stream_77=new RewriteRuleITokenStream(adaptor,"token 77"); RewriteRuleSubtreeStream stream_and_expression=new RewriteRuleSubtreeStream(adaptor,"rule and_expression"); try { DebugEnterRule(GrammarFileName, "or_expression"); DebugLocation(93, 1); try { // Queries\\PomonaQuery.g:94:2: ( and_expression ( ( 'or' | '||' ) and_expression )* -> ^( OR_OP ( and_expression )+ ) ) DebugEnterAlt(1); // Queries\\PomonaQuery.g:94:4: and_expression ( ( 'or' | '||' ) and_expression )* { DebugLocation(94, 4); PushFollow(Follow._and_expression_in_or_expression588); and_expression10=and_expression(); PopFollow(); stream_and_expression.Add(and_expression10.Tree); DebugLocation(94, 19); // Queries\\PomonaQuery.g:94:19: ( ( 'or' | '||' ) and_expression )* try { DebugEnterSubRule(4); while (true) { int alt4=2; try { DebugEnterDecision(4, false); int LA4_1 = input.LA(1); if ((LA4_1==75||LA4_1==77)) { alt4 = 1; } } finally { DebugExitDecision(4); } switch ( alt4 ) { case 1: DebugEnterAlt(1); // Queries\\PomonaQuery.g:94:21: ( 'or' | '||' ) and_expression { DebugLocation(94, 21); // Queries\\PomonaQuery.g:94:21: ( 'or' | '||' ) int alt3=2; try { DebugEnterSubRule(3); try { DebugEnterDecision(3, false); int LA3_1 = input.LA(1); if ((LA3_1==75)) { alt3 = 1; } else if ((LA3_1==77)) { alt3 = 2; } else { NoViableAltException nvae = new NoViableAltException("", 3, 0, input, 1); DebugRecognitionException(nvae); throw nvae; } } finally { DebugExitDecision(3); } switch (alt3) { case 1: DebugEnterAlt(1); // Queries\\PomonaQuery.g:94:22: 'or' { DebugLocation(94, 22); string_literal11=(IToken)Match(input,75,Follow._75_in_or_expression593); stream_75.Add(string_literal11); } break; case 2: DebugEnterAlt(2); // Queries\\PomonaQuery.g:94:27: '||' { DebugLocation(94, 27); string_literal12=(IToken)Match(input,77,Follow._77_in_or_expression595); stream_77.Add(string_literal12); } break; } } finally { DebugExitSubRule(3); } DebugLocation(94, 33); PushFollow(Follow._and_expression_in_or_expression598); and_expression13=and_expression(); PopFollow(); stream_and_expression.Add(and_expression13.Tree); } break; default: goto loop4; } } loop4: ; } finally { DebugExitSubRule(4); } { // AST REWRITE // elements: and_expression // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: retval.Tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null); root_0 = (object)adaptor.Nil(); // 94:51: -> ^( OR_OP ( and_expression )+ ) { DebugLocation(94, 54); // Queries\\PomonaQuery.g:94:54: ^( OR_OP ( and_expression )+ ) { object root_1 = (object)adaptor.Nil(); DebugLocation(94, 56); root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(OR_OP, "OR_OP"), root_1); DebugLocation(94, 62); if (!(stream_and_expression.HasNext)) { throw new RewriteEarlyExitException(); } while ( stream_and_expression.HasNext ) { DebugLocation(94, 62); adaptor.AddChild(root_1, stream_and_expression.NextTree()); } stream_and_expression.Reset(); adaptor.AddChild(root_0, root_1); } } retval.Tree = root_0; } } retval.Stop = (IToken)input.LT(-1); retval.Tree = (object)adaptor.RulePostProcessing(root_0); adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop); } catch (RecognitionException re) { ReportError(re); Recover(input,re); retval.Tree = (object)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re); } finally { TraceOut("or_expression", 5); LeaveRule("or_expression", 5); LeaveRule_or_expression(); } DebugLocation(95, 1); } finally { DebugExitRule(GrammarFileName, "or_expression"); } return retval; }
private AstParserRuleReturnScope<CommonTree, IToken> namespace_def() { EnterRule_namespace_def(); EnterRule("namespace_def", 13); TraceIn("namespace_def", 13); AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>(); retval.Start = (IToken)input.LT(1); CommonTree root_0 = default(CommonTree); IToken string_literal113 = default(IToken); IToken WS114 = default(IToken); IToken WS116 = default(IToken); IToken NEWLINE117 = default(IToken); IToken INDENT118 = default(IToken); IToken NEWLINE119 = default(IToken); IToken DEDENT121 = default(IToken); AstParserRuleReturnScope<CommonTree, IToken> attribute112 = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> ident115 = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> global_block120 = default(AstParserRuleReturnScope<CommonTree, IToken>); CommonTree string_literal113_tree = default(CommonTree); CommonTree WS114_tree = default(CommonTree); CommonTree WS116_tree = default(CommonTree); CommonTree NEWLINE117_tree = default(CommonTree); CommonTree INDENT118_tree = default(CommonTree); CommonTree NEWLINE119_tree = default(CommonTree); CommonTree DEDENT121_tree = default(CommonTree); RewriteRuleITokenStream stream_WS=new RewriteRuleITokenStream(adaptor,"token WS"); RewriteRuleITokenStream stream_DEDENT=new RewriteRuleITokenStream(adaptor,"token DEDENT"); RewriteRuleITokenStream stream_NEWLINE=new RewriteRuleITokenStream(adaptor,"token NEWLINE"); RewriteRuleITokenStream stream_159=new RewriteRuleITokenStream(adaptor,"token 159"); RewriteRuleITokenStream stream_INDENT=new RewriteRuleITokenStream(adaptor,"token INDENT"); RewriteRuleSubtreeStream stream_ident=new RewriteRuleSubtreeStream(adaptor,"rule ident"); RewriteRuleSubtreeStream stream_attribute=new RewriteRuleSubtreeStream(adaptor,"rule attribute"); RewriteRuleSubtreeStream stream_global_block=new RewriteRuleSubtreeStream(adaptor,"rule global_block"); try { DebugEnterRule(GrammarFileName, "namespace_def"); DebugLocation(280, 1); try { // SugarCpp.g:281:2: ( ( attribute )? 'namespace' ( WS )* ident ( ( WS )* ( NEWLINE )+ INDENT ( NEWLINE )* global_block DEDENT )? -> ^( Namespace ( attribute )? ident ( global_block )? ) ) DebugEnterAlt(1); // SugarCpp.g:281:4: ( attribute )? 'namespace' ( WS )* ident ( ( WS )* ( NEWLINE )+ INDENT ( NEWLINE )* global_block DEDENT )? { DebugLocation(281, 4); // SugarCpp.g:281:4: ( attribute )? int alt72=2; try { DebugEnterSubRule(72); try { DebugEnterDecision(72, false); int LA72_0 = input.LA(1); if ((LA72_0==132)) { alt72 = 1; } } finally { DebugExitDecision(72); } switch (alt72) { case 1: DebugEnterAlt(1); // SugarCpp.g:281:4: attribute { DebugLocation(281, 4); PushFollow(Follow._attribute_in_namespace_def1402); attribute112=attribute(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_attribute.Add(attribute112.Tree); } break; } } finally { DebugExitSubRule(72); } DebugLocation(281, 15); string_literal113=(IToken)Match(input,159,Follow._159_in_namespace_def1405); if (state.failed) return retval; if (state.backtracking == 0) stream_159.Add(string_literal113); DebugLocation(281, 27); // SugarCpp.g:281:27: ( WS )* try { DebugEnterSubRule(73); while (true) { int alt73=2; try { DebugEnterDecision(73, false); int LA73_0 = input.LA(1); if ((LA73_0==WS)) { alt73 = 1; } } finally { DebugExitDecision(73); } switch ( alt73 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:281:27: WS { DebugLocation(281, 27); WS114=(IToken)Match(input,WS,Follow._WS_in_namespace_def1407); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS114); } break; default: goto loop73; } } loop73: ; } finally { DebugExitSubRule(73); } DebugLocation(281, 31); PushFollow(Follow._ident_in_namespace_def1410); ident115=ident(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_ident.Add(ident115.Tree); DebugLocation(281, 37); // SugarCpp.g:281:37: ( ( WS )* ( NEWLINE )+ INDENT ( NEWLINE )* global_block DEDENT )? int alt77=2; try { DebugEnterSubRule(77); try { DebugEnterDecision(77, false); try { alt77 = dfa77.Predict(input); } catch (NoViableAltException nvae) { DebugRecognitionException(nvae); throw; } } finally { DebugExitDecision(77); } switch (alt77) { case 1: DebugEnterAlt(1); // SugarCpp.g:281:38: ( WS )* ( NEWLINE )+ INDENT ( NEWLINE )* global_block DEDENT { DebugLocation(281, 38); // SugarCpp.g:281:38: ( WS )* try { DebugEnterSubRule(74); while (true) { int alt74=2; try { DebugEnterDecision(74, false); int LA74_0 = input.LA(1); if ((LA74_0==WS)) { alt74 = 1; } } finally { DebugExitDecision(74); } switch ( alt74 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:281:38: WS { DebugLocation(281, 38); WS116=(IToken)Match(input,WS,Follow._WS_in_namespace_def1413); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS116); } break; default: goto loop74; } } loop74: ; } finally { DebugExitSubRule(74); } DebugLocation(281, 42); // SugarCpp.g:281:42: ( NEWLINE )+ int cnt75=0; try { DebugEnterSubRule(75); while (true) { int alt75=2; try { DebugEnterDecision(75, false); int LA75_0 = input.LA(1); if ((LA75_0==NEWLINE)) { alt75 = 1; } } finally { DebugExitDecision(75); } switch (alt75) { case 1: DebugEnterAlt(1); // SugarCpp.g:281:42: NEWLINE { DebugLocation(281, 42); NEWLINE117=(IToken)Match(input,NEWLINE,Follow._NEWLINE_in_namespace_def1416); if (state.failed) return retval; if (state.backtracking == 0) stream_NEWLINE.Add(NEWLINE117); } break; default: if (cnt75 >= 1) goto loop75; if (state.backtracking>0) {state.failed=true; return retval;} EarlyExitException eee75 = new EarlyExitException( 75, input ); DebugRecognitionException(eee75); throw eee75; } cnt75++; } loop75: ; } finally { DebugExitSubRule(75); } DebugLocation(281, 51); INDENT118=(IToken)Match(input,INDENT,Follow._INDENT_in_namespace_def1419); if (state.failed) return retval; if (state.backtracking == 0) stream_INDENT.Add(INDENT118); DebugLocation(281, 58); // SugarCpp.g:281:58: ( NEWLINE )* try { DebugEnterSubRule(76); while (true) { int alt76=2; try { DebugEnterDecision(76, false); int LA76_0 = input.LA(1); if ((LA76_0==NEWLINE)) { alt76 = 1; } } finally { DebugExitDecision(76); } switch ( alt76 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:281:58: NEWLINE { DebugLocation(281, 58); NEWLINE119=(IToken)Match(input,NEWLINE,Follow._NEWLINE_in_namespace_def1421); if (state.failed) return retval; if (state.backtracking == 0) stream_NEWLINE.Add(NEWLINE119); } break; default: goto loop76; } } loop76: ; } finally { DebugExitSubRule(76); } DebugLocation(281, 67); PushFollow(Follow._global_block_in_namespace_def1424); global_block120=global_block(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_global_block.Add(global_block120.Tree); DebugLocation(281, 80); DEDENT121=(IToken)Match(input,DEDENT,Follow._DEDENT_in_namespace_def1426); if (state.failed) return retval; if (state.backtracking == 0) stream_DEDENT.Add(DEDENT121); } break; } } finally { DebugExitSubRule(77); } { // AST REWRITE // elements: ident, attribute, global_block // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: if (state.backtracking == 0) { retval.Tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null); root_0 = (CommonTree)adaptor.Nil(); // 281:89: -> ^( Namespace ( attribute )? ident ( global_block )? ) { DebugLocation(281, 92); // SugarCpp.g:281:92: ^( Namespace ( attribute )? ident ( global_block )? ) { CommonTree root_1 = (CommonTree)adaptor.Nil(); DebugLocation(281, 94); root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(Namespace, "Namespace"), root_1); DebugLocation(281, 104); // SugarCpp.g:281:104: ( attribute )? if (stream_attribute.HasNext) { DebugLocation(281, 104); adaptor.AddChild(root_1, stream_attribute.NextTree()); } stream_attribute.Reset(); DebugLocation(281, 115); adaptor.AddChild(root_1, stream_ident.NextTree()); DebugLocation(281, 121); // SugarCpp.g:281:121: ( global_block )? if (stream_global_block.HasNext) { DebugLocation(281, 121); adaptor.AddChild(root_1, stream_global_block.NextTree()); } stream_global_block.Reset(); adaptor.AddChild(root_0, root_1); } } retval.Tree = root_0; } } } retval.Stop = (IToken)input.LT(-1); if (state.backtracking == 0) { retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0); adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop); } } catch (RecognitionException re) { ReportError(re); Recover(input,re); retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re); } finally { TraceOut("namespace_def", 13); LeaveRule("namespace_def", 13); LeaveRule_namespace_def(); } DebugLocation(282, 1); } finally { DebugExitRule(GrammarFileName, "namespace_def"); } return retval; }
// $ANTLR start "propertyModifiers" // C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:100:1: propertyModifiers : ( exclusivePropertyModifier -> ^( MODIFIERS exclusivePropertyModifier ) | ( propertyModifier )+ -> ^( MODIFIERS ( propertyModifier )+ ) ); public propertyModifiers_return propertyModifiers() // throws RecognitionException [1] { var retval = new propertyModifiers_return(); retval.Start = input.LT( 1 ); CommonTree root_0 = null; exclusivePropertyModifier_return exclusivePropertyModifier21 = default( exclusivePropertyModifier_return ); propertyModifier_return propertyModifier22 = default( propertyModifier_return ); var stream_propertyModifier = new RewriteRuleSubtreeStream( adaptor, "rule propertyModifier" ); var stream_exclusivePropertyModifier = new RewriteRuleSubtreeStream( adaptor, "rule exclusivePropertyModifier" ); try { // C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:101:2: ( exclusivePropertyModifier -> ^( MODIFIERS exclusivePropertyModifier ) | ( propertyModifier )+ -> ^( MODIFIERS ( propertyModifier )+ ) ) int alt8 = 2; int LA8_0 = input.LA( 1 ); if ( ( LA8_0 == 64 ) ) alt8 = 1; else if ( ( ( LA8_0 >= 65 && LA8_0 <= 66 ) ) ) alt8 = 2; else { var nvae_d8s0 = new NoViableAltException( "", 8, 0, input ); throw nvae_d8s0; } switch ( alt8 ) { case 1: // C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:101:4: exclusivePropertyModifier { PushFollow( FOLLOW_exclusivePropertyModifier_in_propertyModifiers419 ); exclusivePropertyModifier21 = exclusivePropertyModifier(); state.followingStackPointer--; stream_exclusivePropertyModifier.Add( exclusivePropertyModifier21.Tree ); // AST REWRITE // elements: exclusivePropertyModifier // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: retval.Tree = root_0; var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null ); root_0 = (CommonTree)adaptor.GetNilNode(); // 101:30: -> ^( MODIFIERS exclusivePropertyModifier ) { // C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:101:33: ^( MODIFIERS exclusivePropertyModifier ) { var root_1 = (CommonTree)adaptor.GetNilNode(); root_1 = (CommonTree)adaptor.BecomeRoot( adaptor.Create( MODIFIERS, "MODIFIERS" ), root_1 ); adaptor.AddChild( root_1, stream_exclusivePropertyModifier.NextTree() ); adaptor.AddChild( root_0, root_1 ); } } retval.Tree = root_0; retval.Tree = root_0; } break; case 2: // C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:102:4: ( propertyModifier )+ { // C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:102:4: ( propertyModifier )+ int cnt7 = 0; do { int alt7 = 2; int LA7_0 = input.LA( 1 ); if ( ( ( LA7_0 >= 65 && LA7_0 <= 66 ) ) ) alt7 = 1; switch ( alt7 ) { case 1: // C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:102:4: propertyModifier { PushFollow( FOLLOW_propertyModifier_in_propertyModifiers434 ); propertyModifier22 = propertyModifier(); state.followingStackPointer--; stream_propertyModifier.Add( propertyModifier22.Tree ); } break; default: if ( cnt7 >= 1 ) goto loop7; var eee7 = new EarlyExitException( 7, input ); throw eee7; } cnt7++; } while ( true ); loop7: ; // Stops C# compiler whining that label 'loop7' has no statements // AST REWRITE // elements: propertyModifier // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: retval.Tree = root_0; var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null ); root_0 = (CommonTree)adaptor.GetNilNode(); // 102:22: -> ^( MODIFIERS ( propertyModifier )+ ) { // C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:102:25: ^( MODIFIERS ( propertyModifier )+ ) { var root_1 = (CommonTree)adaptor.GetNilNode(); root_1 = (CommonTree)adaptor.BecomeRoot( adaptor.Create( MODIFIERS, "MODIFIERS" ), root_1 ); if ( !( stream_propertyModifier.HasNext() ) ) throw new RewriteEarlyExitException(); while ( stream_propertyModifier.HasNext() ) adaptor.AddChild( root_1, stream_propertyModifier.NextTree() ); stream_propertyModifier.Reset(); adaptor.AddChild( root_0, root_1 ); } } retval.Tree = root_0; retval.Tree = root_0; } break; } retval.Stop = input.LT( -1 ); retval.Tree = adaptor.RulePostProcessing( root_0 ); adaptor.SetTokenBoundaries( retval.Tree, (IToken)retval.Start, (IToken)retval.Stop ); } catch ( RecognitionException re ) { ReportError( re ); Recover( input, re ); // Conversion of the second argument necessary, but harmless retval.Tree = adaptor.ErrorNode( input, (IToken)retval.Start, input.LT( -1 ), re ); } finally {} return retval; }
private AstParserRuleReturnScope<CommonTree, IToken> class_def() { EnterRule_class_def(); EnterRule("class_def", 15); TraceIn("class_def", 15); AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>(); retval.Start = (IToken)input.LT(1); CommonTree root_0 = default(CommonTree); IToken string_literal130 = default(IToken); IToken WS131 = default(IToken); IToken string_literal132 = default(IToken); IToken WS133 = default(IToken); IToken WS136 = default(IToken); IToken char_literal137 = default(IToken); IToken WS138 = default(IToken); IToken WS140 = default(IToken); IToken char_literal141 = default(IToken); IToken WS142 = default(IToken); IToken WS144 = default(IToken); IToken NEWLINE145 = default(IToken); IToken INDENT146 = default(IToken); IToken NEWLINE147 = default(IToken); IToken DEDENT149 = default(IToken); IToken string_literal150 = default(IToken); IToken WS151 = default(IToken); IToken string_literal152 = default(IToken); IToken WS153 = default(IToken); IToken WS156 = default(IToken); IToken WS158 = default(IToken); IToken char_literal159 = default(IToken); IToken WS160 = default(IToken); IToken WS162 = default(IToken); IToken char_literal163 = default(IToken); IToken WS164 = default(IToken); IToken WS166 = default(IToken); IToken NEWLINE167 = default(IToken); IToken INDENT168 = default(IToken); IToken NEWLINE169 = default(IToken); IToken DEDENT171 = default(IToken); AstParserRuleReturnScope<CommonTree, IToken> attribute129 = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> ident134 = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> generic_parameter135 = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> ident139 = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> ident143 = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> global_block148 = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> ident154 = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> generic_parameter155 = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> class_args157 = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> ident161 = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> ident165 = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> global_block170 = default(AstParserRuleReturnScope<CommonTree, IToken>); CommonTree string_literal130_tree = default(CommonTree); CommonTree WS131_tree = default(CommonTree); CommonTree string_literal132_tree = default(CommonTree); CommonTree WS133_tree = default(CommonTree); CommonTree WS136_tree = default(CommonTree); CommonTree char_literal137_tree = default(CommonTree); CommonTree WS138_tree = default(CommonTree); CommonTree WS140_tree = default(CommonTree); CommonTree char_literal141_tree = default(CommonTree); CommonTree WS142_tree = default(CommonTree); CommonTree WS144_tree = default(CommonTree); CommonTree NEWLINE145_tree = default(CommonTree); CommonTree INDENT146_tree = default(CommonTree); CommonTree NEWLINE147_tree = default(CommonTree); CommonTree DEDENT149_tree = default(CommonTree); CommonTree string_literal150_tree = default(CommonTree); CommonTree WS151_tree = default(CommonTree); CommonTree string_literal152_tree = default(CommonTree); CommonTree WS153_tree = default(CommonTree); CommonTree WS156_tree = default(CommonTree); CommonTree WS158_tree = default(CommonTree); CommonTree char_literal159_tree = default(CommonTree); CommonTree WS160_tree = default(CommonTree); CommonTree WS162_tree = default(CommonTree); CommonTree char_literal163_tree = default(CommonTree); CommonTree WS164_tree = default(CommonTree); CommonTree WS166_tree = default(CommonTree); CommonTree NEWLINE167_tree = default(CommonTree); CommonTree INDENT168_tree = default(CommonTree); CommonTree NEWLINE169_tree = default(CommonTree); CommonTree DEDENT171_tree = default(CommonTree); RewriteRuleITokenStream stream_163=new RewriteRuleITokenStream(adaptor,"token 163"); RewriteRuleITokenStream stream_WS=new RewriteRuleITokenStream(adaptor,"token WS"); RewriteRuleITokenStream stream_DEDENT=new RewriteRuleITokenStream(adaptor,"token DEDENT"); RewriteRuleITokenStream stream_139=new RewriteRuleITokenStream(adaptor,"token 139"); RewriteRuleITokenStream stream_NEWLINE=new RewriteRuleITokenStream(adaptor,"token NEWLINE"); RewriteRuleITokenStream stream_111=new RewriteRuleITokenStream(adaptor,"token 111"); RewriteRuleITokenStream stream_INDENT=new RewriteRuleITokenStream(adaptor,"token INDENT"); RewriteRuleITokenStream stream_100=new RewriteRuleITokenStream(adaptor,"token 100"); RewriteRuleITokenStream stream_141=new RewriteRuleITokenStream(adaptor,"token 141"); RewriteRuleSubtreeStream stream_class_args=new RewriteRuleSubtreeStream(adaptor,"rule class_args"); RewriteRuleSubtreeStream stream_ident=new RewriteRuleSubtreeStream(adaptor,"rule ident"); RewriteRuleSubtreeStream stream_attribute=new RewriteRuleSubtreeStream(adaptor,"rule attribute"); RewriteRuleSubtreeStream stream_global_block=new RewriteRuleSubtreeStream(adaptor,"rule global_block"); RewriteRuleSubtreeStream stream_generic_parameter=new RewriteRuleSubtreeStream(adaptor,"rule generic_parameter"); try { DebugEnterRule(GrammarFileName, "class_def"); DebugLocation(290, 1); try { // SugarCpp.g:291:2: ( ( attribute )? ( 'public' ( WS )* )? ( 'class' ( WS )* ident ( generic_parameter )? ( ( WS )* ':' ( WS )* ident ( ( WS )* ',' ( WS )* ident )* )? ( ( WS )* ( NEWLINE )+ INDENT ( NEWLINE )* global_block DEDENT )? -> ^( Class ( 'public' )? ( attribute )? ident ( generic_parameter )? ( class_args )? ( ^( Ident_List ( ident )* ) )? ( global_block )? ) | 'case' ( WS )* 'class' ( WS )* ident ( generic_parameter )? ( ( WS )* class_args )? ( ( WS )* ':' ( WS )* ident ( ( WS )* ',' ( WS )* ident )* )? ( ( WS )* ( NEWLINE )+ INDENT ( NEWLINE )* global_block DEDENT )? -> ^( Class 'case' ( 'public' )? ( attribute )? ident ( generic_parameter )? ( class_args )? ( ^( Ident_List ( ident )* ) )? ( global_block )? ) ) ) DebugEnterAlt(1); // SugarCpp.g:291:5: ( attribute )? ( 'public' ( WS )* )? ( 'class' ( WS )* ident ( generic_parameter )? ( ( WS )* ':' ( WS )* ident ( ( WS )* ',' ( WS )* ident )* )? ( ( WS )* ( NEWLINE )+ INDENT ( NEWLINE )* global_block DEDENT )? -> ^( Class ( 'public' )? ( attribute )? ident ( generic_parameter )? ( class_args )? ( ^( Ident_List ( ident )* ) )? ( global_block )? ) | 'case' ( WS )* 'class' ( WS )* ident ( generic_parameter )? ( ( WS )* class_args )? ( ( WS )* ':' ( WS )* ident ( ( WS )* ',' ( WS )* ident )* )? ( ( WS )* ( NEWLINE )+ INDENT ( NEWLINE )* global_block DEDENT )? -> ^( Class 'case' ( 'public' )? ( attribute )? ident ( generic_parameter )? ( class_args )? ( ^( Ident_List ( ident )* ) )? ( global_block )? ) ) { DebugLocation(291, 5); // SugarCpp.g:291:5: ( attribute )? int alt82=2; try { DebugEnterSubRule(82); try { DebugEnterDecision(82, false); int LA82_0 = input.LA(1); if ((LA82_0==132)) { alt82 = 1; } } finally { DebugExitDecision(82); } switch (alt82) { case 1: DebugEnterAlt(1); // SugarCpp.g:291:5: attribute { DebugLocation(291, 5); PushFollow(Follow._attribute_in_class_def1504); attribute129=attribute(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_attribute.Add(attribute129.Tree); } break; } } finally { DebugExitSubRule(82); } DebugLocation(291, 16); // SugarCpp.g:291:16: ( 'public' ( WS )* )? int alt84=2; try { DebugEnterSubRule(84); try { DebugEnterDecision(84, false); int LA84_0 = input.LA(1); if ((LA84_0==163)) { alt84 = 1; } } finally { DebugExitDecision(84); } switch (alt84) { case 1: DebugEnterAlt(1); // SugarCpp.g:291:17: 'public' ( WS )* { DebugLocation(291, 17); string_literal130=(IToken)Match(input,163,Follow._163_in_class_def1508); if (state.failed) return retval; if (state.backtracking == 0) stream_163.Add(string_literal130); DebugLocation(291, 26); // SugarCpp.g:291:26: ( WS )* try { DebugEnterSubRule(83); while (true) { int alt83=2; try { DebugEnterDecision(83, false); int LA83_0 = input.LA(1); if ((LA83_0==WS)) { alt83 = 1; } } finally { DebugExitDecision(83); } switch ( alt83 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:291:26: WS { DebugLocation(291, 26); WS131=(IToken)Match(input,WS,Follow._WS_in_class_def1510); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS131); } break; default: goto loop83; } } loop83: ; } finally { DebugExitSubRule(83); } } break; } } finally { DebugExitSubRule(84); } DebugLocation(291, 32); // SugarCpp.g:291:32: ( 'class' ( WS )* ident ( generic_parameter )? ( ( WS )* ':' ( WS )* ident ( ( WS )* ',' ( WS )* ident )* )? ( ( WS )* ( NEWLINE )+ INDENT ( NEWLINE )* global_block DEDENT )? -> ^( Class ( 'public' )? ( attribute )? ident ( generic_parameter )? ( class_args )? ( ^( Ident_List ( ident )* ) )? ( global_block )? ) | 'case' ( WS )* 'class' ( WS )* ident ( generic_parameter )? ( ( WS )* class_args )? ( ( WS )* ':' ( WS )* ident ( ( WS )* ',' ( WS )* ident )* )? ( ( WS )* ( NEWLINE )+ INDENT ( NEWLINE )* global_block DEDENT )? -> ^( Class 'case' ( 'public' )? ( attribute )? ident ( generic_parameter )? ( class_args )? ( ^( Ident_List ( ident )* ) )? ( global_block )? ) ) int alt112=2; try { DebugEnterSubRule(112); try { DebugEnterDecision(112, false); int LA112_0 = input.LA(1); if ((LA112_0==141)) { alt112 = 1; } else if ((LA112_0==139)) { alt112 = 2; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 112, 0, input); DebugRecognitionException(nvae); throw nvae; } } finally { DebugExitDecision(112); } switch (alt112) { case 1: DebugEnterAlt(1); // SugarCpp.g:291:34: 'class' ( WS )* ident ( generic_parameter )? ( ( WS )* ':' ( WS )* ident ( ( WS )* ',' ( WS )* ident )* )? ( ( WS )* ( NEWLINE )+ INDENT ( NEWLINE )* global_block DEDENT )? { DebugLocation(291, 34); string_literal132=(IToken)Match(input,141,Follow._141_in_class_def1517); if (state.failed) return retval; if (state.backtracking == 0) stream_141.Add(string_literal132); DebugLocation(291, 42); // SugarCpp.g:291:42: ( WS )* try { DebugEnterSubRule(85); while (true) { int alt85=2; try { DebugEnterDecision(85, false); int LA85_0 = input.LA(1); if ((LA85_0==WS)) { alt85 = 1; } } finally { DebugExitDecision(85); } switch ( alt85 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:291:42: WS { DebugLocation(291, 42); WS133=(IToken)Match(input,WS,Follow._WS_in_class_def1519); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS133); } break; default: goto loop85; } } loop85: ; } finally { DebugExitSubRule(85); } DebugLocation(291, 46); PushFollow(Follow._ident_in_class_def1522); ident134=ident(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_ident.Add(ident134.Tree); DebugLocation(291, 52); // SugarCpp.g:291:52: ( generic_parameter )? int alt86=2; try { DebugEnterSubRule(86); try { DebugEnterDecision(86, false); int LA86_0 = input.LA(1); if ((LA86_0==115)) { alt86 = 1; } } finally { DebugExitDecision(86); } switch (alt86) { case 1: DebugEnterAlt(1); // SugarCpp.g:291:53: generic_parameter { DebugLocation(291, 53); PushFollow(Follow._generic_parameter_in_class_def1525); generic_parameter135=generic_parameter(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_generic_parameter.Add(generic_parameter135.Tree); } break; } } finally { DebugExitSubRule(86); } DebugLocation(291, 73); // SugarCpp.g:291:73: ( ( WS )* ':' ( WS )* ident ( ( WS )* ',' ( WS )* ident )* )? int alt92=2; try { DebugEnterSubRule(92); try { DebugEnterDecision(92, false); try { alt92 = dfa92.Predict(input); } catch (NoViableAltException nvae) { DebugRecognitionException(nvae); throw; } } finally { DebugExitDecision(92); } switch (alt92) { case 1: DebugEnterAlt(1); // SugarCpp.g:291:74: ( WS )* ':' ( WS )* ident ( ( WS )* ',' ( WS )* ident )* { DebugLocation(291, 74); // SugarCpp.g:291:74: ( WS )* try { DebugEnterSubRule(87); while (true) { int alt87=2; try { DebugEnterDecision(87, false); int LA87_0 = input.LA(1); if ((LA87_0==WS)) { alt87 = 1; } } finally { DebugExitDecision(87); } switch ( alt87 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:291:74: WS { DebugLocation(291, 74); WS136=(IToken)Match(input,WS,Follow._WS_in_class_def1530); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS136); } break; default: goto loop87; } } loop87: ; } finally { DebugExitSubRule(87); } DebugLocation(291, 78); char_literal137=(IToken)Match(input,111,Follow._111_in_class_def1533); if (state.failed) return retval; if (state.backtracking == 0) stream_111.Add(char_literal137); DebugLocation(291, 82); // SugarCpp.g:291:82: ( WS )* try { DebugEnterSubRule(88); while (true) { int alt88=2; try { DebugEnterDecision(88, false); int LA88_0 = input.LA(1); if ((LA88_0==WS)) { alt88 = 1; } } finally { DebugExitDecision(88); } switch ( alt88 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:291:82: WS { DebugLocation(291, 82); WS138=(IToken)Match(input,WS,Follow._WS_in_class_def1535); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS138); } break; default: goto loop88; } } loop88: ; } finally { DebugExitSubRule(88); } DebugLocation(291, 86); PushFollow(Follow._ident_in_class_def1538); ident139=ident(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_ident.Add(ident139.Tree); DebugLocation(291, 92); // SugarCpp.g:291:92: ( ( WS )* ',' ( WS )* ident )* try { DebugEnterSubRule(91); while (true) { int alt91=2; try { DebugEnterDecision(91, false); try { alt91 = dfa91.Predict(input); } catch (NoViableAltException nvae) { DebugRecognitionException(nvae); throw; } } finally { DebugExitDecision(91); } switch ( alt91 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:291:93: ( WS )* ',' ( WS )* ident { DebugLocation(291, 93); // SugarCpp.g:291:93: ( WS )* try { DebugEnterSubRule(89); while (true) { int alt89=2; try { DebugEnterDecision(89, false); int LA89_0 = input.LA(1); if ((LA89_0==WS)) { alt89 = 1; } } finally { DebugExitDecision(89); } switch ( alt89 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:291:93: WS { DebugLocation(291, 93); WS140=(IToken)Match(input,WS,Follow._WS_in_class_def1541); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS140); } break; default: goto loop89; } } loop89: ; } finally { DebugExitSubRule(89); } DebugLocation(291, 97); char_literal141=(IToken)Match(input,100,Follow._100_in_class_def1544); if (state.failed) return retval; if (state.backtracking == 0) stream_100.Add(char_literal141); DebugLocation(291, 101); // SugarCpp.g:291:101: ( WS )* try { DebugEnterSubRule(90); while (true) { int alt90=2; try { DebugEnterDecision(90, false); int LA90_0 = input.LA(1); if ((LA90_0==WS)) { alt90 = 1; } } finally { DebugExitDecision(90); } switch ( alt90 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:291:101: WS { DebugLocation(291, 101); WS142=(IToken)Match(input,WS,Follow._WS_in_class_def1546); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS142); } break; default: goto loop90; } } loop90: ; } finally { DebugExitSubRule(90); } DebugLocation(291, 105); PushFollow(Follow._ident_in_class_def1549); ident143=ident(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_ident.Add(ident143.Tree); } break; default: goto loop91; } } loop91: ; } finally { DebugExitSubRule(91); } } break; } } finally { DebugExitSubRule(92); } DebugLocation(291, 115); // SugarCpp.g:291:115: ( ( WS )* ( NEWLINE )+ INDENT ( NEWLINE )* global_block DEDENT )? int alt96=2; try { DebugEnterSubRule(96); try { DebugEnterDecision(96, false); try { alt96 = dfa96.Predict(input); } catch (NoViableAltException nvae) { DebugRecognitionException(nvae); throw; } } finally { DebugExitDecision(96); } switch (alt96) { case 1: DebugEnterAlt(1); // SugarCpp.g:291:116: ( WS )* ( NEWLINE )+ INDENT ( NEWLINE )* global_block DEDENT { DebugLocation(291, 116); // SugarCpp.g:291:116: ( WS )* try { DebugEnterSubRule(93); while (true) { int alt93=2; try { DebugEnterDecision(93, false); int LA93_0 = input.LA(1); if ((LA93_0==WS)) { alt93 = 1; } } finally { DebugExitDecision(93); } switch ( alt93 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:291:116: WS { DebugLocation(291, 116); WS144=(IToken)Match(input,WS,Follow._WS_in_class_def1556); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS144); } break; default: goto loop93; } } loop93: ; } finally { DebugExitSubRule(93); } DebugLocation(291, 120); // SugarCpp.g:291:120: ( NEWLINE )+ int cnt94=0; try { DebugEnterSubRule(94); while (true) { int alt94=2; try { DebugEnterDecision(94, false); int LA94_0 = input.LA(1); if ((LA94_0==NEWLINE)) { alt94 = 1; } } finally { DebugExitDecision(94); } switch (alt94) { case 1: DebugEnterAlt(1); // SugarCpp.g:291:120: NEWLINE { DebugLocation(291, 120); NEWLINE145=(IToken)Match(input,NEWLINE,Follow._NEWLINE_in_class_def1559); if (state.failed) return retval; if (state.backtracking == 0) stream_NEWLINE.Add(NEWLINE145); } break; default: if (cnt94 >= 1) goto loop94; if (state.backtracking>0) {state.failed=true; return retval;} EarlyExitException eee94 = new EarlyExitException( 94, input ); DebugRecognitionException(eee94); throw eee94; } cnt94++; } loop94: ; } finally { DebugExitSubRule(94); } DebugLocation(291, 129); INDENT146=(IToken)Match(input,INDENT,Follow._INDENT_in_class_def1562); if (state.failed) return retval; if (state.backtracking == 0) stream_INDENT.Add(INDENT146); DebugLocation(291, 136); // SugarCpp.g:291:136: ( NEWLINE )* try { DebugEnterSubRule(95); while (true) { int alt95=2; try { DebugEnterDecision(95, false); int LA95_0 = input.LA(1); if ((LA95_0==NEWLINE)) { alt95 = 1; } } finally { DebugExitDecision(95); } switch ( alt95 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:291:136: NEWLINE { DebugLocation(291, 136); NEWLINE147=(IToken)Match(input,NEWLINE,Follow._NEWLINE_in_class_def1564); if (state.failed) return retval; if (state.backtracking == 0) stream_NEWLINE.Add(NEWLINE147); } break; default: goto loop95; } } loop95: ; } finally { DebugExitSubRule(95); } DebugLocation(291, 145); PushFollow(Follow._global_block_in_class_def1567); global_block148=global_block(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_global_block.Add(global_block148.Tree); DebugLocation(291, 158); DEDENT149=(IToken)Match(input,DEDENT,Follow._DEDENT_in_class_def1569); if (state.failed) return retval; if (state.backtracking == 0) stream_DEDENT.Add(DEDENT149); } break; } } finally { DebugExitSubRule(96); } { // AST REWRITE // elements: class_args, generic_parameter, ident, 163, attribute, global_block, ident // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: if (state.backtracking == 0) { retval.Tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null); root_0 = (CommonTree)adaptor.Nil(); // 291:167: -> ^( Class ( 'public' )? ( attribute )? ident ( generic_parameter )? ( class_args )? ( ^( Ident_List ( ident )* ) )? ( global_block )? ) { DebugLocation(291, 170); // SugarCpp.g:291:170: ^( Class ( 'public' )? ( attribute )? ident ( generic_parameter )? ( class_args )? ( ^( Ident_List ( ident )* ) )? ( global_block )? ) { CommonTree root_1 = (CommonTree)adaptor.Nil(); DebugLocation(291, 172); root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(Class, "Class"), root_1); DebugLocation(291, 178); // SugarCpp.g:291:178: ( 'public' )? if (stream_163.HasNext) { DebugLocation(291, 178); adaptor.AddChild(root_1, stream_163.NextNode()); } stream_163.Reset(); DebugLocation(291, 188); // SugarCpp.g:291:188: ( attribute )? if (stream_attribute.HasNext) { DebugLocation(291, 188); adaptor.AddChild(root_1, stream_attribute.NextTree()); } stream_attribute.Reset(); DebugLocation(291, 199); adaptor.AddChild(root_1, stream_ident.NextTree()); DebugLocation(291, 205); // SugarCpp.g:291:205: ( generic_parameter )? if (stream_generic_parameter.HasNext) { DebugLocation(291, 205); adaptor.AddChild(root_1, stream_generic_parameter.NextTree()); } stream_generic_parameter.Reset(); DebugLocation(291, 224); // SugarCpp.g:291:224: ( class_args )? if (stream_class_args.HasNext) { DebugLocation(291, 224); adaptor.AddChild(root_1, stream_class_args.NextTree()); } stream_class_args.Reset(); DebugLocation(291, 236); // SugarCpp.g:291:236: ( ^( Ident_List ( ident )* ) )? if (stream_ident.HasNext) { DebugLocation(291, 237); // SugarCpp.g:291:237: ^( Ident_List ( ident )* ) { CommonTree root_2 = (CommonTree)adaptor.Nil(); DebugLocation(291, 239); root_2 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(Ident_List, "Ident_List"), root_2); DebugLocation(291, 250); // SugarCpp.g:291:250: ( ident )* while ( stream_ident.HasNext ) { DebugLocation(291, 250); adaptor.AddChild(root_2, stream_ident.NextTree()); } stream_ident.Reset(); adaptor.AddChild(root_1, root_2); } } stream_ident.Reset(); DebugLocation(291, 260); // SugarCpp.g:291:260: ( global_block )? if (stream_global_block.HasNext) { DebugLocation(291, 260); adaptor.AddChild(root_1, stream_global_block.NextTree()); } stream_global_block.Reset(); adaptor.AddChild(root_0, root_1); } } retval.Tree = root_0; } } } break; case 2: DebugEnterAlt(2); // SugarCpp.g:292:13: 'case' ( WS )* 'class' ( WS )* ident ( generic_parameter )? ( ( WS )* class_args )? ( ( WS )* ':' ( WS )* ident ( ( WS )* ',' ( WS )* ident )* )? ( ( WS )* ( NEWLINE )+ INDENT ( NEWLINE )* global_block DEDENT )? { DebugLocation(292, 13); string_literal150=(IToken)Match(input,139,Follow._139_in_class_def1618); if (state.failed) return retval; if (state.backtracking == 0) stream_139.Add(string_literal150); DebugLocation(292, 20); // SugarCpp.g:292:20: ( WS )* try { DebugEnterSubRule(97); while (true) { int alt97=2; try { DebugEnterDecision(97, false); int LA97_0 = input.LA(1); if ((LA97_0==WS)) { alt97 = 1; } } finally { DebugExitDecision(97); } switch ( alt97 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:292:20: WS { DebugLocation(292, 20); WS151=(IToken)Match(input,WS,Follow._WS_in_class_def1620); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS151); } break; default: goto loop97; } } loop97: ; } finally { DebugExitSubRule(97); } DebugLocation(292, 24); string_literal152=(IToken)Match(input,141,Follow._141_in_class_def1623); if (state.failed) return retval; if (state.backtracking == 0) stream_141.Add(string_literal152); DebugLocation(292, 32); // SugarCpp.g:292:32: ( WS )* try { DebugEnterSubRule(98); while (true) { int alt98=2; try { DebugEnterDecision(98, false); int LA98_0 = input.LA(1); if ((LA98_0==WS)) { alt98 = 1; } } finally { DebugExitDecision(98); } switch ( alt98 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:292:32: WS { DebugLocation(292, 32); WS153=(IToken)Match(input,WS,Follow._WS_in_class_def1625); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS153); } break; default: goto loop98; } } loop98: ; } finally { DebugExitSubRule(98); } DebugLocation(292, 36); PushFollow(Follow._ident_in_class_def1628); ident154=ident(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_ident.Add(ident154.Tree); DebugLocation(292, 42); // SugarCpp.g:292:42: ( generic_parameter )? int alt99=2; try { DebugEnterSubRule(99); try { DebugEnterDecision(99, false); int LA99_0 = input.LA(1); if ((LA99_0==115)) { alt99 = 1; } } finally { DebugExitDecision(99); } switch (alt99) { case 1: DebugEnterAlt(1); // SugarCpp.g:292:43: generic_parameter { DebugLocation(292, 43); PushFollow(Follow._generic_parameter_in_class_def1631); generic_parameter155=generic_parameter(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_generic_parameter.Add(generic_parameter155.Tree); } break; } } finally { DebugExitSubRule(99); } DebugLocation(292, 63); // SugarCpp.g:292:63: ( ( WS )* class_args )? int alt101=2; try { DebugEnterSubRule(101); try { DebugEnterDecision(101, false); try { alt101 = dfa101.Predict(input); } catch (NoViableAltException nvae) { DebugRecognitionException(nvae); throw; } } finally { DebugExitDecision(101); } switch (alt101) { case 1: DebugEnterAlt(1); // SugarCpp.g:292:64: ( WS )* class_args { DebugLocation(292, 64); // SugarCpp.g:292:64: ( WS )* try { DebugEnterSubRule(100); while (true) { int alt100=2; try { DebugEnterDecision(100, false); int LA100_0 = input.LA(1); if ((LA100_0==WS)) { alt100 = 1; } } finally { DebugExitDecision(100); } switch ( alt100 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:292:64: WS { DebugLocation(292, 64); WS156=(IToken)Match(input,WS,Follow._WS_in_class_def1636); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS156); } break; default: goto loop100; } } loop100: ; } finally { DebugExitSubRule(100); } DebugLocation(292, 68); PushFollow(Follow._class_args_in_class_def1639); class_args157=class_args(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_class_args.Add(class_args157.Tree); } break; } } finally { DebugExitSubRule(101); } DebugLocation(292, 81); // SugarCpp.g:292:81: ( ( WS )* ':' ( WS )* ident ( ( WS )* ',' ( WS )* ident )* )? int alt107=2; try { DebugEnterSubRule(107); try { DebugEnterDecision(107, false); try { alt107 = dfa107.Predict(input); } catch (NoViableAltException nvae) { DebugRecognitionException(nvae); throw; } } finally { DebugExitDecision(107); } switch (alt107) { case 1: DebugEnterAlt(1); // SugarCpp.g:292:82: ( WS )* ':' ( WS )* ident ( ( WS )* ',' ( WS )* ident )* { DebugLocation(292, 82); // SugarCpp.g:292:82: ( WS )* try { DebugEnterSubRule(102); while (true) { int alt102=2; try { DebugEnterDecision(102, false); int LA102_0 = input.LA(1); if ((LA102_0==WS)) { alt102 = 1; } } finally { DebugExitDecision(102); } switch ( alt102 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:292:82: WS { DebugLocation(292, 82); WS158=(IToken)Match(input,WS,Follow._WS_in_class_def1644); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS158); } break; default: goto loop102; } } loop102: ; } finally { DebugExitSubRule(102); } DebugLocation(292, 86); char_literal159=(IToken)Match(input,111,Follow._111_in_class_def1647); if (state.failed) return retval; if (state.backtracking == 0) stream_111.Add(char_literal159); DebugLocation(292, 90); // SugarCpp.g:292:90: ( WS )* try { DebugEnterSubRule(103); while (true) { int alt103=2; try { DebugEnterDecision(103, false); int LA103_0 = input.LA(1); if ((LA103_0==WS)) { alt103 = 1; } } finally { DebugExitDecision(103); } switch ( alt103 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:292:90: WS { DebugLocation(292, 90); WS160=(IToken)Match(input,WS,Follow._WS_in_class_def1649); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS160); } break; default: goto loop103; } } loop103: ; } finally { DebugExitSubRule(103); } DebugLocation(292, 94); PushFollow(Follow._ident_in_class_def1652); ident161=ident(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_ident.Add(ident161.Tree); DebugLocation(292, 100); // SugarCpp.g:292:100: ( ( WS )* ',' ( WS )* ident )* try { DebugEnterSubRule(106); while (true) { int alt106=2; try { DebugEnterDecision(106, false); try { alt106 = dfa106.Predict(input); } catch (NoViableAltException nvae) { DebugRecognitionException(nvae); throw; } } finally { DebugExitDecision(106); } switch ( alt106 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:292:101: ( WS )* ',' ( WS )* ident { DebugLocation(292, 101); // SugarCpp.g:292:101: ( WS )* try { DebugEnterSubRule(104); while (true) { int alt104=2; try { DebugEnterDecision(104, false); int LA104_0 = input.LA(1); if ((LA104_0==WS)) { alt104 = 1; } } finally { DebugExitDecision(104); } switch ( alt104 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:292:101: WS { DebugLocation(292, 101); WS162=(IToken)Match(input,WS,Follow._WS_in_class_def1655); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS162); } break; default: goto loop104; } } loop104: ; } finally { DebugExitSubRule(104); } DebugLocation(292, 105); char_literal163=(IToken)Match(input,100,Follow._100_in_class_def1658); if (state.failed) return retval; if (state.backtracking == 0) stream_100.Add(char_literal163); DebugLocation(292, 109); // SugarCpp.g:292:109: ( WS )* try { DebugEnterSubRule(105); while (true) { int alt105=2; try { DebugEnterDecision(105, false); int LA105_0 = input.LA(1); if ((LA105_0==WS)) { alt105 = 1; } } finally { DebugExitDecision(105); } switch ( alt105 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:292:109: WS { DebugLocation(292, 109); WS164=(IToken)Match(input,WS,Follow._WS_in_class_def1660); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS164); } break; default: goto loop105; } } loop105: ; } finally { DebugExitSubRule(105); } DebugLocation(292, 113); PushFollow(Follow._ident_in_class_def1663); ident165=ident(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_ident.Add(ident165.Tree); } break; default: goto loop106; } } loop106: ; } finally { DebugExitSubRule(106); } } break; } } finally { DebugExitSubRule(107); } DebugLocation(292, 123); // SugarCpp.g:292:123: ( ( WS )* ( NEWLINE )+ INDENT ( NEWLINE )* global_block DEDENT )? int alt111=2; try { DebugEnterSubRule(111); try { DebugEnterDecision(111, false); try { alt111 = dfa111.Predict(input); } catch (NoViableAltException nvae) { DebugRecognitionException(nvae); throw; } } finally { DebugExitDecision(111); } switch (alt111) { case 1: DebugEnterAlt(1); // SugarCpp.g:292:124: ( WS )* ( NEWLINE )+ INDENT ( NEWLINE )* global_block DEDENT { DebugLocation(292, 124); // SugarCpp.g:292:124: ( WS )* try { DebugEnterSubRule(108); while (true) { int alt108=2; try { DebugEnterDecision(108, false); int LA108_0 = input.LA(1); if ((LA108_0==WS)) { alt108 = 1; } } finally { DebugExitDecision(108); } switch ( alt108 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:292:124: WS { DebugLocation(292, 124); WS166=(IToken)Match(input,WS,Follow._WS_in_class_def1670); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS166); } break; default: goto loop108; } } loop108: ; } finally { DebugExitSubRule(108); } DebugLocation(292, 128); // SugarCpp.g:292:128: ( NEWLINE )+ int cnt109=0; try { DebugEnterSubRule(109); while (true) { int alt109=2; try { DebugEnterDecision(109, false); int LA109_0 = input.LA(1); if ((LA109_0==NEWLINE)) { alt109 = 1; } } finally { DebugExitDecision(109); } switch (alt109) { case 1: DebugEnterAlt(1); // SugarCpp.g:292:128: NEWLINE { DebugLocation(292, 128); NEWLINE167=(IToken)Match(input,NEWLINE,Follow._NEWLINE_in_class_def1673); if (state.failed) return retval; if (state.backtracking == 0) stream_NEWLINE.Add(NEWLINE167); } break; default: if (cnt109 >= 1) goto loop109; if (state.backtracking>0) {state.failed=true; return retval;} EarlyExitException eee109 = new EarlyExitException( 109, input ); DebugRecognitionException(eee109); throw eee109; } cnt109++; } loop109: ; } finally { DebugExitSubRule(109); } DebugLocation(292, 137); INDENT168=(IToken)Match(input,INDENT,Follow._INDENT_in_class_def1676); if (state.failed) return retval; if (state.backtracking == 0) stream_INDENT.Add(INDENT168); DebugLocation(292, 144); // SugarCpp.g:292:144: ( NEWLINE )* try { DebugEnterSubRule(110); while (true) { int alt110=2; try { DebugEnterDecision(110, false); int LA110_0 = input.LA(1); if ((LA110_0==NEWLINE)) { alt110 = 1; } } finally { DebugExitDecision(110); } switch ( alt110 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:292:144: NEWLINE { DebugLocation(292, 144); NEWLINE169=(IToken)Match(input,NEWLINE,Follow._NEWLINE_in_class_def1678); if (state.failed) return retval; if (state.backtracking == 0) stream_NEWLINE.Add(NEWLINE169); } break; default: goto loop110; } } loop110: ; } finally { DebugExitSubRule(110); } DebugLocation(292, 153); PushFollow(Follow._global_block_in_class_def1681); global_block170=global_block(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_global_block.Add(global_block170.Tree); DebugLocation(292, 166); DEDENT171=(IToken)Match(input,DEDENT,Follow._DEDENT_in_class_def1683); if (state.failed) return retval; if (state.backtracking == 0) stream_DEDENT.Add(DEDENT171); } break; } } finally { DebugExitSubRule(111); } { // AST REWRITE // elements: ident, attribute, generic_parameter, 163, global_block, 139, class_args, ident // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: if (state.backtracking == 0) { retval.Tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null); root_0 = (CommonTree)adaptor.Nil(); // 292:175: -> ^( Class 'case' ( 'public' )? ( attribute )? ident ( generic_parameter )? ( class_args )? ( ^( Ident_List ( ident )* ) )? ( global_block )? ) { DebugLocation(292, 178); // SugarCpp.g:292:178: ^( Class 'case' ( 'public' )? ( attribute )? ident ( generic_parameter )? ( class_args )? ( ^( Ident_List ( ident )* ) )? ( global_block )? ) { CommonTree root_1 = (CommonTree)adaptor.Nil(); DebugLocation(292, 180); root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(Class, "Class"), root_1); DebugLocation(292, 186); adaptor.AddChild(root_1, stream_139.NextNode()); DebugLocation(292, 193); // SugarCpp.g:292:193: ( 'public' )? if (stream_163.HasNext) { DebugLocation(292, 193); adaptor.AddChild(root_1, stream_163.NextNode()); } stream_163.Reset(); DebugLocation(292, 203); // SugarCpp.g:292:203: ( attribute )? if (stream_attribute.HasNext) { DebugLocation(292, 203); adaptor.AddChild(root_1, stream_attribute.NextTree()); } stream_attribute.Reset(); DebugLocation(292, 214); adaptor.AddChild(root_1, stream_ident.NextTree()); DebugLocation(292, 220); // SugarCpp.g:292:220: ( generic_parameter )? if (stream_generic_parameter.HasNext) { DebugLocation(292, 220); adaptor.AddChild(root_1, stream_generic_parameter.NextTree()); } stream_generic_parameter.Reset(); DebugLocation(292, 239); // SugarCpp.g:292:239: ( class_args )? if (stream_class_args.HasNext) { DebugLocation(292, 239); adaptor.AddChild(root_1, stream_class_args.NextTree()); } stream_class_args.Reset(); DebugLocation(292, 251); // SugarCpp.g:292:251: ( ^( Ident_List ( ident )* ) )? if (stream_ident.HasNext) { DebugLocation(292, 252); // SugarCpp.g:292:252: ^( Ident_List ( ident )* ) { CommonTree root_2 = (CommonTree)adaptor.Nil(); DebugLocation(292, 254); root_2 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(Ident_List, "Ident_List"), root_2); DebugLocation(292, 265); // SugarCpp.g:292:265: ( ident )* while ( stream_ident.HasNext ) { DebugLocation(292, 265); adaptor.AddChild(root_2, stream_ident.NextTree()); } stream_ident.Reset(); adaptor.AddChild(root_1, root_2); } } stream_ident.Reset(); DebugLocation(292, 275); // SugarCpp.g:292:275: ( global_block )? if (stream_global_block.HasNext) { DebugLocation(292, 275); adaptor.AddChild(root_1, stream_global_block.NextTree()); } stream_global_block.Reset(); adaptor.AddChild(root_0, root_1); } } retval.Tree = root_0; } } } break; } } finally { DebugExitSubRule(112); } } retval.Stop = (IToken)input.LT(-1); if (state.backtracking == 0) { retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0); adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop); } } catch (RecognitionException re) { ReportError(re); Recover(input,re); retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re); } finally { TraceOut("class_def", 15); LeaveRule("class_def", 15); LeaveRule_class_def(); } DebugLocation(294, 1); } finally { DebugExitRule(GrammarFileName, "class_def"); } return retval; }
// $ANTLR start "functionCall" // C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:255:1: functionCall : x= ID '(' ( expression ( ',' expression )* )? ')' -> ^( FUNCTION[$x] ( expression )* ) ; public functionCall_return functionCall() // throws RecognitionException [1] { var retval = new functionCall_return(); retval.Start = input.LT( 1 ); CommonTree root_0 = null; IToken x = null; IToken char_literal87 = null; IToken char_literal89 = null; IToken char_literal91 = null; expression_return expression88 = default( expression_return ); expression_return expression90 = default( expression_return ); CommonTree x_tree = null; CommonTree char_literal87_tree = null; CommonTree char_literal89_tree = null; CommonTree char_literal91_tree = null; var stream_69 = new RewriteRuleTokenStream( adaptor, "token 69" ); var stream_94 = new RewriteRuleTokenStream( adaptor, "token 94" ); var stream_ID = new RewriteRuleTokenStream( adaptor, "token ID" ); var stream_70 = new RewriteRuleTokenStream( adaptor, "token 70" ); var stream_expression = new RewriteRuleSubtreeStream( adaptor, "rule expression" ); try { // C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:256:2: (x= ID '(' ( expression ( ',' expression )* )? ')' -> ^( FUNCTION[$x] ( expression )* ) ) // C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:256:4: x= ID '(' ( expression ( ',' expression )* )? ')' { x = (IToken)Match( input, ID, FOLLOW_ID_in_functionCall1352 ); stream_ID.Add( x ); char_literal87 = (IToken)Match( input, 69, FOLLOW_69_in_functionCall1354 ); stream_69.Add( char_literal87 ); // C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:256:13: ( expression ( ',' expression )* )? int alt33 = 2; int LA33_0 = input.LA( 1 ); if ( ( ( LA33_0 >= ID && LA33_0 <= FLOAT ) || LA33_0 == 69 || ( LA33_0 >= 71 && LA33_0 <= 72 ) || LA33_0 == 87 || LA33_0 == 91 || ( LA33_0 >= 95 && LA33_0 <= 96 ) ) ) alt33 = 1; switch ( alt33 ) { case 1: // C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:256:15: expression ( ',' expression )* { PushFollow( FOLLOW_expression_in_functionCall1358 ); expression88 = expression(); state.followingStackPointer--; stream_expression.Add( expression88.Tree ); // C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:256:26: ( ',' expression )* do { int alt32 = 2; int LA32_0 = input.LA( 1 ); if ( ( LA32_0 == 94 ) ) alt32 = 1; switch ( alt32 ) { case 1: // C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:256:28: ',' expression { char_literal89 = (IToken)Match( input, 94, FOLLOW_94_in_functionCall1362 ); stream_94.Add( char_literal89 ); PushFollow( FOLLOW_expression_in_functionCall1364 ); expression90 = expression(); state.followingStackPointer--; stream_expression.Add( expression90.Tree ); } break; default: goto loop32; } } while ( true ); loop32: ; // Stops C# compiler whining that label 'loop32' has no statements } break; } char_literal91 = (IToken)Match( input, 70, FOLLOW_70_in_functionCall1372 ); stream_70.Add( char_literal91 ); // AST REWRITE // elements: expression // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: retval.Tree = root_0; var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null ); root_0 = (CommonTree)adaptor.GetNilNode(); // 256:53: -> ^( FUNCTION[$x] ( expression )* ) { // C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:256:56: ^( FUNCTION[$x] ( expression )* ) { var root_1 = (CommonTree)adaptor.GetNilNode(); root_1 = (CommonTree)adaptor.BecomeRoot( adaptor.Create( FUNCTION, x ), root_1 ); // C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:256:72: ( expression )* while ( stream_expression.HasNext() ) adaptor.AddChild( root_1, stream_expression.NextTree() ); stream_expression.Reset(); adaptor.AddChild( root_0, root_1 ); } } retval.Tree = root_0; retval.Tree = root_0; } retval.Stop = input.LT( -1 ); retval.Tree = adaptor.RulePostProcessing( root_0 ); adaptor.SetTokenBoundaries( retval.Tree, (IToken)retval.Start, (IToken)retval.Stop ); } catch ( RecognitionException re ) { ReportError( re ); Recover( input, re ); // Conversion of the second argument necessary, but harmless retval.Tree = adaptor.ErrorNode( input, (IToken)retval.Start, input.LT( -1 ), re ); } finally {} return retval; }
private AstParserRuleReturnScope<CommonTree, IToken> type_list() { EnterRule_type_list(); EnterRule("type_list", 16); TraceIn("type_list", 16); AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>(); retval.Start = (IToken)input.LT(1); CommonTree root_0 = default(CommonTree); IToken WS173 = default(IToken); IToken char_literal174 = default(IToken); IToken WS175 = default(IToken); AstParserRuleReturnScope<CommonTree, IToken> type_name172 = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> type_name176 = default(AstParserRuleReturnScope<CommonTree, IToken>); CommonTree WS173_tree = default(CommonTree); CommonTree char_literal174_tree = default(CommonTree); CommonTree WS175_tree = default(CommonTree); RewriteRuleITokenStream stream_WS=new RewriteRuleITokenStream(adaptor,"token WS"); RewriteRuleITokenStream stream_100=new RewriteRuleITokenStream(adaptor,"token 100"); RewriteRuleSubtreeStream stream_type_name=new RewriteRuleSubtreeStream(adaptor,"rule type_name"); try { DebugEnterRule(GrammarFileName, "type_list"); DebugLocation(296, 1); try { // SugarCpp.g:297:2: ( type_name ( ( WS )* ',' ( WS )* type_name )* -> ^( Type_List ( type_name )* ) ) DebugEnterAlt(1); // SugarCpp.g:297:4: type_name ( ( WS )* ',' ( WS )* type_name )* { DebugLocation(297, 4); PushFollow(Follow._type_name_in_type_list1743); type_name172=type_name(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_type_name.Add(type_name172.Tree); DebugLocation(297, 14); // SugarCpp.g:297:14: ( ( WS )* ',' ( WS )* type_name )* try { DebugEnterSubRule(115); while (true) { int alt115=2; try { DebugEnterDecision(115, false); try { alt115 = dfa115.Predict(input); } catch (NoViableAltException nvae) { DebugRecognitionException(nvae); throw; } } finally { DebugExitDecision(115); } switch ( alt115 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:297:15: ( WS )* ',' ( WS )* type_name { DebugLocation(297, 15); // SugarCpp.g:297:15: ( WS )* try { DebugEnterSubRule(113); while (true) { int alt113=2; try { DebugEnterDecision(113, false); int LA113_0 = input.LA(1); if ((LA113_0==WS)) { alt113 = 1; } } finally { DebugExitDecision(113); } switch ( alt113 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:297:15: WS { DebugLocation(297, 15); WS173=(IToken)Match(input,WS,Follow._WS_in_type_list1746); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS173); } break; default: goto loop113; } } loop113: ; } finally { DebugExitSubRule(113); } DebugLocation(297, 19); char_literal174=(IToken)Match(input,100,Follow._100_in_type_list1749); if (state.failed) return retval; if (state.backtracking == 0) stream_100.Add(char_literal174); DebugLocation(297, 24); // SugarCpp.g:297:24: ( WS )* try { DebugEnterSubRule(114); while (true) { int alt114=2; try { DebugEnterDecision(114, false); int LA114_0 = input.LA(1); if ((LA114_0==WS)) { alt114 = 1; } } finally { DebugExitDecision(114); } switch ( alt114 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:297:24: WS { DebugLocation(297, 24); WS175=(IToken)Match(input,WS,Follow._WS_in_type_list1752); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS175); } break; default: goto loop114; } } loop114: ; } finally { DebugExitSubRule(114); } DebugLocation(297, 28); PushFollow(Follow._type_name_in_type_list1755); type_name176=type_name(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_type_name.Add(type_name176.Tree); } break; default: goto loop115; } } loop115: ; } finally { DebugExitSubRule(115); } { // AST REWRITE // elements: type_name // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: if (state.backtracking == 0) { retval.Tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null); root_0 = (CommonTree)adaptor.Nil(); // 297:40: -> ^( Type_List ( type_name )* ) { DebugLocation(297, 43); // SugarCpp.g:297:43: ^( Type_List ( type_name )* ) { CommonTree root_1 = (CommonTree)adaptor.Nil(); DebugLocation(297, 45); root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(Type_List, "Type_List"), root_1); DebugLocation(297, 55); // SugarCpp.g:297:55: ( type_name )* while ( stream_type_name.HasNext ) { DebugLocation(297, 55); adaptor.AddChild(root_1, stream_type_name.NextTree()); } stream_type_name.Reset(); adaptor.AddChild(root_0, root_1); } } retval.Tree = root_0; } } } retval.Stop = (IToken)input.LT(-1); if (state.backtracking == 0) { retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0); adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop); } } catch (RecognitionException re) { ReportError(re); Recover(input,re); retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re); } finally { TraceOut("type_list", 16); LeaveRule("type_list", 16); LeaveRule_type_list(); } DebugLocation(298, 1); } finally { DebugExitRule(GrammarFileName, "type_list"); } return retval; }
// $ANTLR start "propertyDeclaration" // C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:97:1: propertyDeclaration : 'property' name ( propertyModifiers )? ';' -> ^( PROPERTY name ( propertyModifiers )? ) ; public propertyDeclaration_return propertyDeclaration() // throws RecognitionException [1] { var retval = new propertyDeclaration_return(); retval.Start = input.LT( 1 ); CommonTree root_0 = null; IToken string_literal17 = null; IToken char_literal20 = null; name_return name18 = default( name_return ); propertyModifiers_return propertyModifiers19 = default( propertyModifiers_return ); CommonTree string_literal17_tree = null; CommonTree char_literal20_tree = null; var stream_62 = new RewriteRuleTokenStream( adaptor, "token 62" ); var stream_63 = new RewriteRuleTokenStream( adaptor, "token 63" ); var stream_propertyModifiers = new RewriteRuleSubtreeStream( adaptor, "rule propertyModifiers" ); var stream_name = new RewriteRuleSubtreeStream( adaptor, "rule name" ); try { // C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:98:2: ( 'property' name ( propertyModifiers )? ';' -> ^( PROPERTY name ( propertyModifiers )? ) ) // C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:98:4: 'property' name ( propertyModifiers )? ';' { string_literal17 = (IToken)Match( input, 62, FOLLOW_62_in_propertyDeclaration389 ); stream_62.Add( string_literal17 ); PushFollow( FOLLOW_name_in_propertyDeclaration391 ); name18 = name(); state.followingStackPointer--; stream_name.Add( name18.Tree ); // C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:98:20: ( propertyModifiers )? int alt6 = 2; int LA6_0 = input.LA( 1 ); if ( ( ( LA6_0 >= 64 && LA6_0 <= 66 ) ) ) alt6 = 1; switch ( alt6 ) { case 1: // C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:98:20: propertyModifiers { PushFollow( FOLLOW_propertyModifiers_in_propertyDeclaration393 ); propertyModifiers19 = propertyModifiers(); state.followingStackPointer--; stream_propertyModifiers.Add( propertyModifiers19.Tree ); } break; } char_literal20 = (IToken)Match( input, 63, FOLLOW_63_in_propertyDeclaration396 ); stream_63.Add( char_literal20 ); // AST REWRITE // elements: name, propertyModifiers // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: retval.Tree = root_0; var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null ); root_0 = (CommonTree)adaptor.GetNilNode(); // 98:43: -> ^( PROPERTY name ( propertyModifiers )? ) { // C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:98:46: ^( PROPERTY name ( propertyModifiers )? ) { var root_1 = (CommonTree)adaptor.GetNilNode(); root_1 = (CommonTree)adaptor.BecomeRoot( adaptor.Create( PROPERTY, "PROPERTY" ), root_1 ); adaptor.AddChild( root_1, stream_name.NextTree() ); // C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:98:63: ( propertyModifiers )? if ( stream_propertyModifiers.HasNext() ) adaptor.AddChild( root_1, stream_propertyModifiers.NextTree() ); stream_propertyModifiers.Reset(); adaptor.AddChild( root_0, root_1 ); } } retval.Tree = root_0; retval.Tree = root_0; } retval.Stop = input.LT( -1 ); retval.Tree = adaptor.RulePostProcessing( root_0 ); adaptor.SetTokenBoundaries( retval.Tree, (IToken)retval.Start, (IToken)retval.Stop ); } catch ( RecognitionException re ) { ReportError( re ); Recover( input, re ); // Conversion of the second argument necessary, but harmless retval.Tree = adaptor.ErrorNode( input, (IToken)retval.Start, input.LT( -1 ), re ); } finally {} return retval; }
private AstParserRuleReturnScope<CommonTree, IToken> let_expr() { EnterRule_let_expr(); EnterRule("let_expr", 60); TraceIn("let_expr", 60); AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>(); retval.Start = (IToken)input.LT(1); CommonTree root_0 = default(CommonTree); IToken string_literal609 = default(IToken); IToken WS610 = default(IToken); IToken WS612 = default(IToken); IToken string_literal613 = default(IToken); IToken WS614 = default(IToken); IToken WS616 = default(IToken); IToken NEWLINE617 = default(IToken); IToken INDENT618 = default(IToken); IToken NEWLINE619 = default(IToken); IToken WS621 = default(IToken); IToken NEWLINE622 = default(IToken); IToken DEDENT623 = default(IToken); IToken WS624 = default(IToken); IToken WS626 = default(IToken); IToken NEWLINE627 = default(IToken); IToken INDENT628 = default(IToken); IToken NEWLINE629 = default(IToken); IToken WS631 = default(IToken); IToken NEWLINE632 = default(IToken); IToken WS633 = default(IToken); IToken string_literal634 = default(IToken); IToken WS635 = default(IToken); IToken WS637 = default(IToken); IToken NEWLINE638 = default(IToken); IToken DEDENT639 = default(IToken); AstParserRuleReturnScope<CommonTree, IToken> where_item611 = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> expr615 = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> expr620 = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> expr625 = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> where_item630 = default(AstParserRuleReturnScope<CommonTree, IToken>); AstParserRuleReturnScope<CommonTree, IToken> expr636 = default(AstParserRuleReturnScope<CommonTree, IToken>); CommonTree string_literal609_tree = default(CommonTree); CommonTree WS610_tree = default(CommonTree); CommonTree WS612_tree = default(CommonTree); CommonTree string_literal613_tree = default(CommonTree); CommonTree WS614_tree = default(CommonTree); CommonTree WS616_tree = default(CommonTree); CommonTree NEWLINE617_tree = default(CommonTree); CommonTree INDENT618_tree = default(CommonTree); CommonTree NEWLINE619_tree = default(CommonTree); CommonTree WS621_tree = default(CommonTree); CommonTree NEWLINE622_tree = default(CommonTree); CommonTree DEDENT623_tree = default(CommonTree); CommonTree WS624_tree = default(CommonTree); CommonTree WS626_tree = default(CommonTree); CommonTree NEWLINE627_tree = default(CommonTree); CommonTree INDENT628_tree = default(CommonTree); CommonTree NEWLINE629_tree = default(CommonTree); CommonTree WS631_tree = default(CommonTree); CommonTree NEWLINE632_tree = default(CommonTree); CommonTree WS633_tree = default(CommonTree); CommonTree string_literal634_tree = default(CommonTree); CommonTree WS635_tree = default(CommonTree); CommonTree WS637_tree = default(CommonTree); CommonTree NEWLINE638_tree = default(CommonTree); CommonTree DEDENT639_tree = default(CommonTree); RewriteRuleITokenStream stream_152=new RewriteRuleITokenStream(adaptor,"token 152"); RewriteRuleITokenStream stream_WS=new RewriteRuleITokenStream(adaptor,"token WS"); RewriteRuleITokenStream stream_DEDENT=new RewriteRuleITokenStream(adaptor,"token DEDENT"); RewriteRuleITokenStream stream_NEWLINE=new RewriteRuleITokenStream(adaptor,"token NEWLINE"); RewriteRuleITokenStream stream_INDENT=new RewriteRuleITokenStream(adaptor,"token INDENT"); RewriteRuleITokenStream stream_155=new RewriteRuleITokenStream(adaptor,"token 155"); RewriteRuleSubtreeStream stream_where_item=new RewriteRuleSubtreeStream(adaptor,"rule where_item"); RewriteRuleSubtreeStream stream_expr=new RewriteRuleSubtreeStream(adaptor,"rule expr"); try { DebugEnterRule(GrammarFileName, "let_expr"); DebugLocation(546, 1); try { // SugarCpp.g:547:2: ( 'let' ( WS )* where_item ( ( WS )* 'in' ( ( WS )* expr -> ^( Expr_Where expr ( where_item )+ ) | ( WS )* ( NEWLINE )+ ( INDENT ( NEWLINE )* expr ( WS )* ( NEWLINE )+ DEDENT -> ^( Expr_Where expr ( where_item )+ ) | ( WS )* expr -> ^( Expr_Where expr ( where_item )+ ) ) ) | ( WS )* ( NEWLINE )+ INDENT ( NEWLINE )* ( where_item ( WS )* ( NEWLINE )+ )+ ( WS )* 'in' ( WS )* expr ( WS )* ( NEWLINE )+ DEDENT -> ^( Expr_Where expr ( where_item )+ ) ) ) DebugEnterAlt(1); // SugarCpp.g:547:4: 'let' ( WS )* where_item ( ( WS )* 'in' ( ( WS )* expr -> ^( Expr_Where expr ( where_item )+ ) | ( WS )* ( NEWLINE )+ ( INDENT ( NEWLINE )* expr ( WS )* ( NEWLINE )+ DEDENT -> ^( Expr_Where expr ( where_item )+ ) | ( WS )* expr -> ^( Expr_Where expr ( where_item )+ ) ) ) | ( WS )* ( NEWLINE )+ INDENT ( NEWLINE )* ( where_item ( WS )* ( NEWLINE )+ )+ ( WS )* 'in' ( WS )* expr ( WS )* ( NEWLINE )+ DEDENT -> ^( Expr_Where expr ( where_item )+ ) ) { DebugLocation(547, 4); string_literal609=(IToken)Match(input,155,Follow._155_in_let_expr5642); if (state.failed) return retval; if (state.backtracking == 0) stream_155.Add(string_literal609); DebugLocation(547, 10); // SugarCpp.g:547:10: ( WS )* try { DebugEnterSubRule(394); while (true) { int alt394=2; try { DebugEnterDecision(394, false); int LA394_0 = input.LA(1); if ((LA394_0==WS)) { alt394 = 1; } } finally { DebugExitDecision(394); } switch ( alt394 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:547:10: WS { DebugLocation(547, 10); WS610=(IToken)Match(input,WS,Follow._WS_in_let_expr5644); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS610); } break; default: goto loop394; } } loop394: ; } finally { DebugExitSubRule(394); } DebugLocation(547, 14); PushFollow(Follow._where_item_in_let_expr5647); where_item611=where_item(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_where_item.Add(where_item611.Tree); DebugLocation(547, 25); // SugarCpp.g:547:25: ( ( WS )* 'in' ( ( WS )* expr -> ^( Expr_Where expr ( where_item )+ ) | ( WS )* ( NEWLINE )+ ( INDENT ( NEWLINE )* expr ( WS )* ( NEWLINE )+ DEDENT -> ^( Expr_Where expr ( where_item )+ ) | ( WS )* expr -> ^( Expr_Where expr ( where_item )+ ) ) ) | ( WS )* ( NEWLINE )+ INDENT ( NEWLINE )* ( where_item ( WS )* ( NEWLINE )+ )+ ( WS )* 'in' ( WS )* expr ( WS )* ( NEWLINE )+ DEDENT -> ^( Expr_Where expr ( where_item )+ ) ) int alt415=2; try { DebugEnterSubRule(415); try { DebugEnterDecision(415, false); try { alt415 = dfa415.Predict(input); } catch (NoViableAltException nvae) { DebugRecognitionException(nvae); throw; } } finally { DebugExitDecision(415); } switch (alt415) { case 1: DebugEnterAlt(1); // SugarCpp.g:547:27: ( WS )* 'in' ( ( WS )* expr -> ^( Expr_Where expr ( where_item )+ ) | ( WS )* ( NEWLINE )+ ( INDENT ( NEWLINE )* expr ( WS )* ( NEWLINE )+ DEDENT -> ^( Expr_Where expr ( where_item )+ ) | ( WS )* expr -> ^( Expr_Where expr ( where_item )+ ) ) ) { DebugLocation(547, 27); // SugarCpp.g:547:27: ( WS )* try { DebugEnterSubRule(395); while (true) { int alt395=2; try { DebugEnterDecision(395, false); int LA395_0 = input.LA(1); if ((LA395_0==WS)) { alt395 = 1; } } finally { DebugExitDecision(395); } switch ( alt395 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:547:27: WS { DebugLocation(547, 27); WS612=(IToken)Match(input,WS,Follow._WS_in_let_expr5651); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS612); } break; default: goto loop395; } } loop395: ; } finally { DebugExitSubRule(395); } DebugLocation(547, 31); string_literal613=(IToken)Match(input,152,Follow._152_in_let_expr5654); if (state.failed) return retval; if (state.backtracking == 0) stream_152.Add(string_literal613); DebugLocation(547, 36); // SugarCpp.g:547:36: ( ( WS )* expr -> ^( Expr_Where expr ( where_item )+ ) | ( WS )* ( NEWLINE )+ ( INDENT ( NEWLINE )* expr ( WS )* ( NEWLINE )+ DEDENT -> ^( Expr_Where expr ( where_item )+ ) | ( WS )* expr -> ^( Expr_Where expr ( where_item )+ ) ) ) int alt404=2; try { DebugEnterSubRule(404); try { DebugEnterDecision(404, false); try { alt404 = dfa404.Predict(input); } catch (NoViableAltException nvae) { DebugRecognitionException(nvae); throw; } } finally { DebugExitDecision(404); } switch (alt404) { case 1: DebugEnterAlt(1); // SugarCpp.g:547:38: ( WS )* expr { DebugLocation(547, 38); // SugarCpp.g:547:38: ( WS )* try { DebugEnterSubRule(396); while (true) { int alt396=2; try { DebugEnterDecision(396, false); int LA396_0 = input.LA(1); if ((LA396_0==WS)) { alt396 = 1; } } finally { DebugExitDecision(396); } switch ( alt396 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:547:38: WS { DebugLocation(547, 38); WS614=(IToken)Match(input,WS,Follow._WS_in_let_expr5658); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS614); } break; default: goto loop396; } } loop396: ; } finally { DebugExitSubRule(396); } DebugLocation(547, 42); PushFollow(Follow._expr_in_let_expr5661); expr615=expr(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_expr.Add(expr615.Tree); { // AST REWRITE // elements: expr, where_item // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: if (state.backtracking == 0) { retval.Tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null); root_0 = (CommonTree)adaptor.Nil(); // 547:47: -> ^( Expr_Where expr ( where_item )+ ) { DebugLocation(547, 50); // SugarCpp.g:547:50: ^( Expr_Where expr ( where_item )+ ) { CommonTree root_1 = (CommonTree)adaptor.Nil(); DebugLocation(547, 52); root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(Expr_Where, "Expr_Where"), root_1); DebugLocation(547, 63); adaptor.AddChild(root_1, stream_expr.NextTree()); DebugLocation(547, 68); if (!(stream_where_item.HasNext)) { throw new RewriteEarlyExitException(); } while ( stream_where_item.HasNext ) { DebugLocation(547, 68); adaptor.AddChild(root_1, stream_where_item.NextTree()); } stream_where_item.Reset(); adaptor.AddChild(root_0, root_1); } } retval.Tree = root_0; } } } break; case 2: DebugEnterAlt(2); // SugarCpp.g:548:20: ( WS )* ( NEWLINE )+ ( INDENT ( NEWLINE )* expr ( WS )* ( NEWLINE )+ DEDENT -> ^( Expr_Where expr ( where_item )+ ) | ( WS )* expr -> ^( Expr_Where expr ( where_item )+ ) ) { DebugLocation(548, 20); // SugarCpp.g:548:20: ( WS )* try { DebugEnterSubRule(397); while (true) { int alt397=2; try { DebugEnterDecision(397, false); int LA397_0 = input.LA(1); if ((LA397_0==WS)) { alt397 = 1; } } finally { DebugExitDecision(397); } switch ( alt397 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:548:20: WS { DebugLocation(548, 20); WS616=(IToken)Match(input,WS,Follow._WS_in_let_expr5693); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS616); } break; default: goto loop397; } } loop397: ; } finally { DebugExitSubRule(397); } DebugLocation(548, 24); // SugarCpp.g:548:24: ( NEWLINE )+ int cnt398=0; try { DebugEnterSubRule(398); while (true) { int alt398=2; try { DebugEnterDecision(398, false); int LA398_0 = input.LA(1); if ((LA398_0==NEWLINE)) { alt398 = 1; } } finally { DebugExitDecision(398); } switch (alt398) { case 1: DebugEnterAlt(1); // SugarCpp.g:548:24: NEWLINE { DebugLocation(548, 24); NEWLINE617=(IToken)Match(input,NEWLINE,Follow._NEWLINE_in_let_expr5696); if (state.failed) return retval; if (state.backtracking == 0) stream_NEWLINE.Add(NEWLINE617); } break; default: if (cnt398 >= 1) goto loop398; if (state.backtracking>0) {state.failed=true; return retval;} EarlyExitException eee398 = new EarlyExitException( 398, input ); DebugRecognitionException(eee398); throw eee398; } cnt398++; } loop398: ; } finally { DebugExitSubRule(398); } DebugLocation(548, 33); // SugarCpp.g:548:33: ( INDENT ( NEWLINE )* expr ( WS )* ( NEWLINE )+ DEDENT -> ^( Expr_Where expr ( where_item )+ ) | ( WS )* expr -> ^( Expr_Where expr ( where_item )+ ) ) int alt403=2; try { DebugEnterSubRule(403); try { DebugEnterDecision(403, false); int LA403_0 = input.LA(1); if ((LA403_0==INDENT)) { alt403 = 1; } else if ((LA403_0==IDENT||LA403_0==NUMBER||LA403_0==STRING||(LA403_0>=WS && LA403_0<=86)||LA403_0==91||LA403_0==93||LA403_0==95||(LA403_0>=97 && LA403_0<=98)||(LA403_0>=101 && LA403_0<=102)||(LA403_0>=131 && LA403_0<=132)||LA403_0==155||LA403_0==158||(LA403_0>=160 && LA403_0<=161)||LA403_0==186)) { alt403 = 2; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 403, 0, input); DebugRecognitionException(nvae); throw nvae; } } finally { DebugExitDecision(403); } switch (alt403) { case 1: DebugEnterAlt(1); // SugarCpp.g:548:35: INDENT ( NEWLINE )* expr ( WS )* ( NEWLINE )+ DEDENT { DebugLocation(548, 35); INDENT618=(IToken)Match(input,INDENT,Follow._INDENT_in_let_expr5701); if (state.failed) return retval; if (state.backtracking == 0) stream_INDENT.Add(INDENT618); DebugLocation(548, 42); // SugarCpp.g:548:42: ( NEWLINE )* try { DebugEnterSubRule(399); while (true) { int alt399=2; try { DebugEnterDecision(399, false); int LA399_0 = input.LA(1); if ((LA399_0==NEWLINE)) { alt399 = 1; } } finally { DebugExitDecision(399); } switch ( alt399 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:548:42: NEWLINE { DebugLocation(548, 42); NEWLINE619=(IToken)Match(input,NEWLINE,Follow._NEWLINE_in_let_expr5703); if (state.failed) return retval; if (state.backtracking == 0) stream_NEWLINE.Add(NEWLINE619); } break; default: goto loop399; } } loop399: ; } finally { DebugExitSubRule(399); } DebugLocation(548, 51); PushFollow(Follow._expr_in_let_expr5706); expr620=expr(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_expr.Add(expr620.Tree); DebugLocation(548, 56); // SugarCpp.g:548:56: ( WS )* try { DebugEnterSubRule(400); while (true) { int alt400=2; try { DebugEnterDecision(400, false); int LA400_0 = input.LA(1); if ((LA400_0==WS)) { alt400 = 1; } } finally { DebugExitDecision(400); } switch ( alt400 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:548:56: WS { DebugLocation(548, 56); WS621=(IToken)Match(input,WS,Follow._WS_in_let_expr5708); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS621); } break; default: goto loop400; } } loop400: ; } finally { DebugExitSubRule(400); } DebugLocation(548, 60); // SugarCpp.g:548:60: ( NEWLINE )+ int cnt401=0; try { DebugEnterSubRule(401); while (true) { int alt401=2; try { DebugEnterDecision(401, false); int LA401_0 = input.LA(1); if ((LA401_0==NEWLINE)) { alt401 = 1; } } finally { DebugExitDecision(401); } switch (alt401) { case 1: DebugEnterAlt(1); // SugarCpp.g:548:60: NEWLINE { DebugLocation(548, 60); NEWLINE622=(IToken)Match(input,NEWLINE,Follow._NEWLINE_in_let_expr5711); if (state.failed) return retval; if (state.backtracking == 0) stream_NEWLINE.Add(NEWLINE622); } break; default: if (cnt401 >= 1) goto loop401; if (state.backtracking>0) {state.failed=true; return retval;} EarlyExitException eee401 = new EarlyExitException( 401, input ); DebugRecognitionException(eee401); throw eee401; } cnt401++; } loop401: ; } finally { DebugExitSubRule(401); } DebugLocation(548, 69); DEDENT623=(IToken)Match(input,DEDENT,Follow._DEDENT_in_let_expr5714); if (state.failed) return retval; if (state.backtracking == 0) stream_DEDENT.Add(DEDENT623); { // AST REWRITE // elements: expr, where_item // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: if (state.backtracking == 0) { retval.Tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null); root_0 = (CommonTree)adaptor.Nil(); // 548:76: -> ^( Expr_Where expr ( where_item )+ ) { DebugLocation(548, 79); // SugarCpp.g:548:79: ^( Expr_Where expr ( where_item )+ ) { CommonTree root_1 = (CommonTree)adaptor.Nil(); DebugLocation(548, 81); root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(Expr_Where, "Expr_Where"), root_1); DebugLocation(548, 92); adaptor.AddChild(root_1, stream_expr.NextTree()); DebugLocation(548, 97); if (!(stream_where_item.HasNext)) { throw new RewriteEarlyExitException(); } while ( stream_where_item.HasNext ) { DebugLocation(548, 97); adaptor.AddChild(root_1, stream_where_item.NextTree()); } stream_where_item.Reset(); adaptor.AddChild(root_0, root_1); } } retval.Tree = root_0; } } } break; case 2: DebugEnterAlt(2); // SugarCpp.g:549:26: ( WS )* expr { DebugLocation(549, 26); // SugarCpp.g:549:26: ( WS )* try { DebugEnterSubRule(402); while (true) { int alt402=2; try { DebugEnterDecision(402, false); int LA402_0 = input.LA(1); if ((LA402_0==WS)) { alt402 = 1; } } finally { DebugExitDecision(402); } switch ( alt402 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:549:26: WS { DebugLocation(549, 26); WS624=(IToken)Match(input,WS,Follow._WS_in_let_expr5752); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS624); } break; default: goto loop402; } } loop402: ; } finally { DebugExitSubRule(402); } DebugLocation(549, 30); PushFollow(Follow._expr_in_let_expr5755); expr625=expr(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_expr.Add(expr625.Tree); { // AST REWRITE // elements: where_item, expr // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: if (state.backtracking == 0) { retval.Tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null); root_0 = (CommonTree)adaptor.Nil(); // 549:35: -> ^( Expr_Where expr ( where_item )+ ) { DebugLocation(549, 38); // SugarCpp.g:549:38: ^( Expr_Where expr ( where_item )+ ) { CommonTree root_1 = (CommonTree)adaptor.Nil(); DebugLocation(549, 40); root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(Expr_Where, "Expr_Where"), root_1); DebugLocation(549, 51); adaptor.AddChild(root_1, stream_expr.NextTree()); DebugLocation(549, 56); if (!(stream_where_item.HasNext)) { throw new RewriteEarlyExitException(); } while ( stream_where_item.HasNext ) { DebugLocation(549, 56); adaptor.AddChild(root_1, stream_where_item.NextTree()); } stream_where_item.Reset(); adaptor.AddChild(root_0, root_1); } } retval.Tree = root_0; } } } break; } } finally { DebugExitSubRule(403); } } break; } } finally { DebugExitSubRule(404); } } break; case 2: DebugEnterAlt(2); // SugarCpp.g:552:15: ( WS )* ( NEWLINE )+ INDENT ( NEWLINE )* ( where_item ( WS )* ( NEWLINE )+ )+ ( WS )* 'in' ( WS )* expr ( WS )* ( NEWLINE )+ DEDENT { DebugLocation(552, 15); // SugarCpp.g:552:15: ( WS )* try { DebugEnterSubRule(405); while (true) { int alt405=2; try { DebugEnterDecision(405, false); int LA405_0 = input.LA(1); if ((LA405_0==WS)) { alt405 = 1; } } finally { DebugExitDecision(405); } switch ( alt405 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:552:15: WS { DebugLocation(552, 15); WS626=(IToken)Match(input,WS,Follow._WS_in_let_expr5826); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS626); } break; default: goto loop405; } } loop405: ; } finally { DebugExitSubRule(405); } DebugLocation(552, 19); // SugarCpp.g:552:19: ( NEWLINE )+ int cnt406=0; try { DebugEnterSubRule(406); while (true) { int alt406=2; try { DebugEnterDecision(406, false); int LA406_0 = input.LA(1); if ((LA406_0==NEWLINE)) { alt406 = 1; } } finally { DebugExitDecision(406); } switch (alt406) { case 1: DebugEnterAlt(1); // SugarCpp.g:552:19: NEWLINE { DebugLocation(552, 19); NEWLINE627=(IToken)Match(input,NEWLINE,Follow._NEWLINE_in_let_expr5829); if (state.failed) return retval; if (state.backtracking == 0) stream_NEWLINE.Add(NEWLINE627); } break; default: if (cnt406 >= 1) goto loop406; if (state.backtracking>0) {state.failed=true; return retval;} EarlyExitException eee406 = new EarlyExitException( 406, input ); DebugRecognitionException(eee406); throw eee406; } cnt406++; } loop406: ; } finally { DebugExitSubRule(406); } DebugLocation(552, 28); INDENT628=(IToken)Match(input,INDENT,Follow._INDENT_in_let_expr5832); if (state.failed) return retval; if (state.backtracking == 0) stream_INDENT.Add(INDENT628); DebugLocation(552, 35); // SugarCpp.g:552:35: ( NEWLINE )* try { DebugEnterSubRule(407); while (true) { int alt407=2; try { DebugEnterDecision(407, false); int LA407_0 = input.LA(1); if ((LA407_0==NEWLINE)) { alt407 = 1; } } finally { DebugExitDecision(407); } switch ( alt407 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:552:35: NEWLINE { DebugLocation(552, 35); NEWLINE629=(IToken)Match(input,NEWLINE,Follow._NEWLINE_in_let_expr5834); if (state.failed) return retval; if (state.backtracking == 0) stream_NEWLINE.Add(NEWLINE629); } break; default: goto loop407; } } loop407: ; } finally { DebugExitSubRule(407); } DebugLocation(552, 44); // SugarCpp.g:552:44: ( where_item ( WS )* ( NEWLINE )+ )+ int cnt410=0; try { DebugEnterSubRule(410); while (true) { int alt410=2; try { DebugEnterDecision(410, false); int LA410_0 = input.LA(1); if ((LA410_0==IDENT||LA410_0==86||LA410_0==91||LA410_0==93||LA410_0==95||(LA410_0>=97 && LA410_0<=98)||(LA410_0>=101 && LA410_0<=102)||LA410_0==131||LA410_0==143||(LA410_0>=148 && LA410_0<=150)||LA410_0==155||LA410_0==157||LA410_0==161||LA410_0==164||LA410_0==168||(LA410_0>=173 && LA410_0<=177)||LA410_0==181||LA410_0==186)) { alt410 = 1; } } finally { DebugExitDecision(410); } switch (alt410) { case 1: DebugEnterAlt(1); // SugarCpp.g:552:45: where_item ( WS )* ( NEWLINE )+ { DebugLocation(552, 45); PushFollow(Follow._where_item_in_let_expr5838); where_item630=where_item(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_where_item.Add(where_item630.Tree); DebugLocation(552, 56); // SugarCpp.g:552:56: ( WS )* try { DebugEnterSubRule(408); while (true) { int alt408=2; try { DebugEnterDecision(408, false); int LA408_0 = input.LA(1); if ((LA408_0==WS)) { alt408 = 1; } } finally { DebugExitDecision(408); } switch ( alt408 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:552:56: WS { DebugLocation(552, 56); WS631=(IToken)Match(input,WS,Follow._WS_in_let_expr5840); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS631); } break; default: goto loop408; } } loop408: ; } finally { DebugExitSubRule(408); } DebugLocation(552, 60); // SugarCpp.g:552:60: ( NEWLINE )+ int cnt409=0; try { DebugEnterSubRule(409); while (true) { int alt409=2; try { DebugEnterDecision(409, false); int LA409_0 = input.LA(1); if ((LA409_0==NEWLINE)) { alt409 = 1; } } finally { DebugExitDecision(409); } switch (alt409) { case 1: DebugEnterAlt(1); // SugarCpp.g:552:60: NEWLINE { DebugLocation(552, 60); NEWLINE632=(IToken)Match(input,NEWLINE,Follow._NEWLINE_in_let_expr5843); if (state.failed) return retval; if (state.backtracking == 0) stream_NEWLINE.Add(NEWLINE632); } break; default: if (cnt409 >= 1) goto loop409; if (state.backtracking>0) {state.failed=true; return retval;} EarlyExitException eee409 = new EarlyExitException( 409, input ); DebugRecognitionException(eee409); throw eee409; } cnt409++; } loop409: ; } finally { DebugExitSubRule(409); } } break; default: if (cnt410 >= 1) goto loop410; if (state.backtracking>0) {state.failed=true; return retval;} EarlyExitException eee410 = new EarlyExitException( 410, input ); DebugRecognitionException(eee410); throw eee410; } cnt410++; } loop410: ; } finally { DebugExitSubRule(410); } DebugLocation(552, 71); // SugarCpp.g:552:71: ( WS )* try { DebugEnterSubRule(411); while (true) { int alt411=2; try { DebugEnterDecision(411, false); int LA411_0 = input.LA(1); if ((LA411_0==WS)) { alt411 = 1; } } finally { DebugExitDecision(411); } switch ( alt411 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:552:71: WS { DebugLocation(552, 71); WS633=(IToken)Match(input,WS,Follow._WS_in_let_expr5848); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS633); } break; default: goto loop411; } } loop411: ; } finally { DebugExitSubRule(411); } DebugLocation(552, 75); string_literal634=(IToken)Match(input,152,Follow._152_in_let_expr5851); if (state.failed) return retval; if (state.backtracking == 0) stream_152.Add(string_literal634); DebugLocation(552, 80); // SugarCpp.g:552:80: ( WS )* try { DebugEnterSubRule(412); while (true) { int alt412=2; try { DebugEnterDecision(412, false); int LA412_0 = input.LA(1); if ((LA412_0==WS)) { alt412 = 1; } } finally { DebugExitDecision(412); } switch ( alt412 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:552:80: WS { DebugLocation(552, 80); WS635=(IToken)Match(input,WS,Follow._WS_in_let_expr5853); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS635); } break; default: goto loop412; } } loop412: ; } finally { DebugExitSubRule(412); } DebugLocation(552, 84); PushFollow(Follow._expr_in_let_expr5856); expr636=expr(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) stream_expr.Add(expr636.Tree); DebugLocation(552, 89); // SugarCpp.g:552:89: ( WS )* try { DebugEnterSubRule(413); while (true) { int alt413=2; try { DebugEnterDecision(413, false); int LA413_0 = input.LA(1); if ((LA413_0==WS)) { alt413 = 1; } } finally { DebugExitDecision(413); } switch ( alt413 ) { case 1: DebugEnterAlt(1); // SugarCpp.g:552:89: WS { DebugLocation(552, 89); WS637=(IToken)Match(input,WS,Follow._WS_in_let_expr5858); if (state.failed) return retval; if (state.backtracking == 0) stream_WS.Add(WS637); } break; default: goto loop413; } } loop413: ; } finally { DebugExitSubRule(413); } DebugLocation(552, 93); // SugarCpp.g:552:93: ( NEWLINE )+ int cnt414=0; try { DebugEnterSubRule(414); while (true) { int alt414=2; try { DebugEnterDecision(414, false); int LA414_0 = input.LA(1); if ((LA414_0==NEWLINE)) { alt414 = 1; } } finally { DebugExitDecision(414); } switch (alt414) { case 1: DebugEnterAlt(1); // SugarCpp.g:552:93: NEWLINE { DebugLocation(552, 93); NEWLINE638=(IToken)Match(input,NEWLINE,Follow._NEWLINE_in_let_expr5861); if (state.failed) return retval; if (state.backtracking == 0) stream_NEWLINE.Add(NEWLINE638); } break; default: if (cnt414 >= 1) goto loop414; if (state.backtracking>0) {state.failed=true; return retval;} EarlyExitException eee414 = new EarlyExitException( 414, input ); DebugRecognitionException(eee414); throw eee414; } cnt414++; } loop414: ; } finally { DebugExitSubRule(414); } DebugLocation(552, 102); DEDENT639=(IToken)Match(input,DEDENT,Follow._DEDENT_in_let_expr5864); if (state.failed) return retval; if (state.backtracking == 0) stream_DEDENT.Add(DEDENT639); { // AST REWRITE // elements: where_item, expr // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: if (state.backtracking == 0) { retval.Tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null); root_0 = (CommonTree)adaptor.Nil(); // 552:109: -> ^( Expr_Where expr ( where_item )+ ) { DebugLocation(552, 112); // SugarCpp.g:552:112: ^( Expr_Where expr ( where_item )+ ) { CommonTree root_1 = (CommonTree)adaptor.Nil(); DebugLocation(552, 114); root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(Expr_Where, "Expr_Where"), root_1); DebugLocation(552, 125); adaptor.AddChild(root_1, stream_expr.NextTree()); DebugLocation(552, 130); if (!(stream_where_item.HasNext)) { throw new RewriteEarlyExitException(); } while ( stream_where_item.HasNext ) { DebugLocation(552, 130); adaptor.AddChild(root_1, stream_where_item.NextTree()); } stream_where_item.Reset(); adaptor.AddChild(root_0, root_1); } } retval.Tree = root_0; } } } break; } } finally { DebugExitSubRule(415); } } retval.Stop = (IToken)input.LT(-1); if (state.backtracking == 0) { retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0); adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop); } } catch (RecognitionException re) { ReportError(re); Recover(input,re); retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re); } finally { TraceOut("let_expr", 60); LeaveRule("let_expr", 60); LeaveRule_let_expr(); } DebugLocation(554, 1); } finally { DebugExitRule(GrammarFileName, "let_expr"); } return retval; }