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


C# RewriteRuleSubtreeStream.NextTree方法代码示例

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


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

示例1: methodName

	private AstParserRuleReturnScope<CommonTree, IToken> methodName()
	{
		EnterRule_methodName();
		EnterRule("methodName", 23);
		TraceIn("methodName", 23);
		AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
		retval.Start = (IToken)input.LT(1);

		CommonTree root_0 = default(CommonTree);

		AstParserRuleReturnScope<CommonTree, IToken> ident83 = default(AstParserRuleReturnScope<CommonTree, IToken>);

		RewriteRuleSubtreeStream stream_ident=new RewriteRuleSubtreeStream(adaptor,"rule ident");
		try { DebugEnterRule(GrammarFileName, "methodName");
		DebugLocation(276, 4);
		try
		{
			// AS3.g:277:5: ( ident -> ^( METHOD_NAME ident ) )
			DebugEnterAlt(1);
			// AS3.g:277:7: ident
			{
			DebugLocation(277, 7);
			PushFollow(Follow._ident_in_methodName1527);
			ident83=ident();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_ident.Add(ident83.Tree);


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

			root_0 = (CommonTree)adaptor.Nil();
			// 278:9: -> ^( METHOD_NAME ident )
			{
				DebugLocation(278, 12);
				// AS3.g:278:12: ^( METHOD_NAME ident )
				{
				CommonTree root_1 = (CommonTree)adaptor.Nil();
				DebugLocation(278, 14);
				root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(METHOD_NAME, "METHOD_NAME"), root_1);

				DebugLocation(278, 26);
				adaptor.AddChild(root_1, stream_ident.NextTree());

				adaptor.AddChild(root_0, root_1);
				}

			}

			retval.Tree = root_0;
			}
			}

			}

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

			if (state.backtracking == 0) {
			retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
			adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
			}
		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);

		}
		finally
		{
			TraceOut("methodName", 23);
			LeaveRule("methodName", 23);
			LeaveRule_methodName();
		}
		DebugLocation(279, 4);
		} finally { DebugExitRule(GrammarFileName, "methodName"); }
		return retval;

	}
开发者ID:jbakst,项目名称:xas,代码行数:90,代码来源:AS3Parser.cs

