Inheritance: Antlr.Runtime.ParserRuleReturnScope
Ejemplo n.º 1
0
    // $ANTLR start "lessLine"
    // D:\\lesscss.g:34:10: fragment lessLine : ( ruleset | mediadefinition | ( variable -> ^( VAR variable ) ) );
    public lesscssParser.lessLine_return lessLine() // throws RecognitionException [1]
    {   
        lesscssParser.lessLine_return retval = new lesscssParser.lessLine_return();
        retval.Start = input.LT(1);

        CommonTree root_0 = null;

        lesscssParser.ruleset_return ruleset8 = null;

        lesscssParser.mediadefinition_return mediadefinition9 = null;

        lesscssParser.variable_return variable10 = null;


        RewriteRuleSubtreeStream stream_variable = new RewriteRuleSubtreeStream(adaptor,"rule variable");
        try 
    	{
            // D:\\lesscss.g:35:2: ( ruleset | mediadefinition | ( variable -> ^( VAR variable ) ) )
            int alt3 = 3;
            switch ( input.LA(1) ) 
            {
            case IDENT:
            case SelectorClass:
            case SelectorID:
            case 34:
            case 52:
            	{
                alt3 = 1;
                }
                break;
            case 39:
            	{
                alt3 = 2;
                }
                break;
            case 30:
            	{
                alt3 = 3;
                }
                break;
            	default:
            	    NoViableAltException nvae_d3s0 =
            	        new NoViableAltException("", 3, 0, input);

            	    throw nvae_d3s0;
            }

            switch (alt3) 
            {
                case 1 :
                    // D:\\lesscss.g:35:4: ruleset
                    {
                    	root_0 = (CommonTree)adaptor.GetNilNode();

                    	PushFollow(FOLLOW_ruleset_in_lessLine160);
                    	ruleset8 = ruleset();
                    	state.followingStackPointer--;

                    	adaptor.AddChild(root_0, ruleset8.Tree);

                    }
                    break;
                case 2 :
                    // D:\\lesscss.g:35:14: mediadefinition
                    {
                    	root_0 = (CommonTree)adaptor.GetNilNode();

                    	PushFollow(FOLLOW_mediadefinition_in_lessLine164);
                    	mediadefinition9 = mediadefinition();
                    	state.followingStackPointer--;

                    	adaptor.AddChild(root_0, mediadefinition9.Tree);

                    }
                    break;
                case 3 :
                    // D:\\lesscss.g:35:32: ( variable -> ^( VAR variable ) )
                    {
                    	// D:\\lesscss.g:35:32: ( variable -> ^( VAR variable ) )
                    	// D:\\lesscss.g:35:33: variable
                    	{
                    		PushFollow(FOLLOW_variable_in_lessLine169);
                    		variable10 = variable();
                    		state.followingStackPointer--;

                    		stream_variable.Add(variable10.Tree);


                    		// AST REWRITE
                    		// elements:          variable
                    		// token labels:      
                    		// rule labels:       retval
                    		// token list labels: 
                    		// rule list labels:  
                    		// wildcard labels: 
                    		retval.Tree = root_0;
                    		RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval!=null ? retval.Tree : null);

                    		root_0 = (CommonTree)adaptor.GetNilNode();
                    		// 35:42: -> ^( VAR variable )
                    		{
                    		    // D:\\lesscss.g:35:45: ^( VAR variable )
                    		    {
                    		    CommonTree root_1 = (CommonTree)adaptor.GetNilNode();
                    		    root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(VAR, "VAR"), root_1);

                    		    adaptor.AddChild(root_1, stream_variable.NextTree());

                    		    adaptor.AddChild(root_0, root_1);
                    		    }

                    		}

                    		retval.Tree = root_0;retval.Tree = root_0;
                    	}


                    }
                    break;

            }
            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;
    }
