예제 #1
0
        // throws RecognitionException [1]
        // $ANTLR start expression
        // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1213:1: expression : assignmentExpression ;
        public expression_return expression()
        {
            InOperator_stack.Push(new InOperator_scope());

            expression_return retval = new expression_return();
            retval.start = input.LT(1);
            int expression_StartIndex = input.Index();
            CommonTree root_0 = null;

            assignmentExpression_return assignmentExpression225 = null;

            ((InOperator_scope)InOperator_stack.Peek()).allowed =  true;

            try
            {
            if ( (backtracking > 0) && AlreadyParsedRule(input, 85) )
            {
                return retval;
            }
            // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1218:4: ( assignmentExpression )
            // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1218:4: assignmentExpression
            {
                root_0 = (CommonTree)adaptor.GetNilNode();

                PushFollow(FOLLOW_assignmentExpression_in_expression4120);
                assignmentExpression225 = assignmentExpression();
                followingStackPointer_--;
                if (failed) return retval;
                if ( backtracking==0 ) adaptor.AddChild(root_0, assignmentExpression225.Tree);

            }

            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, 85, expression_StartIndex);
            }
            InOperator_stack.Pop();

            }
            return retval;
        }
		// $ANTLR start "expression"
		// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:132:1: expression : orExpr ;
		public expression_return expression() // throws RecognitionException [1]
		{
			var retval = new expression_return();
			retval.Start = input.LT( 1 );

			CommonTree root_0 = null;

			orExpr_return orExpr37 = default( orExpr_return );


			try
			{
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:133:2: ( orExpr )
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:133:4: orExpr
				{
					root_0 = (CommonTree)adaptor.GetNilNode();

					PushFollow( FOLLOW_orExpr_in_expression599 );
					orExpr37 = orExpr();
					state.followingStackPointer--;

					adaptor.AddChild( root_0, orExpr37.Tree );
				}

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

				retval.Tree = 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 = adaptor.ErrorNode( input, (IToken)retval.Start, input.LT( -1 ), re );
			}
			finally {}
			return retval;
		}
예제 #3
0
    // $ANTLR start expression
    // C:\\Documents and Settings\\Sébastien Ros\\Mes documents\\Développement\\NLinq\\NLinq.g:65:1: expression returns [Expression value] : expressionItem ( '[' expression ']' )? ;
    public expression_return expression() // throws RecognitionException [1]
    {   
        expression_return retval = new expression_return();
        retval.start = input.LT(1);
        
        CommonTree root_0 = null;
    
        IToken char_literal4 = null;
        IToken char_literal6 = null;
        expressionItem_return expressionItem3 = null;

        expression_return expression5 = null;
        
        
        CommonTree char_literal4_tree=null;
        CommonTree char_literal6_tree=null;
    
        try 
    	{
            // C:\\Documents and Settings\\Sébastien Ros\\Mes documents\\Développement\\NLinq\\NLinq.g:66:2: ( expressionItem ( '[' expression ']' )? )
            // C:\\Documents and Settings\\Sébastien Ros\\Mes documents\\Développement\\NLinq\\NLinq.g:66:4: expressionItem ( '[' expression ']' )?
            {
            	root_0 = (CommonTree)adaptor.GetNilNode();
            
            	PushFollow(FOLLOW_expressionItem_in_expression76);
            	expressionItem3 = expressionItem();
            	followingStackPointer_--;
            	
            	adaptor.AddChild(root_0, expressionItem3.Tree);
            	retval.value =  expressionItem3.value; 
            	// C:\\Documents and Settings\\Sébastien Ros\\Mes documents\\Développement\\NLinq\\NLinq.g:66:54: ( '[' expression ']' )?
            	int alt1 = 2;
            	int LA1_0 = input.LA(1);
            	
            	if ( (LA1_0 == 15) )
            	{
            	    alt1 = 1;
            	}
            	switch (alt1) 
            	{
            	    case 1 :
            	        // C:\\Documents and Settings\\Sébastien Ros\\Mes documents\\Développement\\NLinq\\NLinq.g:66:55: '[' expression ']'
            	        {
            	        	char_literal4 = (IToken)input.LT(1);
            	        	Match(input,15,FOLLOW_15_in_expression81); 
            	        	char_literal4_tree = (CommonTree)adaptor.Create(char_literal4);
            	        	adaptor.AddChild(root_0, char_literal4_tree);

            	        	PushFollow(FOLLOW_expression_in_expression83);
            	        	expression5 = expression();
            	        	followingStackPointer_--;
            	        	
            	        	adaptor.AddChild(root_0, expression5.Tree);
            	        	char_literal6 = (IToken)input.LT(1);
            	        	Match(input,16,FOLLOW_16_in_expression85); 
            	        	char_literal6_tree = (CommonTree)adaptor.Create(char_literal6);
            	        	adaptor.AddChild(root_0, char_literal6_tree);

            	        	 retval.value =  new Indexer(expressionItem3.value, retval.value); 
            	        
            	        }
            	        break;
            	
            	}

            
            }
    
            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;
    }