// throws RecognitionException [1] // $ANTLR start additiveExpression // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1386:1: additiveExpression : multiplicativeExpression (op= additiveOperator multiplicativeExpression )* ; public additiveExpression_return additiveExpression() { additiveExpression_return retval = new additiveExpression_return(); retval.start = input.LT(1); int additiveExpression_StartIndex = input.Index(); CommonTree root_0 = null; additiveOperator_return op = null; multiplicativeExpression_return multiplicativeExpression268 = null; multiplicativeExpression_return multiplicativeExpression269 = null; try { if ( (backtracking > 0) && AlreadyParsedRule(input, 104) ) { return retval; } // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1387:4: ( multiplicativeExpression (op= additiveOperator multiplicativeExpression )* ) // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1387:4: multiplicativeExpression (op= additiveOperator multiplicativeExpression )* { root_0 = (CommonTree)adaptor.GetNilNode(); PushFollow(FOLLOW_multiplicativeExpression_in_additiveExpression4773); multiplicativeExpression268 = multiplicativeExpression(); followingStackPointer_--; if (failed) return retval; if ( backtracking==0 ) adaptor.AddChild(root_0, multiplicativeExpression268.Tree); // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1388:3: (op= additiveOperator multiplicativeExpression )* do { int alt78 = 2; int LA78_0 = input.LA(1); if ( (LA78_0 == MINUS) ) { switch ( input.LA(2) ) { case INC: { int LA78_78 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; case DEC: { int LA78_79 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; case MINUS: { int LA78_80 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; case PLUS: { int LA78_81 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; case DELETE: { int LA78_82 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; case VOID: { int LA78_83 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; case TYPEOF: { int LA78_84 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; case LNOT: { int LA78_85 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; case BNOT: { int LA78_86 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; case UNDEFINED: { int LA78_87 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; case HEX_LITERAL: case DECIMAL_LITERAL: case OCTAL_LITERAL: case FLOAT_LITERAL: { int LA78_88 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; case STRING_LITERAL: { int LA78_89 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; case TRUE: { int LA78_90 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; case FALSE: { int LA78_91 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; case NULL: { int LA78_92 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; case LBRACK: { int LA78_93 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; case LCURLY: { int LA78_94 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; case FUNCTION: { int LA78_95 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; case NEW: { int LA78_96 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; case LPAREN: { int LA78_97 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; case IDENT: { int LA78_98 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; case USE: { int LA78_99 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; case XML: { int LA78_100 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; case DYNAMIC: { int LA78_101 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; case IS: { int LA78_102 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; case AS: { int LA78_103 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; case GET: { int LA78_104 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; case SET: { int LA78_105 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; } } else if ( (LA78_0 == PLUS) ) { switch ( input.LA(2) ) { case INC: { int LA78_106 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; case DEC: { int LA78_107 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; case MINUS: { int LA78_108 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; case PLUS: { int LA78_109 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; case DELETE: { int LA78_110 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; case VOID: { int LA78_111 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; case TYPEOF: { int LA78_112 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; case LNOT: { int LA78_113 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; case BNOT: { int LA78_114 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; case UNDEFINED: { int LA78_115 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; case HEX_LITERAL: case DECIMAL_LITERAL: case OCTAL_LITERAL: case FLOAT_LITERAL: { int LA78_116 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; case STRING_LITERAL: { int LA78_117 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; case TRUE: { int LA78_118 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; case FALSE: { int LA78_119 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; case NULL: { int LA78_120 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; case LBRACK: { int LA78_121 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; case LCURLY: { int LA78_122 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; case FUNCTION: { int LA78_123 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; case NEW: { int LA78_124 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; case LPAREN: { int LA78_125 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; case IDENT: { int LA78_126 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; case USE: { int LA78_127 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; case XML: { int LA78_128 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; case DYNAMIC: { int LA78_129 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; case IS: { int LA78_130 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; case AS: { int LA78_131 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; case GET: { int LA78_132 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; case SET: { int LA78_133 = input.LA(3); if ( (synpred141()) ) { alt78 = 1; } } break; } } switch (alt78) { case 1 : // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1389:4: op= additiveOperator multiplicativeExpression { PushFollow(FOLLOW_additiveOperator_in_additiveExpression4784); op = additiveOperator(); followingStackPointer_--; if (failed) return retval; if ( backtracking==0 ) root_0 = (CommonTree)adaptor.BecomeRoot(op.Tree, root_0); if ( backtracking == 0 ) { if(options.SpaceBetweenOperators) buffer.Append(" "); buffer.Append(((CommonTree)op.Tree).Text ); if(options.SpaceBetweenOperators) buffer.Append(" "); } PushFollow(FOLLOW_multiplicativeExpression_in_additiveExpression4794); multiplicativeExpression269 = multiplicativeExpression(); followingStackPointer_--; if (failed) return retval; if ( backtracking==0 ) adaptor.AddChild(root_0, multiplicativeExpression269.Tree); } break; default: goto loop78; } } while (true); loop78: ; // Stops C# compiler whinging that label 'loop78' has no statements } retval.stop = input.LT(-1); if ( backtracking==0 ) { retval.tree = (CommonTree)adaptor.RulePostProcessing(root_0); adaptor.SetTokenBoundaries(retval.Tree, retval.start, retval.stop); } } catch (NoViableAltException e) { Debug.WriteLine("NoValiable alt: token=" + e.Token + " (decision=" + e.decisionNumber + " state " + e.stateNumber + ")" + " decision=<<" + e.grammarDecisionDescription + ">>"); throw e; } catch (MismatchedTokenException e) { Debug.WriteLine("[" + e.Line + ":" + e.Index + "]: " + e.Message + ". Unexpected " + e.UnexpectedType.ToString() + "( expecting: "+ e.expecting + " )"); throw e; } catch(RecognitionException e) { Debug.WriteLine("RecognitionException: " + e); throw e; } finally { if ( backtracking > 0 ) { Memoize(input, 104, additiveExpression_StartIndex); } } return retval; }
// $ANTLR start additiveExpression // C:\\Documents and Settings\\Sébastien Ros\\Mes documents\\Développement\\NLinq\\NLinq.g:117:1: additiveExpression returns [Expression value] : left= multiplicativeExpression ( ( '+' | '-' ) right= multiplicativeExpression )* ; public additiveExpression_return additiveExpression() // throws RecognitionException [1] { additiveExpression_return retval = new additiveExpression_return(); retval.start = input.LT(1); CommonTree root_0 = null; IToken char_literal17 = null; IToken char_literal18 = null; multiplicativeExpression_return left = null; multiplicativeExpression_return right = null; CommonTree char_literal17_tree=null; CommonTree char_literal18_tree=null; BinaryExpressionType type = BinaryExpressionType.Unknown; try { // C:\\Documents and Settings\\Sébastien Ros\\Mes documents\\Développement\\NLinq\\NLinq.g:121:2: (left= multiplicativeExpression ( ( '+' | '-' ) right= multiplicativeExpression )* ) // C:\\Documents and Settings\\Sébastien Ros\\Mes documents\\Développement\\NLinq\\NLinq.g:121:4: left= multiplicativeExpression ( ( '+' | '-' ) right= multiplicativeExpression )* { root_0 = (CommonTree)adaptor.GetNilNode(); PushFollow(FOLLOW_multiplicativeExpression_in_additiveExpression407); left = multiplicativeExpression(); followingStackPointer_--; adaptor.AddChild(root_0, left.Tree); retval.value = left.value; // C:\\Documents and Settings\\Sébastien Ros\\Mes documents\\Développement\\NLinq\\NLinq.g:121:60: ( ( '+' | '-' ) right= multiplicativeExpression )* do { int alt10 = 2; int LA10_0 = input.LA(1); if ( (LA10_0 == 27) ) { alt10 = 1; } else if ( (LA10_0 == 28) ) { alt10 = 1; } switch (alt10) { case 1 : // C:\\Documents and Settings\\Sébastien Ros\\Mes documents\\Développement\\NLinq\\NLinq.g:122:4: ( '+' | '-' ) right= multiplicativeExpression { // C:\\Documents and Settings\\Sébastien Ros\\Mes documents\\Développement\\NLinq\\NLinq.g:122:4: ( '+' | '-' ) int alt9 = 2; int LA9_0 = input.LA(1); if ( (LA9_0 == 27) ) { alt9 = 1; } else if ( (LA9_0 == 28) ) { alt9 = 2; } else { NoViableAltException nvae_d9s0 = new NoViableAltException("122:4: ( '+' | '-' )", 9, 0, input); throw nvae_d9s0; } switch (alt9) { case 1 : // C:\\Documents and Settings\\Sébastien Ros\\Mes documents\\Développement\\NLinq\\NLinq.g:122:6: '+' { char_literal17 = (IToken)input.LT(1); Match(input,27,FOLLOW_27_in_additiveExpression418); char_literal17_tree = (CommonTree)adaptor.Create(char_literal17); adaptor.AddChild(root_0, char_literal17_tree); type = BinaryExpressionType.Plus; } break; case 2 : // C:\\Documents and Settings\\Sébastien Ros\\Mes documents\\Développement\\NLinq\\NLinq.g:123:6: '-' { char_literal18 = (IToken)input.LT(1); Match(input,28,FOLLOW_28_in_additiveExpression428); char_literal18_tree = (CommonTree)adaptor.Create(char_literal18); adaptor.AddChild(root_0, char_literal18_tree); type = BinaryExpressionType.Minus; } break; } PushFollow(FOLLOW_multiplicativeExpression_in_additiveExpression440); right = multiplicativeExpression(); followingStackPointer_--; adaptor.AddChild(root_0, right.Tree); retval.value = new BinaryExpression(type, retval.value, right.value); } break; default: goto loop10; } } while (true); loop10: ; // Stops C# compiler whinging that label 'loop10' has no statements } 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); } finally { } return retval; }