示例2: whileStatement

	private AstParserRuleReturnScope<CommonTree, IToken> whileStatement()
	{
		EnterRule_whileStatement();
		EnterRule("whileStatement", 67);
		TraceIn("whileStatement", 67);
		AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
		retval.Start = (IToken)input.LT(1);

		CommonTree root_0 = default(CommonTree);

		IToken WHILE215 = default(IToken);
		AstParserRuleReturnScope<CommonTree, IToken> condition216 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> statement217 = default(AstParserRuleReturnScope<CommonTree, IToken>);

		CommonTree WHILE215_tree = default(CommonTree);
		RewriteRuleITokenStream stream_WHILE=new RewriteRuleITokenStream(adaptor,"token WHILE");
		RewriteRuleSubtreeStream stream_condition=new RewriteRuleSubtreeStream(adaptor,"rule condition");
		RewriteRuleSubtreeStream stream_statement=new RewriteRuleSubtreeStream(adaptor,"rule statement");
		try { DebugEnterRule(GrammarFileName, "whileStatement");
		DebugLocation(548, 1);
		try
		{
			// AS3.g:549:2: ( WHILE condition statement -> ^( WHILE_LOOP condition statement ) )
			DebugEnterAlt(1);
			// AS3.g:549:4: WHILE condition statement
			{
			DebugLocation(549, 4);
			WHILE215=(IToken)Match(input,WHILE,Follow._WHILE_in_whileStatement2962); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_WHILE.Add(WHILE215);

			DebugLocation(549, 10);
			PushFollow(Follow._condition_in_whileStatement2964);
			condition216=condition();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_condition.Add(condition216.Tree);
			DebugLocation(549, 20);
			PushFollow(Follow._statement_in_whileStatement2966);
			statement217=statement();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_statement.Add(statement217.Tree);


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

			root_0 = (CommonTree)adaptor.Nil();
			// 550:3: -> ^( WHILE_LOOP condition statement )
			{
				DebugLocation(550, 6);
				// AS3.g:550:6: ^( WHILE_LOOP condition statement )
				{
				CommonTree root_1 = (CommonTree)adaptor.Nil();
				DebugLocation(550, 8);
				root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(WHILE_LOOP, "WHILE_LOOP"), root_1);

				DebugLocation(550, 19);
				adaptor.AddChild(root_1, stream_condition.NextTree());
				DebugLocation(550, 29);
				adaptor.AddChild(root_1, stream_statement.NextTree());

				adaptor.AddChild(root_0, root_1);
				}

			}

			retval.Tree = root_0;
			}
			}

			}

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

			if (state.backtracking == 0) {
			retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
			adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
			}
		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);

		}
		finally
		{
			TraceOut("whileStatement", 67);
			LeaveRule("whileStatement", 67);
//.........这里部分代码省略.........
开发者ID:jbakst,项目名称:xas,代码行数:101,代码来源:AS3Parser.cs

示例3: defaultXMLNamespaceStatement

	private AstParserRuleReturnScope<CommonTree, IToken> defaultXMLNamespaceStatement()
	{
		EnterRule_defaultXMLNamespaceStatement();
		EnterRule("defaultXMLNamespaceStatement", 70);
		TraceIn("defaultXMLNamespaceStatement", 70);
		AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
		retval.Start = (IToken)input.LT(1);

		CommonTree root_0 = default(CommonTree);

		IToken DEFAULT226 = default(IToken);
		IToken XML227 = default(IToken);
		IToken NAMESPACE228 = default(IToken);
		IToken ASSIGN229 = default(IToken);
		AstParserRuleReturnScope<CommonTree, IToken> expression230 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> semi231 = default(AstParserRuleReturnScope<CommonTree, IToken>);

		CommonTree DEFAULT226_tree = default(CommonTree);
		CommonTree XML227_tree = default(CommonTree);
		CommonTree NAMESPACE228_tree = default(CommonTree);
		CommonTree ASSIGN229_tree = default(CommonTree);
		RewriteRuleITokenStream stream_DEFAULT=new RewriteRuleITokenStream(adaptor,"token DEFAULT");
		RewriteRuleITokenStream stream_XML=new RewriteRuleITokenStream(adaptor,"token XML");
		RewriteRuleITokenStream stream_NAMESPACE=new RewriteRuleITokenStream(adaptor,"token NAMESPACE");
		RewriteRuleITokenStream stream_ASSIGN=new RewriteRuleITokenStream(adaptor,"token ASSIGN");
		RewriteRuleSubtreeStream stream_expression=new RewriteRuleSubtreeStream(adaptor,"rule expression");
		RewriteRuleSubtreeStream stream_semi=new RewriteRuleSubtreeStream(adaptor,"rule semi");
		try { DebugEnterRule(GrammarFileName, "defaultXMLNamespaceStatement");
		DebugLocation(562, 1);
		try
		{
			// AS3.g:563:2: ( DEFAULT XML NAMESPACE ASSIGN expression semi -> ^( DEFAULT_XML_NAMESPACE expression ) )
			DebugEnterAlt(1);
			// AS3.g:563:4: DEFAULT XML NAMESPACE ASSIGN expression semi
			{
			DebugLocation(563, 4);
			DEFAULT226=(IToken)Match(input,DEFAULT,Follow._DEFAULT_in_defaultXMLNamespaceStatement3040); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_DEFAULT.Add(DEFAULT226);

			DebugLocation(563, 12);
			XML227=(IToken)Match(input,XML,Follow._XML_in_defaultXMLNamespaceStatement3042); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_XML.Add(XML227);

			DebugLocation(563, 16);
			NAMESPACE228=(IToken)Match(input,NAMESPACE,Follow._NAMESPACE_in_defaultXMLNamespaceStatement3044); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_NAMESPACE.Add(NAMESPACE228);

			DebugLocation(563, 26);
			ASSIGN229=(IToken)Match(input,ASSIGN,Follow._ASSIGN_in_defaultXMLNamespaceStatement3046); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_ASSIGN.Add(ASSIGN229);

			DebugLocation(563, 33);
			PushFollow(Follow._expression_in_defaultXMLNamespaceStatement3048);
			expression230=expression();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_expression.Add(expression230.Tree);
			DebugLocation(563, 44);
			PushFollow(Follow._semi_in_defaultXMLNamespaceStatement3050);
			semi231=semi();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_semi.Add(semi231.Tree);


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

			root_0 = (CommonTree)adaptor.Nil();
			// 564:3: -> ^( DEFAULT_XML_NAMESPACE expression )
			{
				DebugLocation(564, 6);
				// AS3.g:564:6: ^( DEFAULT_XML_NAMESPACE expression )
				{
				CommonTree root_1 = (CommonTree)adaptor.Nil();
				DebugLocation(564, 8);
				root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(DEFAULT_XML_NAMESPACE, "DEFAULT_XML_NAMESPACE"), root_1);

				DebugLocation(564, 30);
				adaptor.AddChild(root_1, stream_expression.NextTree());

				adaptor.AddChild(root_0, root_1);
				}

			}

			retval.Tree = root_0;
			}
			}

			}
//.........这里部分代码省略.........
开发者ID:jbakst,项目名称:xas,代码行数:101,代码来源:AS3Parser.cs

示例4: forEachStatement

	private AstParserRuleReturnScope<CommonTree, IToken> forEachStatement()
	{
		EnterRule_forEachStatement();
		EnterRule("forEachStatement", 58);
		TraceIn("forEachStatement", 58);
		AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
		retval.Start = (IToken)input.LT(1);

		CommonTree root_0 = default(CommonTree);

		IToken f = default(IToken);
		IToken EACH185 = default(IToken);
		IToken LPAREN186 = default(IToken);
		IToken RPAREN188 = default(IToken);
		AstParserRuleReturnScope<CommonTree, IToken> forInClause187 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> statement189 = default(AstParserRuleReturnScope<CommonTree, IToken>);

		CommonTree f_tree = default(CommonTree);
		CommonTree EACH185_tree = default(CommonTree);
		CommonTree LPAREN186_tree = default(CommonTree);
		CommonTree RPAREN188_tree = default(CommonTree);
		RewriteRuleITokenStream stream_FOR=new RewriteRuleITokenStream(adaptor,"token FOR");
		RewriteRuleITokenStream stream_EACH=new RewriteRuleITokenStream(adaptor,"token EACH");
		RewriteRuleITokenStream stream_LPAREN=new RewriteRuleITokenStream(adaptor,"token LPAREN");
		RewriteRuleITokenStream stream_RPAREN=new RewriteRuleITokenStream(adaptor,"token RPAREN");
		RewriteRuleSubtreeStream stream_forInClause=new RewriteRuleSubtreeStream(adaptor,"rule forInClause");
		RewriteRuleSubtreeStream stream_statement=new RewriteRuleSubtreeStream(adaptor,"rule statement");
		try { DebugEnterRule(GrammarFileName, "forEachStatement");
		DebugLocation(491, 1);
		try
		{
			// AS3.g:492:2: (f= FOR EACH LPAREN forInClause RPAREN statement -> ^( FOR_EACH_LOOP $f forInClause statement ) )
			DebugEnterAlt(1);
			// AS3.g:492:4: f= FOR EACH LPAREN forInClause RPAREN statement
			{
			DebugLocation(492, 5);
			f=(IToken)Match(input,FOR,Follow._FOR_in_forEachStatement2672); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_FOR.Add(f);

			DebugLocation(492, 10);
			EACH185=(IToken)Match(input,EACH,Follow._EACH_in_forEachStatement2674); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_EACH.Add(EACH185);

			DebugLocation(493, 3);
			LPAREN186=(IToken)Match(input,LPAREN,Follow._LPAREN_in_forEachStatement2678); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_LPAREN.Add(LPAREN186);

			DebugLocation(494, 3);
			PushFollow(Follow._forInClause_in_forEachStatement2682);
			forInClause187=forInClause();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_forInClause.Add(forInClause187.Tree);
			DebugLocation(495, 3);
			RPAREN188=(IToken)Match(input,RPAREN,Follow._RPAREN_in_forEachStatement2686); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_RPAREN.Add(RPAREN188);

			DebugLocation(496, 3);
			PushFollow(Follow._statement_in_forEachStatement2690);
			statement189=statement();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_statement.Add(statement189.Tree);


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

			root_0 = (CommonTree)adaptor.Nil();
			// 497:3: -> ^( FOR_EACH_LOOP $f forInClause statement )
			{
				DebugLocation(497, 6);
				// AS3.g:497:6: ^( FOR_EACH_LOOP $f forInClause statement )
				{
				CommonTree root_1 = (CommonTree)adaptor.Nil();
				DebugLocation(497, 8);
				root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(FOR_EACH_LOOP, "FOR_EACH_LOOP"), root_1);

				DebugLocation(497, 23);
				adaptor.AddChild(root_1, stream_f.NextNode());
				DebugLocation(497, 25);
				adaptor.AddChild(root_1, stream_forInClause.NextTree());
				DebugLocation(497, 37);
				adaptor.AddChild(root_1, stream_statement.NextTree());

				adaptor.AddChild(root_0, root_1);
				}

			}

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

示例5: packageDecl


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

				default:
					goto loop6;
				}
			}

			loop6:
				;

			} finally { DebugExitSubRule(6); }

			DebugLocation(143, 3);
			RCURLY15=(IToken)Match(input,RCURLY,Follow._RCURLY_in_packageDecl613); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_RCURLY.Add(RCURLY15);



			{
			// AST REWRITE
			// elements: PACKAGE, identifierStar, LCURLY, packageBlockEntry, RCURLY
			// token labels: 
			// rule labels: retval
			// token list labels: 
			// rule list labels: 
			// wildcard labels: 
			if (state.backtracking == 0) {
			retval.Tree = root_0;
			RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null);

			root_0 = (CommonTree)adaptor.Nil();
			// 144:3: -> ^( PACKAGE_DECL PACKAGE ( identifierStar )? LCURLY ( packageBlockEntry )* RCURLY )
			{
				DebugLocation(144, 6);
				// AS3.g:144:6: ^( PACKAGE_DECL PACKAGE ( identifierStar )? LCURLY ( packageBlockEntry )* RCURLY )
				{
				CommonTree root_1 = (CommonTree)adaptor.Nil();
				DebugLocation(144, 8);
				root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(PACKAGE_DECL, "PACKAGE_DECL"), root_1);

				DebugLocation(144, 21);
				adaptor.AddChild(root_1, stream_PACKAGE.NextNode());
				DebugLocation(144, 29);
				// AS3.g:144:29: ( identifierStar )?
				if (stream_identifierStar.HasNext)
				{
					DebugLocation(144, 29);
					adaptor.AddChild(root_1, stream_identifierStar.NextTree());

				}
				stream_identifierStar.Reset();
				DebugLocation(144, 45);
				adaptor.AddChild(root_1, stream_LCURLY.NextNode());
				DebugLocation(144, 52);
				// AS3.g:144:52: ( packageBlockEntry )*
				while ( stream_packageBlockEntry.HasNext )
				{
					DebugLocation(144, 52);
					adaptor.AddChild(root_1, stream_packageBlockEntry.NextTree());

				}
				stream_packageBlockEntry.Reset();
				DebugLocation(144, 71);
				adaptor.AddChild(root_1, stream_RCURLY.NextNode());

				adaptor.AddChild(root_0, root_1);
				}

			}

			retval.Tree = root_0;
			}
			}

			}

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

			if (state.backtracking == 0) {
			retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
			adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
			}
		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);

		}
		finally
		{
			TraceOut("packageDecl", 5);
			LeaveRule("packageDecl", 5);
			LeaveRule_packageDecl();
		}
		DebugLocation(145, 1);
		} finally { DebugExitRule(GrammarFileName, "packageDecl"); }
		return retval;

	}
