NCalcParser.bitwiseXOrExpression C# (CSharp) Method

bitwiseXOrExpression() public method

public bitwiseXOrExpression ( ) : NCalcParser.bitwiseXOrExpression_return,
return NCalcParser.bitwiseXOrExpression_return,
    public NCalcParser.bitwiseXOrExpression_return bitwiseXOrExpression()
    {
        NCalcParser.bitwiseXOrExpression_return retval = new NCalcParser.bitwiseXOrExpression_return();
        retval.Start = input.LT(1);

        CommonTree root_0 = null;

        IToken char_literal8 = null;
        NCalcParser.bitwiseAndExpression_return left = null;

        NCalcParser.bitwiseAndExpression_return right = null;

        CommonTree char_literal8_tree=null;

        BinaryExpressionType type = BinaryExpressionType.Unknown;

        try
        {
            // C:\\Users\\s.ros\\Documents\\Développement\\NCalc\\Grammar\\NCalc.g:119:2: (left= bitwiseAndExpression ( '^' right= bitwiseAndExpression )* )
            // C:\\Users\\s.ros\\Documents\\Développement\\NCalc\\Grammar\\NCalc.g:119:4: left= bitwiseAndExpression ( '^' right= bitwiseAndExpression )*
            {
                root_0 = (CommonTree)adaptor.GetNilNode();

                PushFollow(FOLLOW_bitwiseAndExpression_in_bitwiseXOrExpression290);
                left = bitwiseAndExpression();
                state.followingStackPointer--;

                adaptor.AddChild(root_0, left.Tree);
                 retval.value =  ((left != null) ? left.value : null);
                // C:\\Users\\s.ros\\Documents\\Développement\\NCalc\\Grammar\\NCalc.g:119:56: ( '^' right= bitwiseAndExpression )*
                do
                {
                    int alt5 = 2;
                    int LA5_0 = input.LA(1);

                    if ( (LA5_0 == 26) )
                    {
                        alt5 = 1;
                    }

                    switch (alt5)
                    {
                        case 1 :
                            // C:\\Users\\s.ros\\Documents\\Développement\\NCalc\\Grammar\\NCalc.g:120:4: '^' right= bitwiseAndExpression
                            {
                                char_literal8=(IToken)Match(input,26,FOLLOW_26_in_bitwiseXOrExpression299);
                                    char_literal8_tree = (CommonTree)adaptor.Create(char_literal8);
                                    adaptor.AddChild(root_0, char_literal8_tree);

                                 type = BinaryExpressionType.BitwiseXOr;
                                PushFollow(FOLLOW_bitwiseAndExpression_in_bitwiseXOrExpression309);
                                right = bitwiseAndExpression();
                                state.followingStackPointer--;

                                adaptor.AddChild(root_0, right.Tree);
                                 retval.value =  new BinaryExpression(type, retval.value, ((right != null) ? right.value : null));

                            }
                            break;

                        default:
                            goto loop5;
                    }
                } while (true);

                loop5:
                    ;	// Stops C# compiler whining that label 'loop5' has no statements

            }

            retval.Stop = input.LT(-1);

                retval.Tree = (CommonTree)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 = (CommonTree)adaptor.ErrorNode(input, (IToken) retval.Start, input.LT(-1), re);

        }
        finally
        {
        }
        return retval;
    }