当前位置: 首页>>代码示例>>C#>>正文


C# RewriteRuleSubtreeStream.Next方法代码示例

本文整理汇总了C#中Antlr.Runtime.Tree.RewriteRuleSubtreeStream.Next方法的典型用法代码示例。如果您正苦于以下问题:C# RewriteRuleSubtreeStream.Next方法的具体用法?C# RewriteRuleSubtreeStream.Next怎么用?C# RewriteRuleSubtreeStream.Next使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Antlr.Runtime.Tree.RewriteRuleSubtreeStream的用法示例。


在下文中一共展示了RewriteRuleSubtreeStream.Next方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: propOrIdent

        // throws RecognitionException [1]
        // $ANTLR start propOrIdent
        // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1462:1: propOrIdent[CommonTree identPrimary, IToken startToken] : DOT propId= qualifiedIdent -> ^( PROPERTY_OR_IDENTIFIER $propId) ;
        public propOrIdent_return propOrIdent(CommonTree identPrimary, IToken startToken)
        {
            propOrIdent_return retval = new propOrIdent_return();
            retval.start = input.LT(1);
            int propOrIdent_StartIndex = input.Index();
            CommonTree root_0 = null;

            CommonToken DOT296 = null;
            qualifiedIdent_return propId = null;

            CommonTree DOT296_tree=null;
            RewriteRuleTokenStream stream_DOT = new RewriteRuleTokenStream(adaptor,"token DOT");
            RewriteRuleSubtreeStream stream_qualifiedIdent = new RewriteRuleSubtreeStream(adaptor,"rule qualifiedIdent");
            try
            {
            if ( (backtracking > 0) && AlreadyParsedRule(input, 112) )
            {
                return retval;
            }
            // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1464:9: ( DOT propId= qualifiedIdent -> ^( PROPERTY_OR_IDENTIFIER $propId) )
            // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1464:9: DOT propId= qualifiedIdent
            {
                if ( backtracking == 0 )
                {
                   retval.start = startToken;
                }
                DOT296 = (CommonToken)input.LT(1);
                Match(input,DOT,FOLLOW_DOT_in_propOrIdent5290); if (failed) return retval;
                if ( backtracking==0 ) stream_DOT.Add(DOT296);

                if ( backtracking == 0 )
                {
                   buffer.Append(".");
                }
                PushFollow(FOLLOW_qualifiedIdent_in_propOrIdent5303);
                propId = qualifiedIdent();
                followingStackPointer_--;
                if (failed) return retval;
                if ( backtracking==0 ) stream_qualifiedIdent.Add(propId.Tree);

                // AST REWRITE
                // elements:          propId
                // token labels:
                // rule labels:       propId, retval
                // token list labels:
                // rule list labels:
                if ( backtracking==0 ) {
                retval.tree = root_0;
                RewriteRuleSubtreeStream stream_propId = new RewriteRuleSubtreeStream(adaptor, "token propId", (propId!=null ? propId.Tree : null));
                RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "token retval", (retval!=null ? retval.Tree : null));

                root_0 = (CommonTree)adaptor.GetNilNode();
                // 1467:3: -> ^( PROPERTY_OR_IDENTIFIER $propId)
                {
                    // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1467:6: ^( PROPERTY_OR_IDENTIFIER $propId)
                    {
                    CommonTree root_1 = (CommonTree)adaptor.GetNilNode();
                    root_1 = (CommonTree)adaptor.BecomeRoot(adaptor.Create(PROPERTY_OR_IDENTIFIER, "PROPERTY_OR_IDENTIFIER"), root_1);

                    adaptor.AddChild(root_1, identPrimary);
                    adaptor.AddChild(root_1, stream_propId.Next());

                    adaptor.AddChild(root_0, root_1);
                    }

                }

                }

            }

            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 )
//.........这里部分代码省略.........
开发者ID:nomilogic,项目名称:fdplugins,代码行数:101,代码来源:ASParser.cs

示例2: forIter

        // throws RecognitionException [1]
        // $ANTLR start forIter
        // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:958:1: forIter : ( expressionList )? -> ^( FOR_ITERATOR ( expressionList )? ) ;
        public forIter_return forIter()
        {
            InOperator_stack.Push(new InOperator_scope());

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

            expressionList_return expressionList157 = null;

            RewriteRuleSubtreeStream stream_expressionList = new RewriteRuleSubtreeStream(adaptor,"rule expressionList");

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

            try
            {
            if ( (backtracking > 0) && AlreadyParsedRule(input, 60) )
            {
                return retval;
            }
            // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:963:4: ( ( expressionList )? -> ^( FOR_ITERATOR ( expressionList )? ) )
            // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:963:4: ( expressionList )?
            {
                // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:963:4: ( expressionList )?
                int alt44 = 2;
                int LA44_0 = input.LA(1);

                if ( (LA44_0 == LCURLY || (LA44_0 >= STRING_LITERAL && LA44_0 <= SET) || LA44_0 == LPAREN || LA44_0 == VOID || LA44_0 == IDENT || LA44_0 == LBRACK || LA44_0 == DYNAMIC || (LA44_0 >= IS && LA44_0 <= AS) || (LA44_0 >= PLUS && LA44_0 <= MINUS) || (LA44_0 >= INC && LA44_0 <= NEW) || (LA44_0 >= USE && LA44_0 <= XML)) )
                {
                    alt44 = 1;
                }
                switch (alt44)
                {
                    case 1 :
                        // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:0:0: expressionList
                        {
                            PushFollow(FOLLOW_expressionList_in_forIter3016);
                            expressionList157 = expressionList();
                            followingStackPointer_--;
                            if (failed) return retval;
                            if ( backtracking==0 ) stream_expressionList.Add(expressionList157.Tree);

                        }
                        break;

                }

                // AST REWRITE
                // elements:          expressionList
                // token labels:
                // rule labels:       retval
                // token list labels:
                // rule list labels:
                if ( backtracking==0 ) {
                retval.tree = root_0;
                RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "token retval", (retval!=null ? retval.Tree : null));

                root_0 = (CommonTree)adaptor.GetNilNode();
                // 964:3: -> ^( FOR_ITERATOR ( expressionList )? )
                {
                    // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:964:6: ^( FOR_ITERATOR ( expressionList )? )
                    {
                    CommonTree root_1 = (CommonTree)adaptor.GetNilNode();
                    root_1 = (CommonTree)adaptor.BecomeRoot(adaptor.Create(FOR_ITERATOR, "FOR_ITERATOR"), root_1);

                    // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:964:21: ( expressionList )?
                    if ( stream_expressionList.HasNext() )
                    {
                        adaptor.AddChild(root_1, stream_expressionList.Next());

                    }
                    stream_expressionList.Reset();

                    adaptor.AddChild(root_0, root_1);
                    }

                }

                }

            }

            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)