开发者ID:jbakst,项目名称:xas,代码行数:101,代码来源:AS3Parser.cs

示例6: returnStatement

	private AstParserRuleReturnScope<CommonTree, IToken> returnStatement()
	{
		EnterRule_returnStatement();
		EnterRule("returnStatement", 50);
		TraceIn("returnStatement", 50);
		AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
		retval.Start = (IToken)input.LT(1);

		CommonTree root_0 = default(CommonTree);

		IToken RETURN168 = default(IToken);
		AstParserRuleReturnScope<CommonTree, IToken> s = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> expression169 = default(AstParserRuleReturnScope<CommonTree, IToken>);

		CommonTree RETURN168_tree = default(CommonTree);
		RewriteRuleITokenStream stream_RETURN=new RewriteRuleITokenStream(adaptor,"token RETURN");
		RewriteRuleSubtreeStream stream_expression=new RewriteRuleSubtreeStream(adaptor,"rule expression");
		RewriteRuleSubtreeStream stream_semi=new RewriteRuleSubtreeStream(adaptor,"rule semi");
		try { DebugEnterRule(GrammarFileName, "returnStatement");
		DebugLocation(450, 1);
		try
		{
			// AS3.g:451:2: ( RETURN ( expression )? s= semi -> ^( RETURN_STATEMENT RETURN ( expression )? ) )
			DebugEnterAlt(1);
			// AS3.g:451:4: RETURN ( expression )? s= semi
			{
			DebugLocation(451, 4);
			RETURN168=(IToken)Match(input,RETURN,Follow._RETURN_in_returnStatement2421); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_RETURN.Add(RETURN168);

			DebugLocation(451, 11);
			// AS3.g:451:11: ( expression )?
			int alt39=2;
			try { DebugEnterSubRule(39);
			try { DebugEnterDecision(39, false);
			int LA39_1 = input.LA(1);

			if ((LA39_1==AS||LA39_1==BNOT||(LA39_1>=DEC && LA39_1<=DECIMAL_LITERAL)||(LA39_1>=DYNAMIC && LA39_1<=E4X_ATTRI)||(LA39_1>=FALSE && LA39_1<=FLOAT_LITERAL)||LA39_1==FUNCTION||LA39_1==GET||(LA39_1>=HEX_LITERAL && LA39_1<=IDENT)||LA39_1==INC||(LA39_1>=INTERNAL && LA39_1<=IS)||(LA39_1>=LBRACK && LA39_1<=LCURLY)||LA39_1==LNOT||LA39_1==LPAREN||LA39_1==MINUS||LA39_1==NAMESPACE||LA39_1==NEW||LA39_1==NULL||LA39_1==OCTAL_LITERAL||LA39_1==PLUS||LA39_1==PRIVATE||(LA39_1>=PROTECTED && LA39_1<=PUBLIC)||LA39_1==REGEX_LITERAL||LA39_1==SET||(LA39_1>=STRING_LITERAL_DOUBLE && LA39_1<=SUPER)||LA39_1==TRUE||LA39_1==USE||LA39_1==XML||LA39_1==XML_LITERAL||LA39_1==243||(LA39_1>=255 && LA39_1<=257)))
			{
				alt39 = 1;
			}
			} finally { DebugExitDecision(39); }
			switch (alt39)
			{
			case 1:
				DebugEnterAlt(1);
				// AS3.g:451:11: expression
				{
				DebugLocation(451, 11);
				PushFollow(Follow._expression_in_returnStatement2423);
				expression169=expression();
				PopFollow();
				if (state.failed) return retval;
				if (state.backtracking == 0) stream_expression.Add(expression169.Tree);

				}
				break;

			}
			} finally { DebugExitSubRule(39); }

			DebugLocation(451, 24);
			PushFollow(Follow._semi_in_returnStatement2428);
			s=semi();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_semi.Add(s.Tree);


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

			root_0 = (CommonTree)adaptor.Nil();
			// 452:9: -> ^( RETURN_STATEMENT RETURN ( expression )? )
			{
				DebugLocation(452, 12);
				// AS3.g:452:12: ^( RETURN_STATEMENT RETURN ( expression )? )
				{
				CommonTree root_1 = (CommonTree)adaptor.Nil();
				DebugLocation(452, 14);
				root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(RETURN_STATEMENT, "RETURN_STATEMENT"), root_1);

				DebugLocation(452, 31);
				adaptor.AddChild(root_1, stream_RETURN.NextNode());
				DebugLocation(452, 38);
				// AS3.g:452:38: ( expression )?
				if (stream_expression.HasNext)
				{
					DebugLocation(452, 38);
					adaptor.AddChild(root_1, stream_expression.NextTree());

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

示例7: switchBlock


//.........这里部分代码省略.........
			case 1:
				DebugEnterAlt(1);
				// AS3.g:474:4: defaultStatement
				{
				DebugLocation(474, 4);
				PushFollow(Follow._defaultStatement_in_switchBlock2577);
				defaultStatement177=defaultStatement();
				PopFollow();
				if (state.failed) return retval;
				if (state.backtracking == 0) stream_defaultStatement.Add(defaultStatement177.Tree);

				}
				break;

			}
			} finally { DebugExitSubRule(41); }

			DebugLocation(475, 3);
			RCURLY178=(IToken)Match(input,RCURLY,Follow._RCURLY_in_switchBlock2583); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_RCURLY.Add(RCURLY178);



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

			root_0 = (CommonTree)adaptor.Nil();
			// 476:3: -> ^( BLOCK ( caseStatement )* ( defaultStatement )? )
			{
				DebugLocation(476, 6);
				// AS3.g:476:6: ^( BLOCK ( caseStatement )* ( defaultStatement )? )
				{
				CommonTree root_1 = (CommonTree)adaptor.Nil();
				DebugLocation(476, 8);
				root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(BLOCK, "BLOCK"), root_1);

				DebugLocation(476, 14);
				// AS3.g:476:14: ( caseStatement )*
				while ( stream_caseStatement.HasNext )
				{
					DebugLocation(476, 14);
					adaptor.AddChild(root_1, stream_caseStatement.NextTree());

				}
				stream_caseStatement.Reset();
				DebugLocation(476, 29);
				// AS3.g:476:29: ( defaultStatement )?
				if (stream_defaultStatement.HasNext)
				{
					DebugLocation(476, 29);
					adaptor.AddChild(root_1, stream_defaultStatement.NextTree());

				}
				stream_defaultStatement.Reset();

				adaptor.AddChild(root_0, root_1);
				}

			}

			retval.Tree = root_0;
			}
			}

			}

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

			if (state.backtracking == 0) {
			retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
			adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
			}
		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);

		}
		finally
		{
			TraceOut("switchBlock", 54);
			LeaveRule("switchBlock", 54);
			LeaveRule_switchBlock();
		}
		DebugLocation(477, 1);
		} finally { DebugExitRule(GrammarFileName, "switchBlock"); }
		return retval;

	}
