// throws RecognitionException [1] // $ANTLR start equalityExpression // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1334:1: equalityExpression : relationalExpression (op= equalityOperator relationalExpression )* ; public equalityExpression_return equalityExpression() { equalityExpression_return retval = new equalityExpression_return(); retval.start = input.LT(1); int equalityExpression_StartIndex = input.Index(); CommonTree root_0 = null; equalityOperator_return op = null; relationalExpression_return relationalExpression252 = null; relationalExpression_return relationalExpression253 = null; try { if ( (backtracking > 0) && AlreadyParsedRule(input, 98) ) { return retval; } // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1335:4: ( relationalExpression (op= equalityOperator relationalExpression )* ) // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1335:4: relationalExpression (op= equalityOperator relationalExpression )* { root_0 = (CommonTree)adaptor.GetNilNode(); PushFollow(FOLLOW_relationalExpression_in_equalityExpression4571); relationalExpression252 = relationalExpression(); followingStackPointer_--; if (failed) return retval; if ( backtracking==0 ) adaptor.AddChild(root_0, relationalExpression252.Tree); // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1336:2: (op= equalityOperator relationalExpression )* do { int alt74 = 2; int LA74_0 = input.LA(1); if ( ((LA74_0 >= STRICT_EQUAL && LA74_0 <= EQUAL)) ) { alt74 = 1; } switch (alt74) { case 1 : // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1337:3: op= equalityOperator relationalExpression { PushFollow(FOLLOW_equalityOperator_in_equalityExpression4581); op = equalityOperator(); 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_relationalExpression_in_equalityExpression4593); relationalExpression253 = relationalExpression(); followingStackPointer_--; if (failed) return retval; if ( backtracking==0 ) adaptor.AddChild(root_0, relationalExpression253.Tree); } break; default: goto loop74; } } while (true); loop74: ; // Stops C# compiler whinging that label 'loop74' 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, 98, equalityExpression_StartIndex); } } return retval; }
// $ANTLR start equalityExpression // C:\\Documents and Settings\\Sébastien Ros\\Mes documents\\Développement\\NLinq\\NLinq.g:93:1: equalityExpression returns [Expression value] : left= relationalExpression ( ( '==' | '!=' ) right= relationalExpression )* ; public equalityExpression_return equalityExpression() // throws RecognitionException [1] { equalityExpression_return retval = new equalityExpression_return(); retval.start = input.LT(1); CommonTree root_0 = null; IToken string_literal11 = null; IToken string_literal12 = null; relationalExpression_return left = null; relationalExpression_return right = null; CommonTree string_literal11_tree=null; CommonTree string_literal12_tree=null; BinaryExpressionType type = BinaryExpressionType.Unknown; try { // C:\\Documents and Settings\\Sébastien Ros\\Mes documents\\Développement\\NLinq\\NLinq.g:97:2: (left= relationalExpression ( ( '==' | '!=' ) right= relationalExpression )* ) // C:\\Documents and Settings\\Sébastien Ros\\Mes documents\\Développement\\NLinq\\NLinq.g:97:4: left= relationalExpression ( ( '==' | '!=' ) right= relationalExpression )* { root_0 = (CommonTree)adaptor.GetNilNode(); PushFollow(FOLLOW_relationalExpression_in_equalityExpression255); left = relationalExpression(); 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:97:56: ( ( '==' | '!=' ) right= relationalExpression )* do { int alt6 = 2; int LA6_0 = input.LA(1); if ( (LA6_0 == 21) ) { alt6 = 1; } else if ( (LA6_0 == 22) ) { alt6 = 1; } switch (alt6) { case 1 : // C:\\Documents and Settings\\Sébastien Ros\\Mes documents\\Développement\\NLinq\\NLinq.g:98:4: ( '==' | '!=' ) right= relationalExpression { // C:\\Documents and Settings\\Sébastien Ros\\Mes documents\\Développement\\NLinq\\NLinq.g:98:4: ( '==' | '!=' ) int alt5 = 2; int LA5_0 = input.LA(1); if ( (LA5_0 == 21) ) { alt5 = 1; } else if ( (LA5_0 == 22) ) { alt5 = 2; } else { NoViableAltException nvae_d5s0 = new NoViableAltException("98:4: ( '==' | '!=' )", 5, 0, input); throw nvae_d5s0; } switch (alt5) { case 1 : // C:\\Documents and Settings\\Sébastien Ros\\Mes documents\\Développement\\NLinq\\NLinq.g:98:6: '==' { string_literal11 = (IToken)input.LT(1); Match(input,21,FOLLOW_21_in_equalityExpression266); string_literal11_tree = (CommonTree)adaptor.Create(string_literal11); adaptor.AddChild(root_0, string_literal11_tree); type = BinaryExpressionType.Equal; } break; case 2 : // C:\\Documents and Settings\\Sébastien Ros\\Mes documents\\Développement\\NLinq\\NLinq.g:99:6: '!=' { string_literal12 = (IToken)input.LT(1); Match(input,22,FOLLOW_22_in_equalityExpression276); string_literal12_tree = (CommonTree)adaptor.Create(string_literal12); adaptor.AddChild(root_0, string_literal12_tree); type = BinaryExpressionType.NotEqual; } break; } PushFollow(FOLLOW_relationalExpression_in_equalityExpression288); right = relationalExpression(); followingStackPointer_--; adaptor.AddChild(root_0, right.Tree); retval.value = new BinaryExpression(type, retval.value, right.value); } break; default: goto loop6; } } while (true); loop6: ; // Stops C# compiler whinging that label 'loop6' 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; }