//.........这里部分代码省略.........
开发者ID:nomilogic,项目名称:fdplugins,代码行数:101,代码来源:ASParser.cs

示例3: fullNewSubexpression

        // throws RecognitionException [1]
        // $ANTLR start fullNewSubexpression
        // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1492:1: fullNewSubexpression : ( primaryExpression -> primaryExpression ) ( DOT qualifiedIdent -> ^( DOT $fullNewSubexpression qualifiedIdent ) | brackets -> ^( ARRAY_ACC $fullNewSubexpression brackets ) )* ;
        public fullNewSubexpression_return fullNewSubexpression()
        {
            fullNewSubexpression_return retval = new fullNewSubexpression_return();
            retval.start = input.LT(1);
            int fullNewSubexpression_StartIndex = input.Index();
            CommonTree root_0 = null;

            CommonToken DOT306 = null;
            primaryExpression_return primaryExpression305 = null;

            qualifiedIdent_return qualifiedIdent307 = null;

            brackets_return brackets308 = null;

            CommonTree DOT306_tree=null;
            RewriteRuleTokenStream stream_DOT = new RewriteRuleTokenStream(adaptor,"token DOT");
            RewriteRuleSubtreeStream stream_primaryExpression = new RewriteRuleSubtreeStream(adaptor,"rule primaryExpression");
            RewriteRuleSubtreeStream stream_brackets = new RewriteRuleSubtreeStream(adaptor,"rule brackets");
            RewriteRuleSubtreeStream stream_qualifiedIdent = new RewriteRuleSubtreeStream(adaptor,"rule qualifiedIdent");
            try
            {
            if ( (backtracking > 0) && AlreadyParsedRule(input, 116) )
            {
                return retval;
            }
            // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1493:4: ( ( primaryExpression -> primaryExpression ) ( DOT qualifiedIdent -> ^( DOT $fullNewSubexpression qualifiedIdent ) | brackets -> ^( ARRAY_ACC $fullNewSubexpression brackets ) )* )
            // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1493:4: ( primaryExpression -> primaryExpression ) ( DOT qualifiedIdent -> ^( DOT $fullNewSubexpression qualifiedIdent ) | brackets -> ^( ARRAY_ACC $fullNewSubexpression brackets ) )*
            {
                // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1493:4: ( primaryExpression -> primaryExpression )
                // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1493:6: primaryExpression
                {
                    PushFollow(FOLLOW_primaryExpression_in_fullNewSubexpression5424);
                    primaryExpression305 = primaryExpression();
                    followingStackPointer_--;
                    if (failed) return retval;
                    if ( backtracking==0 ) stream_primaryExpression.Add(primaryExpression305.Tree);

                    // AST REWRITE
                    // elements:          primaryExpression
                    // token labels:
                    // rule labels:       retval
                    // token list labels:
                    // rule list labels:
                    if ( backtracking==0 ) {
                    retval.tree = root_0;
                    RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "token retval", (retval!=null ? retval.Tree : null));

                    root_0 = (CommonTree)adaptor.GetNilNode();
                    // 1493:24: -> primaryExpression
                    {
                        adaptor.AddChild(root_0, stream_primaryExpression.Next());

                    }

                    }

                }

                // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1495:3: ( DOT qualifiedIdent -> ^( DOT $fullNewSubexpression qualifiedIdent ) | brackets -> ^( ARRAY_ACC $fullNewSubexpression brackets ) )*
                do
                {
                    int alt86 = 3;
                    int LA86_0 = input.LA(1);

                    if ( (LA86_0 == DOT) )
                    {
                        alt86 = 1;
                    }
                    else if ( (LA86_0 == LBRACK) )
                    {
                        alt86 = 2;
                    }

                    switch (alt86)
                    {
                        case 1 :
                            // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1495:5: DOT qualifiedIdent
                            {
                                DOT306 = (CommonToken)input.LT(1);
                                Match(input,DOT,FOLLOW_DOT_in_fullNewSubexpression5438); if (failed) return retval;
                                if ( backtracking==0 ) stream_DOT.Add(DOT306);

                                if ( backtracking == 0 )
                                {
                                   buffer.Append(".");
                                }
                                PushFollow(FOLLOW_qualifiedIdent_in_fullNewSubexpression5443);
                                qualifiedIdent307 = qualifiedIdent();
                                followingStackPointer_--;
                                if (failed) return retval;
                                if ( backtracking==0 ) stream_qualifiedIdent.Add(qualifiedIdent307.Tree);

                                // AST REWRITE
                                // elements:          fullNewSubexpression, DOT, qualifiedIdent
                                // token labels:
                                // rule labels:       retval
                                // token list labels:
//.........这里部分代码省略.........
开发者ID:nomilogic,项目名称:fdplugins,代码行数:101,代码来源:ASParser.cs

示例4: conditionalExpression

        // throws RecognitionException [1]
        // $ANTLR start conditionalExpression
        // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1261:1: conditionalExpression : ( logicalOrExpression -> logicalOrExpression ) ( QUESTION conditionalSubExpression -> ^( QUESTION $conditionalExpression conditionalSubExpression ) )? ;
        public conditionalExpression_return conditionalExpression()
        {
            conditionalExpression_return retval = new conditionalExpression_return();
            retval.start = input.LT(1);
            int conditionalExpression_StartIndex = input.Index();
            CommonTree root_0 = null;

            CommonToken QUESTION232 = null;
            logicalOrExpression_return logicalOrExpression231 = null;

            conditionalSubExpression_return conditionalSubExpression233 = null;

            CommonTree QUESTION232_tree=null;
            RewriteRuleTokenStream stream_QUESTION = new RewriteRuleTokenStream(adaptor,"token QUESTION");
            RewriteRuleSubtreeStream stream_logicalOrExpression = new RewriteRuleSubtreeStream(adaptor,"rule logicalOrExpression");
            RewriteRuleSubtreeStream stream_conditionalSubExpression = new RewriteRuleSubtreeStream(adaptor,"rule conditionalSubExpression");
            try
            {
            if ( (backtracking > 0) && AlreadyParsedRule(input, 89) )
            {
                return retval;
            }
            // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1262:4: ( ( logicalOrExpression -> logicalOrExpression ) ( QUESTION conditionalSubExpression -> ^( QUESTION $conditionalExpression conditionalSubExpression ) )? )
            // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1262:4: ( logicalOrExpression -> logicalOrExpression ) ( QUESTION conditionalSubExpression -> ^( QUESTION $conditionalExpression conditionalSubExpression ) )?
            {
                // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1262:4: ( logicalOrExpression -> logicalOrExpression )
                // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1262:5: logicalOrExpression
                {
                    PushFollow(FOLLOW_logicalOrExpression_in_conditionalExpression4317);
                    logicalOrExpression231 = logicalOrExpression();
                    followingStackPointer_--;
                    if (failed) return retval;
                    if ( backtracking==0 ) stream_logicalOrExpression.Add(logicalOrExpression231.Tree);

                    // AST REWRITE
                    // elements:          logicalOrExpression
                    // token labels:
                    // rule labels:       retval
                    // token list labels:
                    // rule list labels:
                    if ( backtracking==0 ) {
                    retval.tree = root_0;
                    RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "token retval", (retval!=null ? retval.Tree : null));

                    root_0 = (CommonTree)adaptor.GetNilNode();
                    // 1262:25: -> logicalOrExpression
                    {
                        adaptor.AddChild(root_0, stream_logicalOrExpression.Next());

                    }

                    }

                }

                // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1263:3: ( QUESTION conditionalSubExpression -> ^( QUESTION $conditionalExpression conditionalSubExpression ) )?
                int alt68 = 2;
                int LA68_0 = input.LA(1);

                if ( (LA68_0 == QUESTION) )
                {
                    alt68 = 1;
                }
                switch (alt68)
                {
                    case 1 :
                        // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1264:4: QUESTION conditionalSubExpression
                        {
                            QUESTION232 = (CommonToken)input.LT(1);
                            Match(input,QUESTION,FOLLOW_QUESTION_in_conditionalExpression4331); if (failed) return retval;
                            if ( backtracking==0 ) stream_QUESTION.Add(QUESTION232);

                            if ( backtracking == 0 )
                            {

                              							if(options.SpaceBetweenOperators) buffer.Append(" ");
                              							buffer.Append("?");
                              							if(options.SpaceBetweenOperators) buffer.Append(" ");

                            }
                            PushFollow(FOLLOW_conditionalSubExpression_in_conditionalExpression4338);
                            conditionalSubExpression233 = conditionalSubExpression();
                            followingStackPointer_--;
                            if (failed) return retval;
                            if ( backtracking==0 ) stream_conditionalSubExpression.Add(conditionalSubExpression233.Tree);

                            // AST REWRITE
                            // elements:          conditionalSubExpression, QUESTION, conditionalExpression
                            // token labels:
                            // rule labels:       retval
                            // token list labels:
                            // rule list labels:
                            if ( backtracking==0 ) {
                            retval.tree = root_0;
                            RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "token retval", (retval!=null ? retval.Tree : null));

                            root_0 = (CommonTree)adaptor.GetNilNode();
//.........这里部分代码省略.........
开发者ID:nomilogic,项目名称:fdplugins,代码行数:101,代码来源:ASParser.cs

示例5: expressionList

        // throws RecognitionException [1]
        // $ANTLR start expressionList
        // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1222:1: expressionList : assignmentExpression ( COMMA assignmentExpression )* -> ^( ELIST assignmentExpression ( COMMA assignmentExpression )* ) ;
        public expressionList_return expressionList()
        {
            expressionList_return retval = new expressionList_return();
            retval.start = input.LT(1);
            int expressionList_StartIndex = input.Index();
            CommonTree root_0 = null;

            CommonToken COMMA227 = null;
            assignmentExpression_return assignmentExpression226 = null;

            assignmentExpression_return assignmentExpression228 = null;

            CommonTree COMMA227_tree=null;
            RewriteRuleTokenStream stream_COMMA = new RewriteRuleTokenStream(adaptor,"token COMMA");
            RewriteRuleSubtreeStream stream_assignmentExpression = new RewriteRuleSubtreeStream(adaptor,"rule assignmentExpression");
            try
            {
            if ( (backtracking > 0) && AlreadyParsedRule(input, 86) )
            {
                return retval;
            }
            // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1223:4: ( assignmentExpression ( COMMA assignmentExpression )* -> ^( ELIST assignmentExpression ( COMMA assignmentExpression )* ) )
            // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1223:4: assignmentExpression ( COMMA assignmentExpression )*
            {
                PushFollow(FOLLOW_assignmentExpression_in_expressionList4132);
                assignmentExpression226 = assignmentExpression();
                followingStackPointer_--;
                if (failed) return retval;
                if ( backtracking==0 ) stream_assignmentExpression.Add(assignmentExpression226.Tree);
                // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1224:3: ( COMMA assignmentExpression )*
                do
                {
                    int alt66 = 2;
                    int LA66_0 = input.LA(1);

                    if ( (LA66_0 == COMMA) )
                    {
                        alt66 = 1;
                    }

                    switch (alt66)
                    {
                        case 1 :
                            // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1225:4: COMMA assignmentExpression
                            {
                                COMMA227 = (CommonToken)input.LT(1);
                                Match(input,COMMA,FOLLOW_COMMA_in_expressionList4142); if (failed) return retval;
                                if ( backtracking==0 ) stream_COMMA.Add(COMMA227);

                                if ( backtracking == 0 )
                                {
                                  buffer.Append(options.SpaceBetweenArguments ? ", " : ",");
                                }
                                PushFollow(FOLLOW_assignmentExpression_in_expressionList4154);
                                assignmentExpression228 = assignmentExpression();
                                followingStackPointer_--;
                                if (failed) return retval;
                                if ( backtracking==0 ) stream_assignmentExpression.Add(assignmentExpression228.Tree);

                            }
                            break;

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

                loop66:
                    ;	// Stops C# compiler whinging that label 'loop66' has no statements

                // AST REWRITE
                // elements:          assignmentExpression, assignmentExpression, COMMA
                // token labels:
                // rule labels:       retval
                // token list labels:
                // rule list labels:
                if ( backtracking==0 ) {
                retval.tree = root_0;
                RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "token retval", (retval!=null ? retval.Tree : null));

                root_0 = (CommonTree)adaptor.GetNilNode();
                // 1227:6: -> ^( ELIST assignmentExpression ( COMMA assignmentExpression )* )
                {
                    // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1227:9: ^( ELIST assignmentExpression ( COMMA assignmentExpression )* )
                    {
                    CommonTree root_1 = (CommonTree)adaptor.GetNilNode();
                    root_1 = (CommonTree)adaptor.BecomeRoot(adaptor.Create(ELIST, "ELIST"), root_1);

                    adaptor.AddChild(root_1, stream_assignmentExpression.Next());
                    // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1227:38: ( COMMA assignmentExpression )*
                    while ( stream_assignmentExpression.HasNext() || stream_COMMA.HasNext() )
                    {
                        adaptor.AddChild(root_1, stream_COMMA.Next());
                        adaptor.AddChild(root_1, stream_assignmentExpression.Next());

                    }
                    stream_assignmentExpression.Reset();
//.........这里部分代码省略.........
开发者ID:nomilogic,项目名称:fdplugins,代码行数:101,代码来源:ASParser.cs

示例6: comment


//.........这里部分代码省略.........
                                        followingStackPointer_--;
                                        if (failed) return retval;
                                        if ( backtracking==0 ) stream_comment.Add(comment311.Tree);

                                    }
                                    break;

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

                        loop88:
                            ;	// Stops C# compiler whinging that label 'loop88' has no statements

                        // AST REWRITE
                        // elements:          singleCommentStatement, comment
                        // token labels:
                        // rule labels:       retval
                        // token list labels:
                        // rule list labels:
                        if ( backtracking==0 ) {
                        retval.tree = root_0;
                        RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "token retval", (retval!=null ? retval.Tree : null));

                        root_0 = (CommonTree)adaptor.GetNilNode();
                        // 1513:36: -> ^( COMMENT_ENTRY singleCommentStatement ) ( comment )*
                        {
                            // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1513:39: ^( COMMENT_ENTRY singleCommentStatement )
                            {
                            CommonTree root_1 = (CommonTree)adaptor.GetNilNode();
                            root_1 = (CommonTree)adaptor.BecomeRoot(adaptor.Create(COMMENT_ENTRY, "COMMENT_ENTRY"), root_1);

                            adaptor.AddChild(root_1, stream_singleCommentStatement.Next());

                            adaptor.AddChild(root_0, root_1);
                            }
                            // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1513:79: ( comment )*
                            while ( stream_comment.HasNext() )
                            {
                                adaptor.AddChild(root_0, stream_comment.Next());

                            }
                            stream_comment.Reset();

                        }

                        }

                    }
                    break;
                case 2 :
                    // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1514:4: multiCommentStatement ( comment )*
                    {
                        PushFollow(FOLLOW_multiCommentStatement_in_comment5542);
                        multiCommentStatement312 = multiCommentStatement();
                        followingStackPointer_--;
                        if (failed) return retval;
                        if ( backtracking==0 ) stream_multiCommentStatement.Add(multiCommentStatement312.Tree);
                        // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1514:27: ( comment )*
                        do
                        {
                            int alt89 = 2;
                            int LA89_0 = input.LA(1);

                            if ( (LA89_0 == SL_COMMENT) )
开发者ID:nomilogic,项目名称:fdplugins,代码行数:67,代码来源:ASParser.cs

示例7: compilationUnit

        // throws RecognitionException [1]
        // $ANTLR start compilationUnit
        // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:329:1: compilationUnit[StringBuilder ret] : as2CompilationUnit -> ^( COMPILATION_UNIT as2CompilationUnit ) ;
        public compilationUnit_return compilationUnit(StringBuilder ret)
        {
            compilationUnit_return retval = new compilationUnit_return();
            retval.start = input.LT(1);
            int compilationUnit_StartIndex = input.Index();
            CommonTree root_0 = null;

            as2CompilationUnit_return as2CompilationUnit1 = null;

            RewriteRuleSubtreeStream stream_as2CompilationUnit = new RewriteRuleSubtreeStream(adaptor,"rule as2CompilationUnit");

            buffer = ret;

            try
            {
            if ( (backtracking > 0) && AlreadyParsedRule(input, 1) )
            {
                return retval;
            }
            // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:336:4: ( as2CompilationUnit -> ^( COMPILATION_UNIT as2CompilationUnit ) )
            // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:336:4: as2CompilationUnit
            {
                PushFollow(FOLLOW_as2CompilationUnit_in_compilationUnit437);
                as2CompilationUnit1 = as2CompilationUnit();
                followingStackPointer_--;
                if (failed) return retval;
                if ( backtracking==0 ) stream_as2CompilationUnit.Add(as2CompilationUnit1.Tree);

                // AST REWRITE
                // elements:          as2CompilationUnit
                // token labels:
                // rule labels:       retval
                // token list labels:
                // rule list labels:
                if ( backtracking==0 ) {
                retval.tree = root_0;
                RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "token retval", (retval!=null ? retval.Tree : null));

                root_0 = (CommonTree)adaptor.GetNilNode();
                // 336:23: -> ^( COMPILATION_UNIT as2CompilationUnit )
                {
                    // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:336:26: ^( COMPILATION_UNIT as2CompilationUnit )
                    {
                    CommonTree root_1 = (CommonTree)adaptor.GetNilNode();
                    root_1 = (CommonTree)adaptor.BecomeRoot(adaptor.Create(COMPILATION_UNIT, "COMPILATION_UNIT"), root_1);

                    adaptor.AddChild(root_1, stream_as2CompilationUnit.Next());

                    adaptor.AddChild(root_0, root_1);
                    }

                }

                }

            }

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

            if ( backtracking==0 )
            {	retval.tree = (CommonTree)adaptor.RulePostProcessing(root_0);
                adaptor.SetTokenBoundaries(retval.Tree, retval.start, retval.stop);
            }
            if ( backtracking == 0 )
            {

              	finalize();

            }
            }

            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, 1, compilationUnit_StartIndex);
            }
            }
            return retval;
        }
开发者ID:nomilogic,项目名称:fdplugins,代码行数:98,代码来源:ASParser.cs

示例8: typeExpression


//.........这里部分代码省略.........
                        }
                        break;
                    case 3 :
                        // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1021:6: STAR
                        {
                            STAR171 = (CommonToken)input.LT(1);
                            Match(input,STAR,FOLLOW_STAR_in_typeExpression3183); if (failed) return retval;
                            if ( backtracking==0 ) stream_STAR.Add(STAR171);

                            if ( backtracking == 0 )
                            {
                               buffer.Append("*");
                            }

                        }
                        break;

                }

                // AST REWRITE
                // elements:          STAR, VOID, identifier
                // token labels:
                // rule labels:       retval
                // token list labels:
                // rule list labels:
                if ( backtracking==0 ) {
                retval.tree = root_0;
                RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "token retval", (retval!=null ? retval.Tree : null));

                root_0 = (CommonTree)adaptor.GetNilNode();
                // 1023:3: -> ^( TYPE_SPEC[$c] ( identifier )? ( VOID )? ( STAR )? )
                {
                    // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1023:6: ^( TYPE_SPEC[$c] ( identifier )? ( VOID )? ( STAR )? )
                    {
                    CommonTree root_1 = (CommonTree)adaptor.GetNilNode();
                    root_1 = (CommonTree)adaptor.BecomeRoot(adaptor.Create(TYPE_SPEC, c), root_1);

                    // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1023:22: ( identifier )?
                    if ( stream_identifier.HasNext() )
                    {
                        adaptor.AddChild(root_1, stream_identifier.Next());

                    }
                    stream_identifier.Reset();
                    // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1023:34: ( VOID )?
                    if ( stream_VOID.HasNext() )
                    {
                        adaptor.AddChild(root_1, stream_VOID.Next());

                    }
                    stream_VOID.Reset();
                    // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1023:40: ( STAR )?
                    if ( stream_STAR.HasNext() )
                    {
                        adaptor.AddChild(root_1, stream_STAR.Next());

                    }
                    stream_STAR.Reset();

                    adaptor.AddChild(root_0, root_1);
                    }

                }

                }

            }

            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, 64, typeExpression_StartIndex);
            }
            }
            return retval;
        }
开发者ID:nomilogic,项目名称:fdplugins,代码行数:101,代码来源:ASParser.cs

示例9: unaryExpression


//.........这里部分代码省略.........
                    {
                        iin = (CommonToken)input.LT(1);
                        Match(input,INC,FOLLOW_INC_in_unaryExpression4884); if (failed) return retval;
                        if ( backtracking==0 ) stream_INC.Add(iin);

                        if ( backtracking == 0 )
                        {
                           buffer.Append(iin.Text);
                        }
                        PushFollow(FOLLOW_unaryExpression_in_unaryExpression4889);
                        unaryExpression274 = unaryExpression();
                        followingStackPointer_--;
                        if (failed) return retval;
                        if ( backtracking==0 ) stream_unaryExpression.Add(unaryExpression274.Tree);

                        // AST REWRITE
                        // elements:          unaryExpression
                        // token labels:
                        // rule labels:       retval
                        // token list labels:
                        // rule list labels:
                        if ( backtracking==0 ) {
                        retval.tree = root_0;
                        RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "token retval", (retval!=null ? retval.Tree : null));

                        root_0 = (CommonTree)adaptor.GetNilNode();
                        // 1421:59: -> ^( PRE_INC[$iin] unaryExpression )
                        {
                            // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1421:62: ^( PRE_INC[$iin] unaryExpression )
                            {
                            CommonTree root_1 = (CommonTree)adaptor.GetNilNode();
                            root_1 = (CommonTree)adaptor.BecomeRoot(adaptor.Create(PRE_INC, iin), root_1);

                            adaptor.AddChild(root_1, stream_unaryExpression.Next());

                            adaptor.AddChild(root_0, root_1);
                            }

                        }

                        }

                    }
                    break;
                case 2 :
                    // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1422:4: dde= DEC unaryExpression
                    {
                        dde = (CommonToken)input.LT(1);
                        Match(input,DEC,FOLLOW_DEC_in_unaryExpression4906); if (failed) return retval;
                        if ( backtracking==0 ) stream_DEC.Add(dde);

                        if ( backtracking == 0 )
                        {
                           buffer.Append(dde.Text);
                        }
                        PushFollow(FOLLOW_unaryExpression_in_unaryExpression4911);
                        unaryExpression275 = unaryExpression();
                        followingStackPointer_--;
                        if (failed) return retval;
                        if ( backtracking==0 ) stream_unaryExpression.Add(unaryExpression275.Tree);

                        // AST REWRITE
                        // elements:          unaryExpression
                        // token labels:
                        // rule labels:       retval
                        // token list labels:
开发者ID:nomilogic,项目名称:fdplugins,代码行数:67,代码来源:ASParser.cs

示例10: switchStatementList

        // throws RecognitionException [1]
        // $ANTLR start switchStatementList
        // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:866:1: switchStatementList : ( statement )* -> ^( SWITCH_STATEMENT_LIST ( statement )* ) ;
        public switchStatementList_return switchStatementList()
        {
            switchStatementList_return retval = new switchStatementList_return();
            retval.start = input.LT(1);
            int switchStatementList_StartIndex = input.Index();
            CommonTree root_0 = null;

            statement_return statement139 = null;

            RewriteRuleSubtreeStream stream_statement = new RewriteRuleSubtreeStream(adaptor,"rule statement");
            try
            {
            if ( (backtracking > 0) && AlreadyParsedRule(input, 52) )
            {
                return retval;
            }
            // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:867:4: ( ( statement )* -> ^( SWITCH_STATEMENT_LIST ( statement )* ) )
            // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:867:4: ( statement )*
            {
                // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:867:4: ( statement )*
                do
                {
                    int alt39 = 2;
                    int LA39_0 = input.LA(1);

                    if ( (LA39_0 == SEMI || LA39_0 == LCURLY || (LA39_0 >= STRING_LITERAL && LA39_0 <= CONST) || LA39_0 == LPAREN || LA39_0 == IF || (LA39_0 >= RETURN && LA39_0 <= SWITCH) || LA39_0 == FOR || (LA39_0 >= WHILE && LA39_0 <= VOID) || LA39_0 == IDENT || LA39_0 == LBRACK || LA39_0 == DYNAMIC || (LA39_0 >= IS && LA39_0 <= AS) || (LA39_0 >= PLUS && LA39_0 <= MINUS) || (LA39_0 >= INC && LA39_0 <= XML) || (LA39_0 >= 176 && LA39_0 <= 177)) )
                    {
                        alt39 = 1;
                    }

                    switch (alt39)
                    {
                        case 1 :
                            // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:867:6: statement
                            {
                                if ( backtracking == 0 )
                                {
                                  buffer.Append(NewLine + tab);
                                }
                                PushFollow(FOLLOW_statement_in_switchStatementList2661);
                                statement139 = statement();
                                followingStackPointer_--;
                                if (failed) return retval;
                                if ( backtracking==0 ) stream_statement.Add(statement139.Tree);

                            }
                            break;

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

                loop39:
                    ;	// Stops C# compiler whinging that label 'loop39' has no statements

                // AST REWRITE
                // elements:          statement
                // token labels:
                // rule labels:       retval
                // token list labels:
                // rule list labels:
                if ( backtracking==0 ) {
                retval.tree = root_0;
                RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "token retval", (retval!=null ? retval.Tree : null));

                root_0 = (CommonTree)adaptor.GetNilNode();
                // 867:51: -> ^( SWITCH_STATEMENT_LIST ( statement )* )
                {
                    // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:867:54: ^( SWITCH_STATEMENT_LIST ( statement )* )
                    {
                    CommonTree root_1 = (CommonTree)adaptor.GetNilNode();
                    root_1 = (CommonTree)adaptor.BecomeRoot(adaptor.Create(SWITCH_STATEMENT_LIST, "SWITCH_STATEMENT_LIST"), root_1);

                    // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:867:78: ( statement )*
                    while ( stream_statement.HasNext() )
                    {
                        adaptor.AddChild(root_1, stream_statement.Next());

                    }
                    stream_statement.Reset();

                    adaptor.AddChild(root_0, root_1);
                    }

                }

                }

            }

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

            if ( backtracking==0 )
            {	retval.tree = (CommonTree)adaptor.RulePostProcessing(root_0);
                adaptor.SetTokenBoundaries(retval.Tree, retval.start, retval.stop);
            }
//.........这里部分代码省略.........
开发者ID:nomilogic,项目名称:fdplugins,代码行数:101,代码来源:ASParser.cs

示例11: typeBlock

        // throws RecognitionException [1]
        // $ANTLR start typeBlock
        // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:453:1: typeBlock : LCURLY ( typeBlockEntry )* RCURLY -> ^( TYPE_BLOCK ( typeBlockEntry )* ) ;
        public typeBlock_return typeBlock()
        {
            typeBlock_return retval = new typeBlock_return();
            retval.start = input.LT(1);
            int typeBlock_StartIndex = input.Index();
            CommonTree root_0 = null;

            CommonToken LCURLY24 = null;
            CommonToken RCURLY26 = null;
            typeBlockEntry_return typeBlockEntry25 = null;

            CommonTree LCURLY24_tree=null;
            CommonTree RCURLY26_tree=null;
            RewriteRuleTokenStream stream_LCURLY = new RewriteRuleTokenStream(adaptor,"token LCURLY");
            RewriteRuleTokenStream stream_RCURLY = new RewriteRuleTokenStream(adaptor,"token RCURLY");
            RewriteRuleSubtreeStream stream_typeBlockEntry = new RewriteRuleSubtreeStream(adaptor,"rule typeBlockEntry");
            try
            {
            if ( (backtracking > 0) && AlreadyParsedRule(input, 14) )
            {
                return retval;
            }
            // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:454:4: ( LCURLY ( typeBlockEntry )* RCURLY -> ^( TYPE_BLOCK ( typeBlockEntry )* ) )
            // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:454:4: LCURLY ( typeBlockEntry )* RCURLY
            {
                LCURLY24 = (CommonToken)input.LT(1);
                Match(input,LCURLY,FOLLOW_LCURLY_in_typeBlock973); if (failed) return retval;
                if ( backtracking==0 ) stream_LCURLY.Add(LCURLY24);

                // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:455:3: ( typeBlockEntry )*
                do
                {
                    int alt10 = 2;
                    int LA10_0 = input.LA(1);

                    if ( (LA10_0 == IMPORT || LA10_0 == INCLUDE_DIRECTIVE || LA10_0 == FUNCTION || (LA10_0 >= VAR && LA10_0 <= CONST) || (LA10_0 >= IDENT && LA10_0 <= LBRACK) || (LA10_0 >= STATIC && LA10_0 <= DYNAMIC) || (LA10_0 >= SL_COMMENT && LA10_0 <= ML_COMMENT) || LA10_0 == 175 || (LA10_0 >= 180 && LA10_0 <= 184)) )
                    {
                        alt10 = 1;
                    }

                    switch (alt10)
                    {
                        case 1 :
                            // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:455:4: typeBlockEntry
                            {
                                PushFollow(FOLLOW_typeBlockEntry_in_typeBlock978);
                                typeBlockEntry25 = typeBlockEntry();
                                followingStackPointer_--;
                                if (failed) return retval;
                                if ( backtracking==0 ) stream_typeBlockEntry.Add(typeBlockEntry25.Tree);

                            }
                            break;

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

                loop10:
                    ;	// Stops C# compiler whinging that label 'loop10' has no statements

                RCURLY26 = (CommonToken)input.LT(1);
                Match(input,RCURLY,FOLLOW_RCURLY_in_typeBlock984); if (failed) return retval;
                if ( backtracking==0 ) stream_RCURLY.Add(RCURLY26);

                // AST REWRITE
                // elements:          typeBlockEntry
                // token labels:
                // rule labels:       retval
                // token list labels:
                // rule list labels:
                if ( backtracking==0 ) {
                retval.tree = root_0;
                RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "token retval", (retval!=null ? retval.Tree : null));

                root_0 = (CommonTree)adaptor.GetNilNode();
                // 457:3: -> ^( TYPE_BLOCK ( typeBlockEntry )* )
                {
                    // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:457:6: ^( TYPE_BLOCK ( typeBlockEntry )* )
                    {
                    CommonTree root_1 = (CommonTree)adaptor.GetNilNode();
                    root_1 = (CommonTree)adaptor.BecomeRoot(adaptor.Create(TYPE_BLOCK, "TYPE_BLOCK"), root_1);

                    // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:457:19: ( typeBlockEntry )*
                    while ( stream_typeBlockEntry.HasNext() )
                    {
                        adaptor.AddChild(root_1, stream_typeBlockEntry.Next());

                    }
                    stream_typeBlockEntry.Reset();

                    adaptor.AddChild(root_0, root_1);
                    }

                }

//.........这里部分代码省略.........
开发者ID:nomilogic,项目名称:fdplugins,代码行数:101,代码来源:ASParser.cs

示例12: annotationParam


//.........这里部分代码省略.........
                        followingStackPointer_--;
                        if (failed) return retval;
                        if ( backtracking==0 ) stream_ident.Add(ide1.Tree);
                        ASSIGN191 = (CommonToken)input.LT(1);
                        Match(input,ASSIGN,FOLLOW_ASSIGN_in_annotationParam3609); if (failed) return retval;
                        if ( backtracking==0 ) stream_ASSIGN.Add(ASSIGN191);

                        PushFollow(FOLLOW_constant_in_annotationParam3613);
                        cn1 = constant();
                        followingStackPointer_--;
                        if (failed) return retval;
                        if ( backtracking==0 ) stream_constant.Add(cn1.Tree);
                        if ( backtracking == 0 )
                        {
                           buffer.Append(((CommonTree)ide1.Tree).Text + "=" + ((CommonTree)cn1.Tree).Text);
                        }

                        // AST REWRITE
                        // elements:          ASSIGN, ident, constant
                        // token labels:
                        // rule labels:       retval
                        // token list labels:
                        // rule list labels:
                        if ( backtracking==0 ) {
                        retval.tree = root_0;
                        RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "token retval", (retval!=null ? retval.Tree : null));

                        root_0 = (CommonTree)adaptor.GetNilNode();
                        // 1090:119: -> ^( ASSIGN ident constant )
                        {
                            // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1090:122: ^( ASSIGN ident constant )
                            {
                            CommonTree root_1 = (CommonTree)adaptor.GetNilNode();
                            root_1 = (CommonTree)adaptor.BecomeRoot(stream_ASSIGN.Next(), root_1);

                            adaptor.AddChild(root_1, stream_ident.Next());
                            adaptor.AddChild(root_1, stream_constant.Next());

                            adaptor.AddChild(root_0, root_1);
                            }

                        }

                        }

                    }
                    break;
                case 2 :
                    // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1091:4: ide2= ident ASSIGN ide3= ident
                    {
                        PushFollow(FOLLOW_ident_in_annotationParam3632);
                        ide2 = ident();
                        followingStackPointer_--;
                        if (failed) return retval;
                        if ( backtracking==0 ) stream_ident.Add(ide2.Tree);
                        ASSIGN192 = (CommonToken)input.LT(1);
                        Match(input,ASSIGN,FOLLOW_ASSIGN_in_annotationParam3634); if (failed) return retval;
                        if ( backtracking==0 ) stream_ASSIGN.Add(ASSIGN192);

                        PushFollow(FOLLOW_ident_in_annotationParam3638);
                        ide3 = ident();
                        followingStackPointer_--;
                        if (failed) return retval;
                        if ( backtracking==0 ) stream_ident.Add(ide3.Tree);
                        if ( backtracking == 0 )
                        {
开发者ID:nomilogic,项目名称:fdplugins,代码行数:67,代码来源:ASParser.cs

示例13: switchBlock


//.........这里部分代码省略.........
                              buffer.Append(NewLine + tab);
                            }
                            PushFollow(FOLLOW_defaultStatement_in_switchBlock2539);
                            defaultStatement132 = defaultStatement();
                            followingStackPointer_--;
                            if (failed) return retval;
                            if ( backtracking==0 ) stream_defaultStatement.Add(defaultStatement132.Tree);

                        }
                        break;

                }

                RCURLY133 = (CommonToken)input.LT(1);
                Match(input,RCURLY,FOLLOW_RCURLY_in_switchBlock2545); if (failed) return retval;
                if ( backtracking==0 ) stream_RCURLY.Add(RCURLY133);

                if ( backtracking == 0 )
                {

                  												CurrentTab--;
                  												buffer.Append(NewLine + tab);
                  												buffer.Append("}");

                }

                // AST REWRITE
                // elements:          defaultStatement, caseStatement
                // token labels:
                // rule labels:       retval
                // token list labels:
                // rule list labels:
                if ( backtracking==0 ) {
                retval.tree = root_0;
                RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "token retval", (retval!=null ? retval.Tree : null));

                root_0 = (CommonTree)adaptor.GetNilNode();
                // 842:3: -> ^( BLOCK ( caseStatement )* ( defaultStatement )? )
                {
                    // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:842:6: ^( BLOCK ( caseStatement )* ( defaultStatement )? )
                    {
                    CommonTree root_1 = (CommonTree)adaptor.GetNilNode();
                    root_1 = (CommonTree)adaptor.BecomeRoot(adaptor.Create(BLOCK, "BLOCK"), root_1);

                    // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:842:14: ( caseStatement )*
                    while ( stream_caseStatement.HasNext() )
                    {
                        adaptor.AddChild(root_1, stream_caseStatement.Next());

                    }
                    stream_caseStatement.Reset();
                    // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:842:29: ( defaultStatement )?
                    if ( stream_defaultStatement.HasNext() )
                    {
                        adaptor.AddChild(root_1, stream_defaultStatement.Next());

                    }
                    stream_defaultStatement.Reset();

                    adaptor.AddChild(root_0, root_1);
                    }

                }

                }

            }

            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, 49, switchBlock_StartIndex);
            }
            }
            return retval;
        }
开发者ID:nomilogic,项目名称:fdplugins,代码行数:101,代码来源:ASParser.cs

示例14: annotation

        // throws RecognitionException [1]
        // $ANTLR start annotation
        // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1067:1: annotation : LBRACK ide= ident ( annotationParamList )? RBRACK -> ^( ANNOTATION ident ( annotationParamList )? ) ;
        public annotation_return annotation()
        {
            annotation_return retval = new annotation_return();
            retval.start = input.LT(1);
            int annotation_StartIndex = input.Index();
            CommonTree root_0 = null;

            CommonToken LBRACK183 = null;
            CommonToken RBRACK185 = null;
            ident_return ide = null;

            annotationParamList_return annotationParamList184 = null;

            CommonTree LBRACK183_tree=null;
            CommonTree RBRACK185_tree=null;
            RewriteRuleTokenStream stream_LBRACK = new RewriteRuleTokenStream(adaptor,"token LBRACK");
            RewriteRuleTokenStream stream_RBRACK = new RewriteRuleTokenStream(adaptor,"token RBRACK");
            RewriteRuleSubtreeStream stream_annotationParamList = new RewriteRuleSubtreeStream(adaptor,"rule annotationParamList");
            RewriteRuleSubtreeStream stream_ident = new RewriteRuleSubtreeStream(adaptor,"rule ident");
            try
            {
            if ( (backtracking > 0) && AlreadyParsedRule(input, 71) )
            {
                return retval;
            }
            // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1068:4: ( LBRACK ide= ident ( annotationParamList )? RBRACK -> ^( ANNOTATION ident ( annotationParamList )? ) )
            // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1068:4: LBRACK ide= ident ( annotationParamList )? RBRACK
            {
                LBRACK183 = (CommonToken)input.LT(1);
                Match(input,LBRACK,FOLLOW_LBRACK_in_annotation3466); if (failed) return retval;
                if ( backtracking==0 ) stream_LBRACK.Add(LBRACK183);

                if ( backtracking == 0 )
                {
                   buffer.Append("[");
                }
                PushFollow(FOLLOW_ident_in_annotation3478);
                ide = ident();
                followingStackPointer_--;
                if (failed) return retval;
                if ( backtracking==0 ) stream_ident.Add(ide.Tree);
                if ( backtracking == 0 )
                {
                   buffer.Append(((CommonTree)ide.Tree).Text);
                }
                // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1070:3: ( annotationParamList )?
                int alt51 = 2;
                int LA51_0 = input.LA(1);

                if ( (LA51_0 == LPAREN) )
                {
                    alt51 = 1;
                }
                switch (alt51)
                {
                    case 1 :
                        // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:0:0: annotationParamList
                        {
                            PushFollow(FOLLOW_annotationParamList_in_annotation3487);
                            annotationParamList184 = annotationParamList();
                            followingStackPointer_--;
                            if (failed) return retval;
                            if ( backtracking==0 ) stream_annotationParamList.Add(annotationParamList184.Tree);

                        }
                        break;

                }

                RBRACK185 = (CommonToken)input.LT(1);
                Match(input,RBRACK,FOLLOW_RBRACK_in_annotation3492); if (failed) return retval;
                if ( backtracking==0 ) stream_RBRACK.Add(RBRACK185);

                if ( backtracking == 0 )
                {
                   buffer.Append("]");
                }

                // AST REWRITE
                // elements:          ident, annotationParamList
                // token labels:
                // rule labels:       retval
                // token list labels:
                // rule list labels:
                if ( backtracking==0 ) {
                retval.tree = root_0;
                RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "token retval", (retval!=null ? retval.Tree : null));

                root_0 = (CommonTree)adaptor.GetNilNode();
                // 1072:3: -> ^( ANNOTATION ident ( annotationParamList )? )
                {
                    // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1072:6: ^( ANNOTATION ident ( annotationParamList )? )
                    {
                    CommonTree root_1 = (CommonTree)adaptor.GetNilNode();
                    root_1 = (CommonTree)adaptor.BecomeRoot(adaptor.Create(ANNOTATION, "ANNOTATION"), root_1);

                    adaptor.AddChild(root_1, stream_ident.Next());
//.........这里部分代码省略.........
开发者ID:nomilogic,项目名称:fdplugins,代码行数:101,代码来源:ASParser.cs

示例15: basicParameterDeclaration


//.........这里部分代码省略.........
                    alt27 = 1;
                }
                switch (alt27)
                {
                    case 1 :
                        // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:0:0: parameterDefault
                        {
                            PushFollow(FOLLOW_parameterDefault_in_basicParameterDeclaration1834);
                            parameterDefault69 = parameterDefault();
                            followingStackPointer_--;
                            if (failed) return retval;
                            if ( backtracking==0 ) stream_parameterDefault.Add(parameterDefault69.Tree);

                        }
                        break;

                }

                // AST REWRITE
                // elements:          ident, CONST, parameterDefault, typeExpression
                // token labels:
                // rule labels:       retval
                // token list labels:
                // rule list labels:
                if ( backtracking==0 ) {
                retval.tree = root_0;
                RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "token retval", (retval!=null ? retval.Tree : null));

                root_0 = (CommonTree)adaptor.GetNilNode();
                // 640:3: -> ^( PARAM ( CONST )? ident ( typeExpression )? ( parameterDefault )? )
                {
                    // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:640:6: ^( PARAM ( CONST )? ident ( typeExpression )? ( parameterDefault )? )
                    {
                    CommonTree root_1 = (CommonTree)adaptor.GetNilNode();
                    root_1 = (CommonTree)adaptor.BecomeRoot(adaptor.Create(PARAM, "PARAM"), root_1);

                    // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:640:14: ( CONST )?
                    if ( stream_CONST.HasNext() )
                    {
                        adaptor.AddChild(root_1, stream_CONST.Next());

                    }
                    stream_CONST.Reset();
                    adaptor.AddChild(root_1, stream_ident.Next());
                    // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:640:27: ( typeExpression )?
                    if ( stream_typeExpression.HasNext() )
                    {
                        adaptor.AddChild(root_1, stream_typeExpression.Next());

                    }
                    stream_typeExpression.Reset();
                    // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:640:43: ( parameterDefault )?
                    if ( stream_parameterDefault.HasNext() )
                    {
                        adaptor.AddChild(root_1, stream_parameterDefault.Next());

                    }
                    stream_parameterDefault.Reset();

                    adaptor.AddChild(root_0, root_1);
                    }

                }

                }

            }

            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, 31, basicParameterDeclaration_StartIndex);
            }
            }
            return retval;
        }
开发者ID:nomilogic,项目名称:fdplugins,代码行数:101,代码来源:ASParser.cs


注:本文中的Antlr.Runtime.Tree.RewriteRuleSubtreeStream.Next方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。