开发者ID:jbakst,项目名称:xas,代码行数:101,代码来源:AS3Parser.cs

示例8: parameterDeclarationList


//.........这里部分代码省略.........
						if (state.backtracking == 0) stream_parameterDeclaration.Add(parameterDeclaration110.Tree);

						}
						break;

					default:
						goto loop25;
					}
				}

				loop25:
					;

				} finally { DebugExitSubRule(25); }


				}
				break;

			}
			} finally { DebugExitSubRule(26); }

			DebugLocation(334, 3);
			RPAREN111=(IToken)Match(input,RPAREN,Follow._RPAREN_in_parameterDeclarationList1835); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_RPAREN.Add(RPAREN111);



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

			root_0 = (CommonTree)adaptor.Nil();
			// 335:3: -> ^( PARAMS LPAREN ( parameterDeclaration )* RPAREN )
			{
				DebugLocation(335, 6);
				// AS3.g:335:6: ^( PARAMS LPAREN ( parameterDeclaration )* RPAREN )
				{
				CommonTree root_1 = (CommonTree)adaptor.Nil();
				DebugLocation(335, 8);
				root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(PARAMS, "PARAMS"), root_1);

				DebugLocation(335, 15);
				adaptor.AddChild(root_1, stream_LPAREN.NextNode());
				DebugLocation(335, 22);
				// AS3.g:335:22: ( parameterDeclaration )*
				while ( stream_parameterDeclaration.HasNext )
				{
					DebugLocation(335, 22);
					adaptor.AddChild(root_1, stream_parameterDeclaration.NextTree());

				}
				stream_parameterDeclaration.Reset();
				DebugLocation(335, 44);
				adaptor.AddChild(root_1, stream_RPAREN.NextNode());

				adaptor.AddChild(root_0, root_1);
				}

			}

			retval.Tree = root_0;
			}
			}

			}

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

			if (state.backtracking == 0) {
			retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
			adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
			}
		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);

		}
		finally
		{
			TraceOut("parameterDeclarationList", 33);
			LeaveRule("parameterDeclarationList", 33);
			LeaveRule_parameterDeclarationList();
		}
		DebugLocation(336, 1);
		} finally { DebugExitRule(GrammarFileName, "parameterDeclarationList"); }
		return retval;

	}