Ejemplo n.º 2
0
    // $ANTLR start "lessLine"
    // D:\\development\\Less.Net\\lesscss.g:37:10: fragment lessLine : ( ruleset -> ^( ruleset ) | mediadefinition -> ^( mediadefinition ) | variable -> ^( variable ) );
    public lesscssParser.lessLine_return lessLine() // throws RecognitionException [1]
    {   
        lesscssParser.lessLine_return retval = new lesscssParser.lessLine_return();
        retval.Start = input.LT(1);

        CommonTree root_0 = null;

        lesscssParser.ruleset_return ruleset8 = default(lesscssParser.ruleset_return);

        lesscssParser.mediadefinition_return mediadefinition9 = default(lesscssParser.mediadefinition_return);

        lesscssParser.variable_return variable10 = default(lesscssParser.variable_return);


        RewriteRuleSubtreeStream stream_ruleset = new RewriteRuleSubtreeStream(adaptor,"rule ruleset");
        RewriteRuleSubtreeStream stream_mediadefinition = new RewriteRuleSubtreeStream(adaptor,"rule mediadefinition");
        RewriteRuleSubtreeStream stream_variable = new RewriteRuleSubtreeStream(adaptor,"rule variable");
        try 
    	{
            // D:\\development\\Less.Net\\lesscss.g:38:2: ( ruleset -> ^( ruleset ) | mediadefinition -> ^( mediadefinition ) | variable -> ^( variable ) )
            int alt3 = 3;
            switch ( input.LA(1) ) 
            {
            case IDENT:
            case 49:
            case 50:
            	{
                alt3 = 1;
                }
                break;
            case 36:
            	{
                alt3 = 2;
                }
                break;
            case 26:
            	{
                alt3 = 3;
                }
                break;
            	default:
            	    NoViableAltException nvae_d3s0 =
            	        new NoViableAltException("", 3, 0, input);

            	    throw nvae_d3s0;
            }

            switch (alt3) 
            {
                case 1 :
                    // D:\\development\\Less.Net\\lesscss.g:38:4: ruleset
                    {
                    	PushFollow(FOLLOW_ruleset_in_lessLine172);
                    	ruleset8 = ruleset();
                    	state.followingStackPointer--;

                    	stream_ruleset.Add(ruleset8.Tree);


                    	// AST REWRITE
                    	// elements:          ruleset
                    	// token labels:      
                    	// rule labels:       retval
                    	// token list labels: 
                    	// rule list labels:  
                    	// wildcard labels: 
                    	retval.Tree = root_0;
                    	RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval!=null ? retval.Tree : null);

                    	root_0 = (CommonTree)adaptor.GetNilNode();
                    	// 38:12: -> ^( ruleset )
                    	{
                    	    // D:\\development\\Less.Net\\lesscss.g:38:15: ^( ruleset )
                    	    {
                    	    CommonTree root_1 = (CommonTree)adaptor.GetNilNode();
                    	    root_1 = (CommonTree)adaptor.BecomeRoot(stream_ruleset.NextNode(), root_1);

                    	    adaptor.AddChild(root_0, root_1);
                    	    }

                    	}

                    	retval.Tree = root_0;retval.Tree = root_0;
                    }
                    break;
                case 2 :
                    // D:\\development\\Less.Net\\lesscss.g:38:28: mediadefinition
                    {
                    	PushFollow(FOLLOW_mediadefinition_in_lessLine182);
                    	mediadefinition9 = mediadefinition();
                    	state.followingStackPointer--;

                    	stream_mediadefinition.Add(mediadefinition9.Tree);


                    	// AST REWRITE
                    	// elements:          mediadefinition
                    	// token labels:      
                    	// rule labels:       retval
                    	// token list labels: 
                    	// rule list labels:  
                    	// wildcard labels: 
                    	retval.Tree = root_0;
                    	RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval!=null ? retval.Tree : null);

                    	root_0 = (CommonTree)adaptor.GetNilNode();
                    	// 38:44: -> ^( mediadefinition )
                    	{
                    	    // D:\\development\\Less.Net\\lesscss.g:38:47: ^( mediadefinition )
                    	    {
                    	    CommonTree root_1 = (CommonTree)adaptor.GetNilNode();
                    	    root_1 = (CommonTree)adaptor.BecomeRoot(stream_mediadefinition.NextNode(), root_1);

                    	    adaptor.AddChild(root_0, root_1);
                    	    }

                    	}

                    	retval.Tree = root_0;retval.Tree = root_0;
                    }
                    break;
                case 3 :
                    // D:\\development\\Less.Net\\lesscss.g:38:68: variable
                    {
                    	PushFollow(FOLLOW_variable_in_lessLine192);
                    	variable10 = variable();
                    	state.followingStackPointer--;

                    	stream_variable.Add(variable10.Tree);


                    	// AST REWRITE
                    	// elements:          variable
                    	// token labels:      
                    	// rule labels:       retval
                    	// token list labels: 
                    	// rule list labels:  
                    	// wildcard labels: 
                    	retval.Tree = root_0;
                    	RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval!=null ? retval.Tree : null);

                    	root_0 = (CommonTree)adaptor.GetNilNode();
                    	// 38:77: -> ^( variable )
                    	{
                    	    // D:\\development\\Less.Net\\lesscss.g:38:80: ^( variable )
                    	    {
                    	    CommonTree root_1 = (CommonTree)adaptor.GetNilNode();
                    	    root_1 = (CommonTree)adaptor.BecomeRoot(stream_variable.NextNode(), root_1);

                    	    adaptor.AddChild(root_0, root_1);
                    	    }

                    	}

                    	retval.Tree = root_0;retval.Tree = root_0;
                    }
                    break;

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