// $ANTLR start "multiplicative_expression" // FastSimpleExpression.g3:61:0: multiplicative_expression : atom ( ( '*' | '/' | '%' ) atom )* ; private FastSimpleExpressionParser.multiplicative_expression_return multiplicative_expression() { FastSimpleExpressionParser.multiplicative_expression_return retval = new FastSimpleExpressionParser.multiplicative_expression_return(); retval.start = input.LT(1); CommonTree root_0 = null; IToken char_literal8 = null; IToken char_literal9 = null; IToken char_literal10 = null; FastSimpleExpressionParser.atom_return atom7 = default(FastSimpleExpressionParser.atom_return); FastSimpleExpressionParser.atom_return atom11 = default(FastSimpleExpressionParser.atom_return); CommonTree char_literal8_tree = null; CommonTree char_literal9_tree = null; CommonTree char_literal10_tree = null; try { // FastSimpleExpression.g3:62:4: ( atom ( ( '*' | '/' | '%' ) atom )* ) // FastSimpleExpression.g3:62:4: atom ( ( '*' | '/' | '%' ) atom )* { root_0 = (CommonTree)adaptor.Nil(); PushFollow(Follow._atom_in_multiplicative_expression100); atom7 = atom(); PopFollow(); adaptor.AddChild(root_0, atom7.Tree); // FastSimpleExpression.g3:63:3: ( ( '*' | '/' | '%' ) atom )* while (true) { int alt4 = 2; int LA4_0 = input.LA(1); if (((LA4_0 >= 8 && LA4_0 <= 10))) { alt4 = 1; } switch (alt4) { case 1: // FastSimpleExpression.g3:63:5: ( '*' | '/' | '%' ) atom { // FastSimpleExpression.g3:63:5: ( '*' | '/' | '%' ) int alt3 = 3; switch (input.LA(1)) { case 9: { alt3 = 1; } break; case 10: { alt3 = 2; } break; case 8: { alt3 = 3; } break; default: { NoViableAltException nvae = new NoViableAltException("", 3, 0, input); throw nvae; } } switch (alt3) { case 1: // FastSimpleExpression.g3:63:6: '*' { char_literal8 = (IToken)Match(input, 9, Follow._9_in_multiplicative_expression107); char_literal8_tree = (CommonTree)adaptor.Create(char_literal8); root_0 = (CommonTree)adaptor.BecomeRoot(char_literal8_tree, root_0); } break; case 2: // FastSimpleExpression.g3:63:13: '/' { char_literal9 = (IToken)Match(input, 10, Follow._10_in_multiplicative_expression112); char_literal9_tree = (CommonTree)adaptor.Create(char_literal9); root_0 = (CommonTree)adaptor.BecomeRoot(char_literal9_tree, root_0); } break; case 3: // FastSimpleExpression.g3:63:20: '%' { char_literal10 = (IToken)Match(input, 8, Follow._8_in_multiplicative_expression117); char_literal10_tree = (CommonTree)adaptor.Create(char_literal10); root_0 = (CommonTree)adaptor.BecomeRoot(char_literal10_tree, root_0); } break; } PushFollow(Follow._atom_in_multiplicative_expression124); atom11 = atom(); PopFollow(); adaptor.AddChild(root_0, atom11.Tree); } break; default: goto loop4; } } loop4: ; } retval.stop = input.LT(-1); 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 { } return(retval); }
// $ANTLR start "multiplicative_expression" // FastSimpleExpression.g3:61:0: multiplicative_expression : atom ( ( '*' | '/' | '%' ) atom )* ; private FastSimpleExpressionParser.multiplicative_expression_return multiplicative_expression() { FastSimpleExpressionParser.multiplicative_expression_return retval = new FastSimpleExpressionParser.multiplicative_expression_return(); retval.start = input.LT(1); CommonTree root_0 = null; IToken char_literal8=null; IToken char_literal9=null; IToken char_literal10=null; FastSimpleExpressionParser.atom_return atom7 = default(FastSimpleExpressionParser.atom_return); FastSimpleExpressionParser.atom_return atom11 = default(FastSimpleExpressionParser.atom_return); CommonTree char_literal8_tree=null; CommonTree char_literal9_tree=null; CommonTree char_literal10_tree=null; try { // FastSimpleExpression.g3:62:4: ( atom ( ( '*' | '/' | '%' ) atom )* ) // FastSimpleExpression.g3:62:4: atom ( ( '*' | '/' | '%' ) atom )* { root_0 = (CommonTree)adaptor.Nil(); PushFollow(Follow._atom_in_multiplicative_expression100); atom7=atom(); PopFollow(); adaptor.AddChild(root_0, atom7.Tree); // FastSimpleExpression.g3:63:3: ( ( '*' | '/' | '%' ) atom )* while (true) { int alt4=2; int LA4_0 = input.LA(1); if (((LA4_0>=8 && LA4_0<=10))) { alt4=1; } switch ( alt4 ) { case 1: // FastSimpleExpression.g3:63:5: ( '*' | '/' | '%' ) atom { // FastSimpleExpression.g3:63:5: ( '*' | '/' | '%' ) int alt3=3; switch (input.LA(1)) { case 9: { alt3=1; } break; case 10: { alt3=2; } break; case 8: { alt3=3; } break; default: { NoViableAltException nvae = new NoViableAltException("", 3, 0, input); throw nvae; } } switch (alt3) { case 1: // FastSimpleExpression.g3:63:6: '*' { char_literal8=(IToken)Match(input,9,Follow._9_in_multiplicative_expression107); char_literal8_tree = (CommonTree)adaptor.Create(char_literal8); root_0 = (CommonTree)adaptor.BecomeRoot(char_literal8_tree, root_0); } break; case 2: // FastSimpleExpression.g3:63:13: '/' { char_literal9=(IToken)Match(input,10,Follow._10_in_multiplicative_expression112); char_literal9_tree = (CommonTree)adaptor.Create(char_literal9); root_0 = (CommonTree)adaptor.BecomeRoot(char_literal9_tree, root_0); } break; case 3: // FastSimpleExpression.g3:63:20: '%' { char_literal10=(IToken)Match(input,8,Follow._8_in_multiplicative_expression117); char_literal10_tree = (CommonTree)adaptor.Create(char_literal10); root_0 = (CommonTree)adaptor.BecomeRoot(char_literal10_tree, root_0); } break; } PushFollow(Follow._atom_in_multiplicative_expression124); atom11=atom(); PopFollow(); adaptor.AddChild(root_0, atom11.Tree); } break; default: goto loop4; } } loop4: ; } retval.stop = input.LT(-1); 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 { } return retval; }
// $ANTLR start "additive_expression" // FastSimpleExpression.g3:54:0: additive_expression : multiplicative_expression ( ( '+' | '-' ) multiplicative_expression )* ; private FastSimpleExpressionParser.additive_expression_return additive_expression() { FastSimpleExpressionParser.additive_expression_return retval = new FastSimpleExpressionParser.additive_expression_return(); retval.start = input.LT(1); CommonTree root_0 = null; IToken char_literal4 = null; IToken char_literal5 = null; FastSimpleExpressionParser.multiplicative_expression_return multiplicative_expression3 = default(FastSimpleExpressionParser.multiplicative_expression_return); FastSimpleExpressionParser.multiplicative_expression_return multiplicative_expression6 = default(FastSimpleExpressionParser.multiplicative_expression_return); CommonTree char_literal4_tree = null; CommonTree char_literal5_tree = null; try { // FastSimpleExpression.g3:55:4: ( multiplicative_expression ( ( '+' | '-' ) multiplicative_expression )* ) // FastSimpleExpression.g3:55:4: multiplicative_expression ( ( '+' | '-' ) multiplicative_expression )* { root_0 = (CommonTree)adaptor.Nil(); PushFollow(Follow._multiplicative_expression_in_additive_expression65); multiplicative_expression3 = multiplicative_expression(); PopFollow(); adaptor.AddChild(root_0, multiplicative_expression3.Tree); // FastSimpleExpression.g3:56:3: ( ( '+' | '-' ) multiplicative_expression )* while (true) { int alt2 = 2; int LA2_0 = input.LA(1); if ((LA2_0 == 7 || LA2_0 == 11)) { alt2 = 1; } switch (alt2) { case 1: // FastSimpleExpression.g3:56:5: ( '+' | '-' ) multiplicative_expression { // FastSimpleExpression.g3:56:5: ( '+' | '-' ) int alt1 = 2; int LA1_0 = input.LA(1); if ((LA1_0 == 11)) { alt1 = 1; } else if ((LA1_0 == 7)) { alt1 = 2; } else { NoViableAltException nvae = new NoViableAltException("", 1, 0, input); throw nvae; } switch (alt1) { case 1: // FastSimpleExpression.g3:56:6: '+' { char_literal4 = (IToken)Match(input, 11, Follow._11_in_additive_expression72); char_literal4_tree = (CommonTree)adaptor.Create(char_literal4); root_0 = (CommonTree)adaptor.BecomeRoot(char_literal4_tree, root_0); } break; case 2: // FastSimpleExpression.g3:56:13: '-' { char_literal5 = (IToken)Match(input, 7, Follow._7_in_additive_expression77); char_literal5_tree = (CommonTree)adaptor.Create(char_literal5); root_0 = (CommonTree)adaptor.BecomeRoot(char_literal5_tree, root_0); } break; } PushFollow(Follow._multiplicative_expression_in_additive_expression84); multiplicative_expression6 = multiplicative_expression(); PopFollow(); adaptor.AddChild(root_0, multiplicative_expression6.Tree); } break; default: goto loop2; } } loop2: ; } retval.stop = input.LT(-1); 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 { } return(retval); }