开发者ID:jbakst,项目名称:xas,代码行数:101,代码来源:AS3Parser.cs

示例9: basicParameterDeclaration


//.........这里部分代码省略.........
				PopFollow();
				if (state.failed) return retval;
				if (state.backtracking == 0) stream_parameterDefault.Add(parameterDefault117.Tree);

				}
				break;

			}
			} finally { DebugExitSubRule(30); }



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

			root_0 = (CommonTree)adaptor.Nil();
			// 345:3: -> ^( PARAM ( CONST )? ident ( typeExpression )? ( parameterDefault )? )
			{
				DebugLocation(345, 6);
				// AS3.g:345:6: ^( PARAM ( CONST )? ident ( typeExpression )? ( parameterDefault )? )
				{
				CommonTree root_1 = (CommonTree)adaptor.Nil();
				DebugLocation(345, 8);
				root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(PARAM, "PARAM"), root_1);

				DebugLocation(345, 14);
				// AS3.g:345:14: ( CONST )?
				if (stream_CONST.HasNext)
				{
					DebugLocation(345, 14);
					adaptor.AddChild(root_1, stream_CONST.NextNode());

				}
				stream_CONST.Reset();
				DebugLocation(345, 21);
				adaptor.AddChild(root_1, stream_ident.NextTree());
				DebugLocation(345, 27);
				// AS3.g:345:27: ( typeExpression )?
				if (stream_typeExpression.HasNext)
				{
					DebugLocation(345, 27);
					adaptor.AddChild(root_1, stream_typeExpression.NextTree());

				}
				stream_typeExpression.Reset();
				DebugLocation(345, 43);
				// AS3.g:345:43: ( parameterDefault )?
				if (stream_parameterDefault.HasNext)
				{
					DebugLocation(345, 43);
					adaptor.AddChild(root_1, stream_parameterDefault.NextTree());

				}
				stream_parameterDefault.Reset();

				adaptor.AddChild(root_0, root_1);
				}

			}

			retval.Tree = root_0;
			}
			}

			}

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

			if (state.backtracking == 0) {
			retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
			adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
			}
		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);

		}
		finally
		{
			TraceOut("basicParameterDeclaration", 35);
			LeaveRule("basicParameterDeclaration", 35);
			LeaveRule_basicParameterDeclaration();
		}
		DebugLocation(346, 1);
		} finally { DebugExitRule(GrammarFileName, "basicParameterDeclaration"); }
		return retval;

	}
开发者ID:jbakst,项目名称:xas,代码行数:101,代码来源:AS3Parser.cs

