Exemple #1
0
    // $ANTLR end "expr"


    // $ANTLR start "call"
    // BuildOptions\\DebugTreeGrammar.g3:74:0: call returns [BigInteger value] : ^( CALL ID expr ) ;
    private BigInteger call(  )
    {
        BigInteger value = default(BigInteger);

        CommonTree ID8   = null;
        BigInteger expr7 = default(BigInteger);

        try
        {
            dbg.EnterRule(GrammarFileName, "call");
            if (RuleLevel == 0)
            {
                dbg.Commence();
            }
            IncRuleLevel();
            dbg.Location(74, -1);

            try
            {
                // BuildOptions\\DebugTreeGrammar.g3:75:9: ( ^( CALL ID expr ) )
                dbg.EnterAlt(1);

                // BuildOptions\\DebugTreeGrammar.g3:75:9: ^( CALL ID expr )
                {
                    dbg.Location(75, 8);
                    dbg.Location(75, 10);
                    Match(input, CALL, Follow._CALL_in_call430);

                    Match(input, TokenConstants.DOWN, null);
                    dbg.Location(75, 15);
                    ID8 = (CommonTree)Match(input, ID, Follow._ID_in_call432);
                    dbg.Location(75, 18);
                    PushFollow(Follow._expr_in_call434);
                    expr7 = expr();

                    state._fsp--;


                    Match(input, TokenConstants.UP, null);
                    dbg.Location(75, 35);
                    BigInteger p        = expr7;
                    CommonTree funcRoot = findFunction((ID8 != null?ID8.Text:null), p);
                    if (funcRoot == null)
                    {
                        Console.Error.WriteLine("No match found for " + (ID8 != null?ID8.Text:null) + "(" + p + ")");
                    }
                    else
                    {
                        // Here we set up the local evaluator to run over the
                        // function definition with the parameter value.
                        // This re-reads a sub-AST of our input AST!
                        DebugTreeGrammar e = new DebugTreeGrammar(funcRoot, functionDefinitions, globalMemory, p);
                        value = e.expr();
                    }
                }
            }
            catch (RecognitionException re)
            {
                ReportError(re);
                Recover(input, re);
            }
            finally
            {
            }
            dbg.Location(87, 4);
        }
        finally
        {
            dbg.ExitRule(GrammarFileName, "call");
            DecRuleLevel();
            if (RuleLevel == 0)
            {
                dbg.Terminate();
            }
        }

        return(value);
    }
	// $ANTLR end "expr"


	// $ANTLR start "call"
	// BuildOptions\\DebugTreeGrammar.g3:74:0: call returns [BigInteger value] : ^( CALL ID expr ) ;
	private BigInteger call(  )
	{
		BigInteger value = default(BigInteger);

		CommonTree ID8=null;
		BigInteger expr7 = default(BigInteger);

		try
		{
			dbg.EnterRule( GrammarFileName, "call" );
			if ( RuleLevel == 0 )
			{
				dbg.Commence();
			}
			IncRuleLevel();
			dbg.Location( 74, -1 );

		try
		{
			// BuildOptions\\DebugTreeGrammar.g3:75:9: ( ^( CALL ID expr ) )
			dbg.EnterAlt( 1 );

			// BuildOptions\\DebugTreeGrammar.g3:75:9: ^( CALL ID expr )
			{
			dbg.Location( 75, 8 );
			dbg.Location( 75, 10 );
			Match(input,CALL,Follow._CALL_in_call430); 

			Match(input, TokenTypes.Down, null); 
			dbg.Location( 75, 15 );
			ID8=(CommonTree)Match(input,ID,Follow._ID_in_call432); 
			dbg.Location( 75, 18 );
			PushFollow(Follow._expr_in_call434);
			expr7=expr();

			state._fsp--;


			Match(input, TokenTypes.Up, null); 
			dbg.Location( 75, 35 );
			 BigInteger p = expr7;
			                                     CommonTree funcRoot = findFunction((ID8!=null?ID8.Text:null), p);
			                                     if (funcRoot == null) {
			                                         Console.Error.WriteLine("No match found for " + (ID8!=null?ID8.Text:null) + "(" + p + ")");
			                                     } else {
			                                         // Here we set up the local evaluator to run over the
			                                         // function definition with the parameter value.
			                                         // This re-reads a sub-AST of our input AST!
			                                         DebugTreeGrammar e = new DebugTreeGrammar(funcRoot, functionDefinitions, globalMemory, p);
			                                         value = e.expr();
			                                     }
			                                   

			}

		}
		catch ( RecognitionException re )
		{
			ReportError(re);
			Recover(input,re);
		}
		finally
		{
		}
		dbg.Location(87, 4);

		}
		finally
		{
			dbg.ExitRule( GrammarFileName, "call" );
			DecRuleLevel();
			if ( RuleLevel == 0 )
			{
				dbg.Terminate();
			}
		}

		return value;
	}