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


C# RewriteRuleSubtreeStream.HasNext方法代码示例

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


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

示例1: identifier

        // throws RecognitionException [1]
        // $ANTLR start identifier
        // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1026:1: identifier : qualifiedIdent ( options {greedy=true; } : DOT qualifiedIdent )* -> ^( IDENTIFIER ( qualifiedIdent )+ ) ;
        public identifier_return identifier()
        {
            identifier_return retval = new identifier_return();
            retval.start = input.LT(1);
            int identifier_StartIndex = input.Index();
            CommonTree root_0 = null;

            CommonToken DOT173 = null;
            qualifiedIdent_return qualifiedIdent172 = null;

            qualifiedIdent_return qualifiedIdent174 = null;

            CommonTree DOT173_tree=null;
            RewriteRuleTokenStream stream_DOT = new RewriteRuleTokenStream(adaptor,"token DOT");
            RewriteRuleSubtreeStream stream_qualifiedIdent = new RewriteRuleSubtreeStream(adaptor,"rule qualifiedIdent");
            try
            {
            if ( (backtracking > 0) && AlreadyParsedRule(input, 65) )
            {
                return retval;
            }
            // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1027:4: ( qualifiedIdent ( options {greedy=true; } : DOT qualifiedIdent )* -> ^( IDENTIFIER ( qualifiedIdent )+ ) )
            // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1027:4: qualifiedIdent ( options {greedy=true; } : DOT qualifiedIdent )*
            {
                PushFollow(FOLLOW_qualifiedIdent_in_identifier3221);
                qualifiedIdent172 = qualifiedIdent();
                followingStackPointer_--;
                if (failed) return retval;
                if ( backtracking==0 ) stream_qualifiedIdent.Add(qualifiedIdent172.Tree);
                if ( backtracking == 0 )
                {

                }
                // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1028:3: ( options {greedy=true; } : DOT qualifiedIdent )*
                do
                {
                    int alt46 = 2;
                    int LA46_0 = input.LA(1);

                    if ( (LA46_0 == DOT) )
                    {
                        alt46 = 1;
                    }

                    switch (alt46)
                    {
                        case 1 :
                            // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1029:6: DOT qualifiedIdent
                            {
                                DOT173 = (CommonToken)input.LT(1);
                                Match(input,DOT,FOLLOW_DOT_in_identifier3245); if (failed) return retval;
                                if ( backtracking==0 ) stream_DOT.Add(DOT173);

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

                            }
                            break;

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

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

                // AST REWRITE
                // elements:          qualifiedIdent
                // 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();
                // 1031:3: -> ^( IDENTIFIER ( qualifiedIdent )+ )
                {
                    // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1031:6: ^( IDENTIFIER ( qualifiedIdent )+ )
                    {
                    CommonTree root_1 = (CommonTree)adaptor.GetNilNode();
                    root_1 = (CommonTree)adaptor.BecomeRoot(adaptor.Create(IDENTIFIER, "IDENTIFIER"), root_1);

                    if ( !(stream_qualifiedIdent.HasNext()) ) {
                        throw new RewriteEarlyExitException();
                    }
                    while ( stream_qualifiedIdent.HasNext() )
                    {
//.........这里部分代码省略.........
开发者ID:nomilogic,项目名称:fdplugins,代码行数:101,代码来源:ASParser.cs

示例2: classDeclaration

		// $ANTLR start "classDeclaration"
		// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:79:1: classDeclaration : 'class' name ( baseClassDeclaration )? classStatementBlock -> ^( CLASS name ( baseClassDeclaration )? classStatementBlock ) ;
		public classDeclaration_return classDeclaration() // throws RecognitionException [1]
		{
			var retval = new classDeclaration_return();
			retval.Start = input.LT( 1 );

			CommonTree root_0 = null;

			IToken string_literal4 = null;
			name_return name5 = default( name_return );

			baseClassDeclaration_return baseClassDeclaration6 = default( baseClassDeclaration_return );

			classStatementBlock_return classStatementBlock7 = default( classStatementBlock_return );


			CommonTree string_literal4_tree = null;
			var stream_57 = new RewriteRuleTokenStream( adaptor, "token 57" );
			var stream_classStatementBlock = new RewriteRuleSubtreeStream( adaptor, "rule classStatementBlock" );
			var stream_name = new RewriteRuleSubtreeStream( adaptor, "rule name" );
			var stream_baseClassDeclaration = new RewriteRuleSubtreeStream( adaptor, "rule baseClassDeclaration" );
			try
			{
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:80:2: ( 'class' name ( baseClassDeclaration )? classStatementBlock -> ^( CLASS name ( baseClassDeclaration )? classStatementBlock ) )
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:80:4: 'class' name ( baseClassDeclaration )? classStatementBlock
				{
					string_literal4 = (IToken)Match( input, 57, FOLLOW_57_in_classDeclaration262 );
					stream_57.Add( string_literal4 );

					PushFollow( FOLLOW_name_in_classDeclaration264 );
					name5 = name();
					state.followingStackPointer--;

					stream_name.Add( name5.Tree );
					// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:80:17: ( baseClassDeclaration )?
					int alt3 = 2;
					int LA3_0 = input.LA( 1 );

					if ( ( LA3_0 == 58 ) )
						alt3 = 1;
					switch ( alt3 )
					{
						case 1:
							// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:80:17: baseClassDeclaration
							{
								PushFollow( FOLLOW_baseClassDeclaration_in_classDeclaration266 );
								baseClassDeclaration6 = baseClassDeclaration();
								state.followingStackPointer--;

								stream_baseClassDeclaration.Add( baseClassDeclaration6.Tree );
							}
							break;
					}

					PushFollow( FOLLOW_classStatementBlock_in_classDeclaration269 );
					classStatementBlock7 = classStatementBlock();
					state.followingStackPointer--;

					stream_classStatementBlock.Add( classStatementBlock7.Tree );


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

					root_0 = (CommonTree)adaptor.GetNilNode();
					// 80:59: -> ^( CLASS name ( baseClassDeclaration )? classStatementBlock )
					{
						// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:80:62: ^( CLASS name ( baseClassDeclaration )? classStatementBlock )
						{
							var root_1 = (CommonTree)adaptor.GetNilNode();
							root_1 = (CommonTree)adaptor.BecomeRoot( adaptor.Create( CLASS, "CLASS" ), root_1 );

							adaptor.AddChild( root_1, stream_name.NextTree() );
							// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:80:76: ( baseClassDeclaration )?
							if ( stream_baseClassDeclaration.HasNext() )
								adaptor.AddChild( root_1, stream_baseClassDeclaration.NextTree() );
							stream_baseClassDeclaration.Reset();
							adaptor.AddChild( root_1, stream_classStatementBlock.NextTree() );

							adaptor.AddChild( root_0, root_1 );
						}
					}

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

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

				retval.Tree = adaptor.RulePostProcessing( root_0 );
				adaptor.SetTokenBoundaries( retval.Tree, (IToken)retval.Start, (IToken)retval.Stop );
			}
//.........这里部分代码省略.........
开发者ID:ChrisEdwards,项目名称:CalcEngine,代码行数:101,代码来源:AntlrCalcEngineParser.cs

示例3: classStatementBlock

		// $ANTLR start "classStatementBlock"
		// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:85:1: classStatementBlock : '{' ( classLevelStatement )* '}' -> ^( STATEMENT_BLOCK ( classLevelStatement )* ) ;
		public classStatementBlock_return classStatementBlock() // throws RecognitionException [1]
		{
			var retval = new classStatementBlock_return();
			retval.Start = input.LT( 1 );

			CommonTree root_0 = null;

			IToken char_literal12 = null;
			IToken char_literal14 = null;
			classLevelStatement_return classLevelStatement13 = default( classLevelStatement_return );


			CommonTree char_literal12_tree = null;
			CommonTree char_literal14_tree = null;
			var stream_60 = new RewriteRuleTokenStream( adaptor, "token 60" );
			var stream_61 = new RewriteRuleTokenStream( adaptor, "token 61" );
			var stream_classLevelStatement = new RewriteRuleSubtreeStream( adaptor, "rule classLevelStatement" );
			try
			{
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:86:2: ( '{' ( classLevelStatement )* '}' -> ^( STATEMENT_BLOCK ( classLevelStatement )* ) )
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:86:4: '{' ( classLevelStatement )* '}'
				{
					char_literal12 = (IToken)Match( input, 60, FOLLOW_60_in_classStatementBlock328 );
					stream_60.Add( char_literal12 );

					// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:86:8: ( classLevelStatement )*
					do
					{
						int alt4 = 2;
						int LA4_0 = input.LA( 1 );

						if ( ( LA4_0 == 62 || LA4_0 == 67 ) )
							alt4 = 1;


						switch ( alt4 )
						{
							case 1:
								// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:86:8: classLevelStatement
								{
									PushFollow( FOLLOW_classLevelStatement_in_classStatementBlock330 );
									classLevelStatement13 = classLevelStatement();
									state.followingStackPointer--;

									stream_classLevelStatement.Add( classLevelStatement13.Tree );
								}
								break;

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

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

					char_literal14 = (IToken)Match( input, 61, FOLLOW_61_in_classStatementBlock333 );
					stream_61.Add( char_literal14 );


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

					root_0 = (CommonTree)adaptor.GetNilNode();
					// 86:33: -> ^( STATEMENT_BLOCK ( classLevelStatement )* )
					{
						// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:86:36: ^( STATEMENT_BLOCK ( classLevelStatement )* )
						{
							var root_1 = (CommonTree)adaptor.GetNilNode();
							root_1 = (CommonTree)adaptor.BecomeRoot( adaptor.Create( STATEMENT_BLOCK, "STATEMENT_BLOCK" ), root_1 );

							// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:86:55: ( classLevelStatement )*
							while ( stream_classLevelStatement.HasNext() )
								adaptor.AddChild( root_1, stream_classLevelStatement.NextTree() );
							stream_classLevelStatement.Reset();

							adaptor.AddChild( root_0, root_1 );
						}
					}

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

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

				retval.Tree = adaptor.RulePostProcessing( root_0 );
				adaptor.SetTokenBoundaries( retval.Tree, (IToken)retval.Start, (IToken)retval.Stop );
			}
			catch ( RecognitionException re )
			{
//.........这里部分代码省略.........
开发者ID:ChrisEdwards,项目名称:CalcEngine,代码行数:101,代码来源:AntlrCalcEngineParser.cs

示例4: 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

示例5: functionDefinition


//.........这里部分代码省略.........
                            if (failed) return retval;
                            if ( backtracking==0 ) stream_typeExpression.Add(type_exp.Tree);

                        }
                        break;

                }

                if ( backtracking == 0 )
                {

                  										if(options.NewlineAfterMethod) buffer.Append(NewLine + tab);
                  										buffer.Append("{");
                  										CurrentTab++;

                }
                PushFollow(FOLLOW_block_in_functionDefinition5729);
                block323 = block();
                followingStackPointer_--;
                if (failed) return retval;
                if ( backtracking==0 ) stream_block.Add(block323.Tree);
                if ( backtracking == 0 )
                {

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

                }

                // AST REWRITE
                // elements:          block, parameterDeclarationList, 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();
                // 1565:3: -> ^( FUNC_DEF parameterDeclarationList ( typeExpression )? block )
                {
                    // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1565:6: ^( FUNC_DEF parameterDeclarationList ( typeExpression )? block )
                    {
                    CommonTree root_1 = (CommonTree)adaptor.GetNilNode();
                    root_1 = (CommonTree)adaptor.BecomeRoot(adaptor.Create(FUNC_DEF, "FUNC_DEF"), root_1);

                    adaptor.AddChild(root_1, stream_parameterDeclarationList.Next());
                    // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1565:42: ( typeExpression )?
                    if ( stream_typeExpression.HasNext() )
                    {
                        adaptor.AddChild(root_1, stream_typeExpression.Next());

                    }
                    stream_typeExpression.Reset();
                    adaptor.AddChild(root_1, stream_block.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 )
            {
                Memoize(input, 123, functionDefinition_StartIndex);
            }
            }
            return retval;
        }
开发者ID:nomilogic,项目名称:fdplugins,代码行数:101,代码来源:ASParser.cs

示例6: 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

示例7: comment


//.........这里部分代码省略.........
                                    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) )
                            {
                                int LA89_15 = input.LA(2);

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

示例8: optionalAccessorRole

        // throws RecognitionException [1]
        // $ANTLR start optionalAccessorRole
        // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:546:1: optionalAccessorRole : ( accessorRole )? -> ^( ACCESSOR_ROLE ( accessorRole )? ) ;
        public optionalAccessorRole_return optionalAccessorRole()
        {
            optionalAccessorRole_return retval = new optionalAccessorRole_return();
            retval.start = input.LT(1);
            int optionalAccessorRole_StartIndex = input.Index();
            CommonTree root_0 = null;

            accessorRole_return accessorRole47 = null;

            RewriteRuleSubtreeStream stream_accessorRole = new RewriteRuleSubtreeStream(adaptor,"rule accessorRole");
            try
            {
            if ( (backtracking > 0) && AlreadyParsedRule(input, 21) )
            {
                return retval;
            }
            // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:547:4: ( ( accessorRole )? -> ^( ACCESSOR_ROLE ( accessorRole )? ) )
            // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:547:4: ( accessorRole )?
            {
                // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:547:4: ( accessorRole )?
                int alt17 = 2;
                int LA17_0 = input.LA(1);

                if ( (LA17_0 == GET) )
                {
                    int LA17_1 = input.LA(2);

                    if ( ((LA17_1 >= GET && LA17_1 <= SET) || LA17_1 == IDENT || LA17_1 == DYNAMIC || (LA17_1 >= IS && LA17_1 <= AS) || (LA17_1 >= USE && LA17_1 <= XML)) )
                    {
                        alt17 = 1;
                    }
                }
                else if ( (LA17_0 == SET) )
                {
                    int LA17_2 = input.LA(2);

                    if ( ((LA17_2 >= GET && LA17_2 <= SET) || LA17_2 == IDENT || LA17_2 == DYNAMIC || (LA17_2 >= IS && LA17_2 <= AS) || (LA17_2 >= USE && LA17_2 <= XML)) )
                    {
                        alt17 = 1;
                    }
                }
                switch (alt17)
                {
                    case 1 :
                        // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:0:0: accessorRole
                        {
                            PushFollow(FOLLOW_accessorRole_in_optionalAccessorRole1447);
                            accessorRole47 = accessorRole();
                            followingStackPointer_--;
                            if (failed) return retval;
                            if ( backtracking==0 ) stream_accessorRole.Add(accessorRole47.Tree);

                        }
                        break;

                }

                // AST REWRITE
                // elements:          accessorRole
                // 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();
                // 548:3: -> ^( ACCESSOR_ROLE ( accessorRole )? )
                {
                    // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:548:6: ^( ACCESSOR_ROLE ( accessorRole )? )
                    {
                    CommonTree root_1 = (CommonTree)adaptor.GetNilNode();
                    root_1 = (CommonTree)adaptor.BecomeRoot(adaptor.Create(ACCESSOR_ROLE, "ACCESSOR_ROLE"), root_1);

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

                    }
                    stream_accessorRole.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

示例9: parameterDeclarationList


//.........这里部分代码省略.........
                                               buffer.Append(options.SpaceBetweenArguments ? ", " : ",");
                                            }
                                            PushFollow(FOLLOW_parameterDeclaration_in_parameterDeclarationList1754);
                                            parameterDeclaration65 = parameterDeclaration();
                                            followingStackPointer_--;
                                            if (failed) return retval;
                                            if ( backtracking==0 ) stream_parameterDeclaration.Add(parameterDeclaration65.Tree);

                                        }
                                        break;

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

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

                        }
                        break;

                }

                RPAREN66 = (CommonToken)input.LT(1);
                Match(input,RPAREN,FOLLOW_RPAREN_in_parameterDeclarationList1769); if (failed) return retval;
                if ( backtracking==0 ) stream_RPAREN.Add(RPAREN66);

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

                // AST REWRITE
                // elements:          parameterDeclaration
                // 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();
                // 627:3: -> ^( PARAMS ( parameterDeclaration )* )
                {
                    // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:627:6: ^( PARAMS ( parameterDeclaration )* )
                    {
                    CommonTree root_1 = (CommonTree)adaptor.GetNilNode();
                    root_1 = (CommonTree)adaptor.BecomeRoot(adaptor.Create(PARAMS, "PARAMS"), root_1);

                    // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:627:15: ( parameterDeclaration )*
                    while ( stream_parameterDeclaration.HasNext() )
                    {
                        adaptor.AddChild(root_1, stream_parameterDeclaration.Next());

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

示例10: modifiers

        // throws RecognitionException [1]
        // $ANTLR start modifiers
        // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1097:1: modifiers : ( modifier )* -> ^( MODIFIERS ( modifier )* ) ;
        public modifiers_return modifiers()
        {
            modifiers_return retval = new modifiers_return();
            retval.start = input.LT(1);
            int modifiers_StartIndex = input.Index();
            CommonTree root_0 = null;

            modifier_return modifier193 = null;

            RewriteRuleSubtreeStream stream_modifier = new RewriteRuleSubtreeStream(adaptor,"rule modifier");
            try
            {
            if ( (backtracking > 0) && AlreadyParsedRule(input, 74) )
            {
                return retval;
            }
            // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1098:4: ( ( modifier )* -> ^( MODIFIERS ( modifier )* ) )
            // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1098:4: ( modifier )*
            {
                // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1098:4: ( modifier )*
                do
                {
                    int alt55 = 2;
                    int LA55_0 = input.LA(1);

                    if ( ((LA55_0 >= IDENT && LA55_0 <= INTERNAL) || (LA55_0 >= STATIC && LA55_0 <= DYNAMIC) || (LA55_0 >= 180 && LA55_0 <= 184)) )
                    {
                        alt55 = 1;
                    }

                    switch (alt55)
                    {
                        case 1 :
                            // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:0:0: modifier
                            {
                                PushFollow(FOLLOW_modifier_in_modifiers3690);
                                modifier193 = modifier();
                                followingStackPointer_--;
                                if (failed) return retval;
                                if ( backtracking==0 ) stream_modifier.Add(modifier193.Tree);

                            }
                            break;

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

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

                // AST REWRITE
                // elements:          modifier
                // 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();
                // 1099:3: -> ^( MODIFIERS ( modifier )* )
                {
                    // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1099:6: ^( MODIFIERS ( modifier )* )
                    {
                    CommonTree root_1 = (CommonTree)adaptor.GetNilNode();
                    root_1 = (CommonTree)adaptor.BecomeRoot(adaptor.Create(MODIFIERS, "MODIFIERS"), root_1);

                    // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1099:18: ( modifier )*
                    while ( stream_modifier.HasNext() )
                    {
                        adaptor.AddChild(root_1, stream_modifier.Next());

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

示例11: objectLiteral


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

                        }
                        break;

                }

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

                if ( backtracking == 0 )
                {

                  							if(next_token != ASLexer.RCURLY && options.NewlineBetweenFields)
                  							{
                  								CurrentTab--;
                  								buffer.Append(NewLine + tab);
                  							}
                  							buffer.Append("}");

                }

                // AST REWRITE
                // elements:          fieldList
                // 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();
                // 1181:3: -> ^( OBJECT_LITERAL ( fieldList )? )
                {
                    // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1181:6: ^( OBJECT_LITERAL ( fieldList )? )
                    {
                    CommonTree root_1 = (CommonTree)adaptor.GetNilNode();
                    root_1 = (CommonTree)adaptor.BecomeRoot(adaptor.Create(OBJECT_LITERAL, "OBJECT_LITERAL"), root_1);

                    // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1181:23: ( fieldList )?
                    if ( stream_fieldList.HasNext() )
                    {
                        adaptor.AddChild(root_1, stream_fieldList.Next());

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

示例12: methodDefinition


//.........这里部分代码省略.........

                    if ( backtracking == 0 )
                    {
                       insertComment(c1, true, false);
                    }
                    PushFollow(FOLLOW_block_in_methodDefinition1358);
                    block45 = block();
                    followingStackPointer_--;
                    if (failed) return retval;
                    if ( backtracking==0 ) stream_block.Add(block45.Tree);
                    PushFollow(FOLLOW_semi_in_methodDefinition1360);
                    semi46 = semi();
                    followingStackPointer_--;
                    if (failed) return retval;
                    if ( backtracking==0 ) stream_semi.Add(semi46.Tree);

                }

                if ( backtracking == 0 )
                {

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

                }

                // AST REWRITE
                // elements:          block, parameterDeclarationList, ident, typeExpression, optionalAccessorRole
                // 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();
                // 538:3: -> ^( METHOD_DEF optionalAccessorRole ident parameterDeclarationList ( typeExpression )? block )
                {
                    // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:538:6: ^( METHOD_DEF optionalAccessorRole ident parameterDeclarationList ( typeExpression )? block )
                    {
                    CommonTree root_1 = (CommonTree)adaptor.GetNilNode();
                    root_1 = (CommonTree)adaptor.BecomeRoot(adaptor.Create(METHOD_DEF, "METHOD_DEF"), root_1);

                    adaptor.AddChild(root_1, mods);
                    adaptor.AddChild(root_1, stream_optionalAccessorRole.Next());
                    adaptor.AddChild(root_1, stream_ident.Next());
                    adaptor.AddChild(root_1, stream_parameterDeclarationList.Next());
                    // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:541:7: ( typeExpression )?
                    if ( stream_typeExpression.HasNext() )
                    {
                        adaptor.AddChild(root_1, stream_typeExpression.Next());

                    }
                    stream_typeExpression.Reset();
                    adaptor.AddChild(root_1, stream_block.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 )
            {
                Memoize(input, 20, methodDefinition_StartIndex);
            }
            }
            return retval;
        }
开发者ID:nomilogic,项目名称:fdplugins,代码行数:101,代码来源:ASParser.cs

示例13: interfaceMethodDefinition


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

                        }
                        break;

                }

                if ( backtracking == 0 )
                {

                  										if(options.NewlineAfterMethod) buffer.Append(NewLine + tab);
                  										buffer.Append("{");
                  										CurrentTab++;

                }
                // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:502:3: ( semi )
                // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:502:4: semi
                {
                    PushFollow(FOLLOW_semi_in_interfaceMethodDefinition1212);
                    semi42 = semi();
                    followingStackPointer_--;
                    if (failed) return retval;
                    if ( backtracking==0 ) stream_semi.Add(semi42.Tree);

                }

                // AST REWRITE
                // elements:          optionalAccessorRole, typeExpression, parameterDeclarationList, ident
                // 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();
                // 503:3: -> ^( IMETHOD_DEF optionalAccessorRole ident parameterDeclarationList ( typeExpression )? )
                {
                    // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:503:6: ^( IMETHOD_DEF optionalAccessorRole ident parameterDeclarationList ( typeExpression )? )
                    {
                    CommonTree root_1 = (CommonTree)adaptor.GetNilNode();
                    root_1 = (CommonTree)adaptor.BecomeRoot(adaptor.Create(IMETHOD_DEF, "IMETHOD_DEF"), root_1);

                    adaptor.AddChild(root_1, mods);
                    adaptor.AddChild(root_1, stream_optionalAccessorRole.Next());
                    adaptor.AddChild(root_1, stream_ident.Next());
                    adaptor.AddChild(root_1, stream_parameterDeclarationList.Next());
                    // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:506:7: ( typeExpression )?
                    if ( stream_typeExpression.HasNext() )
                    {
                        adaptor.AddChild(root_1, stream_typeExpression.Next());

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

示例14: identifierStar


//.........这里部分代码省略.........
                int LA49_0 = input.LA(1);

                if ( (LA49_0 == DOT) )
                {
                    alt49 = 1;
                }
                switch (alt49)
                {
                    case 1 :
                        // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1054:5: DOT STAR
                        {
                            DOT179 = (CommonToken)input.LT(1);
                            Match(input,DOT,FOLLOW_DOT_in_identifierStar3376); if (failed) return retval;
                            if ( backtracking==0 ) stream_DOT.Add(DOT179);

                            STAR180 = (CommonToken)input.LT(1);
                            Match(input,STAR,FOLLOW_STAR_in_identifierStar3378); if (failed) return retval;
                            if ( backtracking==0 ) stream_STAR.Add(STAR180);

                        }
                        break;

                }

                // AST REWRITE
                // elements:          STAR, ident
                // 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();
                // 1056:3: -> ^( IDENTIFIER ( ident )+ ( STAR )? )
                {
                    // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1056:6: ^( IDENTIFIER ( ident )+ ( STAR )? )
                    {
                    CommonTree root_1 = (CommonTree)adaptor.GetNilNode();
                    root_1 = (CommonTree)adaptor.BecomeRoot(adaptor.Create(IDENTIFIER, "IDENTIFIER"), root_1);

                    if ( !(stream_ident.HasNext()) ) {
                        throw new RewriteEarlyExitException();
                    }
                    while ( stream_ident.HasNext() )
                    {
                        adaptor.AddChild(root_1, stream_ident.Next());

                    }
                    stream_ident.Reset();
                    // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1056:26: ( 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, 69, identifierStar_StartIndex);
            }
            }
            return retval;
        }
开发者ID:nomilogic,项目名称:fdplugins,代码行数:101,代码来源:ASParser.cs

示例15: annotations


//.........这里部分代码省略.........
                                // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1062:6: ( includeDirective )
                                // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1062:8: includeDirective
                                {
                                    if ( backtracking == 0 )
                                    {
                                       buffer.Append(NewLine + tab);
                                    }
                                    PushFollow(FOLLOW_includeDirective_in_annotations3437);
                                    includeDirective182 = includeDirective();
                                    followingStackPointer_--;
                                    if (failed) return retval;
                                    if ( backtracking==0 ) stream_includeDirective.Add(includeDirective182.Tree);

                                }

                            }
                            break;

                        default:
                            if ( cnt50 >= 1 ) goto loop50;
                            if ( backtracking > 0 ) {failed = true; return retval;}
                                EarlyExitException eee =
                                    new EarlyExitException(50, input);
                                throw eee;
                    }
                    cnt50++;
                } while (true);

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

                // AST REWRITE
                // elements:          annotation
                // 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();
                // 1064:3: -> ^( ANNOTATIONS ( annotation )+ )
                {
                    // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1064:6: ^( ANNOTATIONS ( annotation )+ )
                    {
                    CommonTree root_1 = (CommonTree)adaptor.GetNilNode();
                    root_1 = (CommonTree)adaptor.BecomeRoot(adaptor.Create(ANNOTATIONS, "ANNOTATIONS"), root_1);

                    if ( !(stream_annotation.HasNext()) ) {
                        throw new RewriteEarlyExitException();
                    }
                    while ( stream_annotation.HasNext() )
                    {
                        adaptor.AddChild(root_1, stream_annotation.Next());

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


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