示例10: variableInitializer

	private AstParserRuleReturnScope<CommonTree, IToken> variableInitializer()
	{
		EnterRule_variableInitializer();
		EnterRule("variableInitializer", 31);
		TraceIn("variableInitializer", 31);
		AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
		retval.Start = (IToken)input.LT(1);

		CommonTree root_0 = default(CommonTree);

		IToken ASSIGN102 = default(IToken);
		AstParserRuleReturnScope<CommonTree, IToken> expression103 = default(AstParserRuleReturnScope<CommonTree, IToken>);

		CommonTree ASSIGN102_tree = default(CommonTree);
		RewriteRuleITokenStream stream_ASSIGN=new RewriteRuleITokenStream(adaptor,"token ASSIGN");
		RewriteRuleSubtreeStream stream_expression=new RewriteRuleSubtreeStream(adaptor,"rule expression");
		try { DebugEnterRule(GrammarFileName, "variableInitializer");
		DebugLocation(316, 1);
		try
		{
			// AS3.g:317:2: ( ASSIGN expression -> ^( VAR_INITIALIZER ASSIGN expression ) )
			DebugEnterAlt(1);
			// AS3.g:317:4: ASSIGN expression
			{
			DebugLocation(317, 4);
			ASSIGN102=(IToken)Match(input,ASSIGN,Follow._ASSIGN_in_variableInitializer1737); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_ASSIGN.Add(ASSIGN102);

			DebugLocation(317, 11);
			PushFollow(Follow._expression_in_variableInitializer1739);
			expression103=expression();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_expression.Add(expression103.Tree);


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

			root_0 = (CommonTree)adaptor.Nil();
			// 318:9: -> ^( VAR_INITIALIZER ASSIGN expression )
			{
				DebugLocation(318, 12);
				// AS3.g:318:12: ^( VAR_INITIALIZER ASSIGN expression )
				{
				CommonTree root_1 = (CommonTree)adaptor.Nil();
				DebugLocation(318, 14);
				root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(VAR_INITIALIZER, "VAR_INITIALIZER"), root_1);

				DebugLocation(318, 30);
				adaptor.AddChild(root_1, stream_ASSIGN.NextNode());
				DebugLocation(318, 37);
				adaptor.AddChild(root_1, stream_expression.NextTree());

				adaptor.AddChild(root_0, root_1);
				}

			}

			retval.Tree = root_0;
			}
			}

			}

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

			if (state.backtracking == 0) {
			retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
			adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
			}
		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);

		}
		finally
		{
			TraceOut("variableInitializer", 31);
			LeaveRule("variableInitializer", 31);
			LeaveRule_variableInitializer();
		}
		DebugLocation(319, 1);
		} finally { DebugExitRule(GrammarFileName, "variableInitializer"); }
		return retval;

	}
开发者ID:jbakst,项目名称:xas,代码行数:99,代码来源:AS3Parser.cs

示例11: variableDeclarator


//.........这里部分代码省略.........
			switch (alt24)
			{
			case 1:
				DebugEnterAlt(1);
				// AS3.g:322:26: variableInitializer
				{
				DebugLocation(322, 26);
				PushFollow(Follow._variableInitializer_in_variableDeclarator1773);
				variableInitializer106=variableInitializer();
				PopFollow();
				if (state.failed) return retval;
				if (state.backtracking == 0) stream_variableInitializer.Add(variableInitializer106.Tree);

				}
				break;

			}
			} finally { DebugExitSubRule(24); }



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

			root_0 = (CommonTree)adaptor.Nil();
			// 323:9: -> ^( VAR_DECLARATION ident ( typeExpression )? ( variableInitializer )? )
			{
				DebugLocation(323, 12);
				// AS3.g:323:12: ^( VAR_DECLARATION ident ( typeExpression )? ( variableInitializer )? )
				{
				CommonTree root_1 = (CommonTree)adaptor.Nil();
				DebugLocation(323, 14);
				root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(VAR_DECLARATION, "VAR_DECLARATION"), root_1);

				DebugLocation(323, 30);
				adaptor.AddChild(root_1, stream_ident.NextTree());
				DebugLocation(323, 36);
				// AS3.g:323:36: ( typeExpression )?
				if (stream_typeExpression.HasNext)
				{
					DebugLocation(323, 36);
					adaptor.AddChild(root_1, stream_typeExpression.NextTree());

				}
				stream_typeExpression.Reset();
				DebugLocation(323, 52);
				// AS3.g:323:52: ( variableInitializer )?
				if (stream_variableInitializer.HasNext)
				{
					DebugLocation(323, 52);
					adaptor.AddChild(root_1, stream_variableInitializer.NextTree());

				}
				stream_variableInitializer.Reset();

				adaptor.AddChild(root_0, root_1);
				}

			}

			retval.Tree = root_0;
			}
			}

			}

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

			if (state.backtracking == 0) {
			retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
			adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
			}
		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);

		}
		finally
		{
			TraceOut("variableDeclarator", 32);
			LeaveRule("variableDeclarator", 32);
			LeaveRule_variableDeclarator();
		}
		DebugLocation(324, 1);
		} finally { DebugExitRule(GrammarFileName, "variableDeclarator"); }
		return retval;

	}
开发者ID:jbakst,项目名称:xas,代码行数:101,代码来源:AS3Parser.cs

