// $ANTLR start "parExpression" // AS3_ex.g3:2173:1: parExpression : L= LPAREN expression R= RPAREN ; public AS3_exParser.parExpression_return parExpression() // throws RecognitionException [1] { AS3_exParser.parExpression_return retval = new AS3_exParser.parExpression_return(); retval.Start = input.LT(1); int parExpression_StartIndex = input.Index(); object root_0 = null; IToken L = null; IToken R = null; AS3_exParser.expression_return expression231 = null; object L_tree=null; object R_tree=null; try { if ( (state.backtracking > 0) && AlreadyParsedRule(input, 99) ) { return retval; } // AS3_ex.g3:2174:5: (L= LPAREN expression R= RPAREN ) // AS3_ex.g3:2174:7: L= LPAREN expression R= RPAREN { root_0 = (object)adaptor.GetNilNode(); L=(IToken)Match(input,LPAREN,FOLLOW_LPAREN_in_parExpression10086); if (state.failed) return retval; if ( state.backtracking == 0 ) {L_tree = (object)adaptor.Create(L); adaptor.AddChild(root_0, L_tree); } if ( state.backtracking == 0 ) { Emit((CommonToken)L);InsertWS(mPrinter.GetAdvancedSpacesInsideParens()); } if ( state.backtracking == 0 ) { PushExpressionIndent(); } PushFollow(FOLLOW_expression_in_parExpression10093); expression231 = expression(); state.followingStackPointer--; if (state.failed) return retval; if ( state.backtracking == 0 ) adaptor.AddChild(root_0, expression231.Tree); R=(IToken)Match(input,RPAREN,FOLLOW_RPAREN_in_parExpression10098); if (state.failed) return retval; if ( state.backtracking == 0 ) {R_tree = (object)adaptor.Create(R); adaptor.AddChild(root_0, R_tree); } if ( state.backtracking == 0 ) { InsertWS(mPrinter.GetAdvancedSpacesInsideParens());Emit((CommonToken)R); } if ( state.backtracking == 0 ) { PopIndent(); } } retval.Stop = input.LT(-1); if ( state.backtracking==0 ) { retval.Tree = (object)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 = (object)adaptor.ErrorNode(input, (IToken) retval.Start, input.LT(-1), re); } finally { if ( state.backtracking > 0 ) { Memoize(input, 99, parExpression_StartIndex); } } return retval; }
// $ANTLR start "parExpression" // AS3_ex.g3:2949:1: parExpression : L= LPAREN expression R= RPAREN ; public AS3_exParser.parExpression_return parExpression() // throws RecognitionException [1] { AS3_exParser.parExpression_return retval = new AS3_exParser.parExpression_return(); retval.Start = input.LT(1); int parExpression_StartIndex = input.Index(); object root_0 = null; IToken L = null; IToken R = null; AS3_exParser.expression_return expression242 = null; object L_tree=null; object R_tree=null; bool pushedWrap=false; WrapOptions options=mPrinter.getExpressionWrapOptions(); try { if ( (state.backtracking > 0) && AlreadyParsedRule(input, 99) ) { return retval; } // AS3_ex.g3:2955:5: (L= LPAREN expression R= RPAREN ) // AS3_ex.g3:2956:5: L= LPAREN expression R= RPAREN { root_0 = (object)adaptor.GetNilNode(); if ( state.backtracking == 0 ) { pushedWrap=pushWrapInfo(options, true); } L=(IToken)Match(input,LPAREN,FOLLOW_LPAREN_in_parExpression11243); if (state.failed) return retval; if ( state.backtracking == 0 ) {L_tree = (object)adaptor.Create(L); adaptor.AddChild(root_0, L_tree); } if ( state.backtracking == 0 ) { emit(L);insertWS(mPrinter.getAdvancedSpacesInsideParensInOtherPlaces()); } if ( state.backtracking == 0 ) { pushExpressionIndent(); } PushFollow(FOLLOW_expression_in_parExpression11250); expression242 = expression(); state.followingStackPointer--; if (state.failed) return retval; if ( state.backtracking == 0 ) adaptor.AddChild(root_0, expression242.Tree); R=(IToken)Match(input,RPAREN,FOLLOW_RPAREN_in_parExpression11255); if (state.failed) return retval; if ( state.backtracking == 0 ) {R_tree = (object)adaptor.Create(R); adaptor.AddChild(root_0, R_tree); } if ( state.backtracking == 0 ) { insertWS(mPrinter.getAdvancedSpacesInsideParensInOtherPlaces());emit(R); } if ( state.backtracking == 0 ) { popIndent(); } if ( state.backtracking == 0 ) { if (pushedWrap) mPrinter.popWrapContext(); } } retval.Stop = input.LT(-1); if ( state.backtracking==0 ) { retval.Tree = (object)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 = (object)adaptor.ErrorNode(input, (IToken) retval.Start, input.LT(-1), re); } finally { if ( state.backtracking > 0 ) { Memoize(input, 99, parExpression_StartIndex); } } return retval; }