示例12: declaration

	private AstParserRuleReturnScope<CommonTree, IToken> declaration()
	{
		EnterRule_declaration();
		EnterRule("declaration", 28);
		TraceIn("declaration", 28);
		AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
		retval.Start = (IToken)input.LT(1);

		CommonTree root_0 = default(CommonTree);

		AstParserRuleReturnScope<CommonTree, IToken> varOrConst96 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> variableDeclarator97 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> declarationTail98 = default(AstParserRuleReturnScope<CommonTree, IToken>);

		RewriteRuleSubtreeStream stream_varOrConst=new RewriteRuleSubtreeStream(adaptor,"rule varOrConst");
		RewriteRuleSubtreeStream stream_variableDeclarator=new RewriteRuleSubtreeStream(adaptor,"rule variableDeclarator");
		RewriteRuleSubtreeStream stream_declarationTail=new RewriteRuleSubtreeStream(adaptor,"rule declarationTail");
		try { DebugEnterRule(GrammarFileName, "declaration");
		DebugLocation(303, 1);
		try
		{
			// AS3.g:304:2: ( varOrConst variableDeclarator declarationTail -> ^( DECLARATION varOrConst variableDeclarator declarationTail ) )
			DebugEnterAlt(1);
			// AS3.g:304:4: varOrConst variableDeclarator declarationTail
			{
			DebugLocation(304, 4);
			PushFollow(Follow._varOrConst_in_declaration1671);
			varOrConst96=varOrConst();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_varOrConst.Add(varOrConst96.Tree);
			DebugLocation(304, 15);
			PushFollow(Follow._variableDeclarator_in_declaration1673);
			variableDeclarator97=variableDeclarator();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_variableDeclarator.Add(variableDeclarator97.Tree);
			DebugLocation(304, 34);
			PushFollow(Follow._declarationTail_in_declaration1675);
			declarationTail98=declarationTail();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_declarationTail.Add(declarationTail98.Tree);


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

			root_0 = (CommonTree)adaptor.Nil();
			// 305:9: -> ^( DECLARATION varOrConst variableDeclarator declarationTail )
			{
				DebugLocation(305, 12);
				// AS3.g:305:12: ^( DECLARATION varOrConst variableDeclarator declarationTail )
				{
				CommonTree root_1 = (CommonTree)adaptor.Nil();
				DebugLocation(305, 14);
				root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(DECLARATION, "DECLARATION"), root_1);

				DebugLocation(305, 26);
				adaptor.AddChild(root_1, stream_varOrConst.NextTree());
				DebugLocation(305, 37);
				adaptor.AddChild(root_1, stream_variableDeclarator.NextTree());
				DebugLocation(305, 56);
				adaptor.AddChild(root_1, stream_declarationTail.NextTree());

				adaptor.AddChild(root_0, root_1);
				}

			}

			retval.Tree = root_0;
			}
			}

			}

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

			if (state.backtracking == 0) {
			retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
			adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
			}
		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);

		}
		finally
//.........这里部分代码省略.........
开发者ID:jbakst,项目名称:xas,代码行数:101,代码来源:AS3Parser.cs

示例13: variableDefinition


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

					}
					break;

				default:
					goto loop21;
				}
			}

			loop21:
				;

			} finally { DebugExitSubRule(21); }

			DebugLocation(299, 4);
			PushFollow(Follow._semi_in_variableDefinition1642);
			s=semi();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_semi.Add(s.Tree);


			{
			// AST REWRITE
			// elements: modifiers, decl, variableDeclarator
			// token labels: 
			// rule labels: decl, retval
			// token list labels: 
			// rule list labels: 
			// wildcard labels: 
			if (state.backtracking == 0) {
			retval.Tree = root_0;
			RewriteRuleSubtreeStream stream_decl=new RewriteRuleSubtreeStream(adaptor,"rule decl",decl!=null?decl.Tree:null);
			RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null);

			root_0 = (CommonTree)adaptor.Nil();
			// 300:3: -> ^( VARIABLE_DEF modifiers $decl ( variableDeclarator )+ )
			{
				DebugLocation(300, 6);
				// AS3.g:300:6: ^( VARIABLE_DEF modifiers $decl ( variableDeclarator )+ )
				{
				CommonTree root_1 = (CommonTree)adaptor.Nil();
				DebugLocation(300, 8);
				root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(VARIABLE_DEF, "VARIABLE_DEF"), root_1);

				DebugLocation(300, 21);
				adaptor.AddChild(root_1, stream_modifiers.NextTree());
				DebugLocation(300, 32);
				adaptor.AddChild(root_1, stream_decl.NextTree());
				DebugLocation(300, 37);
				if (!(stream_variableDeclarator.HasNext))
				{
					throw new RewriteEarlyExitException();
				}
				while ( stream_variableDeclarator.HasNext )
				{
					DebugLocation(300, 37);
					adaptor.AddChild(root_1, stream_variableDeclarator.NextTree());

				}
				stream_variableDeclarator.Reset();
				DebugLocation(300, 57);
				adaptor.AddChild(root_1, maybeSemi(s));

				adaptor.AddChild(root_0, root_1);
				}

			}

			retval.Tree = root_0;
			}
			}

			}

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

			if (state.backtracking == 0) {
			retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
			adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
			}
		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);

		}
		finally
		{
			TraceOut("variableDefinition", 27);
			LeaveRule("variableDefinition", 27);
			LeaveRule_variableDefinition();
		}
		DebugLocation(301, 1);
		} finally { DebugExitRule(GrammarFileName, "variableDefinition"); }
		return retval;

	}
开发者ID:jbakst,项目名称:xas,代码行数:101,代码来源:AS3Parser.cs

示例14: namespaceDefinition

	private AstParserRuleReturnScope<CommonTree, IToken> namespaceDefinition()
	{
		EnterRule_namespaceDefinition();
		EnterRule("namespaceDefinition", 25);
		TraceIn("namespaceDefinition", 25);
		AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
		retval.Start = (IToken)input.LT(1);

		CommonTree root_0 = default(CommonTree);

		IToken NAMESPACE86 = default(IToken);
		AstParserRuleReturnScope<CommonTree, IToken> modifiers85 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> namespaceName87 = default(AstParserRuleReturnScope<CommonTree, IToken>);

		CommonTree NAMESPACE86_tree = default(CommonTree);
		RewriteRuleITokenStream stream_NAMESPACE=new RewriteRuleITokenStream(adaptor,"token NAMESPACE");
		RewriteRuleSubtreeStream stream_modifiers=new RewriteRuleSubtreeStream(adaptor,"rule modifiers");
		RewriteRuleSubtreeStream stream_namespaceName=new RewriteRuleSubtreeStream(adaptor,"rule namespaceName");
		try { DebugEnterRule(GrammarFileName, "namespaceDefinition");
		DebugLocation(286, 1);
		try
		{
			// AS3.g:287:2: ( modifiers NAMESPACE namespaceName -> ^( NAMESPACE_DEF modifiers NAMESPACE namespaceName ) )
			DebugEnterAlt(1);
			// AS3.g:287:4: modifiers NAMESPACE namespaceName
			{
			DebugLocation(287, 4);
			PushFollow(Follow._modifiers_in_namespaceDefinition1573);
			modifiers85=modifiers();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_modifiers.Add(modifiers85.Tree);
			DebugLocation(287, 14);
			NAMESPACE86=(IToken)Match(input,NAMESPACE,Follow._NAMESPACE_in_namespaceDefinition1575); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_NAMESPACE.Add(NAMESPACE86);

			DebugLocation(287, 24);
			PushFollow(Follow._namespaceName_in_namespaceDefinition1577);
			namespaceName87=namespaceName();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_namespaceName.Add(namespaceName87.Tree);


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

			root_0 = (CommonTree)adaptor.Nil();
			// 288:3: -> ^( NAMESPACE_DEF modifiers NAMESPACE namespaceName )
			{
				DebugLocation(288, 6);
				// AS3.g:288:6: ^( NAMESPACE_DEF modifiers NAMESPACE namespaceName )
				{
				CommonTree root_1 = (CommonTree)adaptor.Nil();
				DebugLocation(288, 8);
				root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(NAMESPACE_DEF, "NAMESPACE_DEF"), root_1);

				DebugLocation(288, 22);
				adaptor.AddChild(root_1, stream_modifiers.NextTree());
				DebugLocation(288, 32);
				adaptor.AddChild(root_1, stream_NAMESPACE.NextNode());
				DebugLocation(288, 42);
				adaptor.AddChild(root_1, stream_namespaceName.NextTree());

				adaptor.AddChild(root_0, root_1);
				}

			}

			retval.Tree = root_0;
			}
			}

			}

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

			if (state.backtracking == 0) {
			retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
			adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
			}
		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);

		}
		finally
		{
//.........这里部分代码省略.........
开发者ID:jbakst,项目名称:xas,代码行数:101,代码来源:AS3Parser.cs

示例15: throwStatement

	private AstParserRuleReturnScope<CommonTree, IToken> throwStatement()
	{
		EnterRule_throwStatement();
		EnterRule("throwStatement", 46);
		TraceIn("throwStatement", 46);
		AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
		retval.Start = (IToken)input.LT(1);

		CommonTree root_0 = default(CommonTree);

		IToken string_literal154 = default(IToken);
		AstParserRuleReturnScope<CommonTree, IToken> s = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> expression155 = default(AstParserRuleReturnScope<CommonTree, IToken>);

		CommonTree string_literal154_tree = default(CommonTree);
		RewriteRuleITokenStream stream_253=new RewriteRuleITokenStream(adaptor,"token 253");
		RewriteRuleSubtreeStream stream_expression=new RewriteRuleSubtreeStream(adaptor,"rule expression");
		RewriteRuleSubtreeStream stream_semi=new RewriteRuleSubtreeStream(adaptor,"rule semi");
		try { DebugEnterRule(GrammarFileName, "throwStatement");
		DebugLocation(428, 1);
		try
		{
			// AS3.g:429:2: ( 'throw' expression s= semi -> ^( THROW_STATEMENT 'throw' expression ) )
			DebugEnterAlt(1);
			// AS3.g:429:4: 'throw' expression s= semi
			{
			DebugLocation(429, 4);
			string_literal154=(IToken)Match(input,253,Follow._253_in_throwStatement2298); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_253.Add(string_literal154);

			DebugLocation(429, 12);
			PushFollow(Follow._expression_in_throwStatement2300);
			expression155=expression();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_expression.Add(expression155.Tree);
			DebugLocation(429, 24);
			PushFollow(Follow._semi_in_throwStatement2304);
			s=semi();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_semi.Add(s.Tree);


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

			root_0 = (CommonTree)adaptor.Nil();
			// 430:9: -> ^( THROW_STATEMENT 'throw' expression )
			{
				DebugLocation(430, 12);
				// AS3.g:430:12: ^( THROW_STATEMENT 'throw' expression )
				{
				CommonTree root_1 = (CommonTree)adaptor.Nil();
				DebugLocation(430, 14);
				root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(THROW_STATEMENT, "THROW_STATEMENT"), root_1);

				DebugLocation(430, 30);
				adaptor.AddChild(root_1, stream_253.NextNode());
				DebugLocation(430, 38);
				adaptor.AddChild(root_1, stream_expression.NextTree());
				DebugLocation(430, 49);
				adaptor.AddChild(root_1, maybeSemi(s));

				adaptor.AddChild(root_0, root_1);
				}

			}

			retval.Tree = root_0;
			}
			}

			}

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

			if (state.backtracking == 0) {
			retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
			adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
			}
		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);

		}
		finally
		{
//.........这里部分代码省略.........
开发者ID:jbakst,项目名称:xas,代码行数:101,代码来源:AS3Parser.cs


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