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


C# WhileStatement.AddChild方法代码示例

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


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

示例1: Visit

			public override object Visit (While whileStatement)
			{
				var result = new WhileStatement (WhilePosition.Begin);
				var location = LocationsBag.GetLocations (whileStatement);
				result.AddChild (new CSharpTokenNode (Convert (whileStatement.loc), "while".Length), WhileStatement.WhileKeywordRole);
				
				if (location != null)
					result.AddChild (new CSharpTokenNode (Convert (location[0]), 1), WhileStatement.Roles.LPar);
				result.AddChild ((INode)whileStatement.expr.Accept (this), WhileStatement.Roles.Condition);
				if (location != null)
					result.AddChild (new CSharpTokenNode (Convert (location[1]), 1), WhileStatement.Roles.RPar);
				result.AddChild ((INode)whileStatement.Statement.Accept (this), WhileStatement.Roles.EmbeddedStatement);
				
				return result;
			}
开发者ID:pgoron,项目名称:monodevelop,代码行数:15,代码来源:CSharpParser.cs

示例2: Visit

			public override object Visit (Do doStatement)
			{
				var result = new WhileStatement (WhilePosition.End);
				var location = LocationsBag.GetLocations (doStatement);
				result.AddChild (new CSharpTokenNode (Convert (doStatement.loc), "do".Length), WhileStatement.DoKeywordRole);
				result.AddChild ((AstNode)doStatement.EmbeddedStatement.Accept (this), WhileStatement.Roles.EmbeddedStatement);
				if (location != null)
					result.AddChild (new CSharpTokenNode (Convert (location[0]), "while".Length), WhileStatement.WhileKeywordRole);
				if (location != null)
					result.AddChild (new CSharpTokenNode (Convert (location[1]), 1), WhileStatement.Roles.LPar);
				result.AddChild ((AstNode)doStatement.expr.Accept (this), WhileStatement.Roles.Condition);
				if (location != null) {
					result.AddChild (new CSharpTokenNode (Convert (location[2]), 1), WhileStatement.Roles.RPar);
					result.AddChild (new CSharpTokenNode (Convert (location[3]), 1), WhileStatement.Roles.Semicolon);
				}
				
				return result;
			}
开发者ID:tech-uday-mca,项目名称:monodevelop,代码行数:18,代码来源:CSharpParser.cs

示例3: Visit

			public override object Visit(While whileStatement)
			{
				var result = new WhileStatement();
				var location = LocationsBag.GetLocations(whileStatement);
				result.AddChild(new CSharpTokenNode(Convert(whileStatement.loc), WhileStatement.WhileKeywordRole), WhileStatement.WhileKeywordRole);
				
				if (location != null)
					result.AddChild(new CSharpTokenNode(Convert(location [0]), Roles.LPar), Roles.LPar);
				if (whileStatement.expr != null)
					result.AddChild((Expression)whileStatement.expr.Accept(this), Roles.Condition);
				if (location != null && location.Count > 1)
					result.AddChild(new CSharpTokenNode(Convert(location [1]), Roles.RPar), Roles.RPar);
				if (whileStatement.Statement != null)
					result.AddChild((Statement)whileStatement.Statement.Accept(this), Roles.EmbeddedStatement);
				return result;
			}
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:16,代码来源:CSharpParser.cs

示例4: whileStatement

	public WhileStatement whileStatement()
	{
		EnterRule_whileStatement();
		EnterRule("whileStatement", 18);
		TraceIn("whileStatement", 18);
		WhileStatement st = default(WhileStatement);


		Condition condition34 = default(Condition);
		List<Statement> statement35 = default(List<Statement>);


				st = new WhileStatement();
			
		try { DebugEnterRule(GrammarFileName, "whileStatement");
		DebugLocation(370, 5);
		try
		{
			// D:\\projects\\repository\\ifmo\\Компиляторы\\PascalCompiler\\PascalCompiler\\Grammar\\Pascal.g:375:6: ( WHILE condition DO statement SEMI )
			DebugEnterAlt(1);
			// D:\\projects\\repository\\ifmo\\Компиляторы\\PascalCompiler\\PascalCompiler\\Grammar\\Pascal.g:375:8: WHILE condition DO statement SEMI
			{
			DebugLocation(375, 8);
			Match(input,WHILE,Follow._WHILE_in_whileStatement1249); 
			DebugLocation(376, 7);
			PushFollow(Follow._condition_in_whileStatement1257);
			condition34=condition();
			PopFollow();

			DebugLocation(377, 7);

			    			st.SetCond(condition34);	
			    		
			DebugLocation(380, 7);
			Match(input,DO,Follow._DO_in_whileStatement1273); 
			DebugLocation(381, 7);
			PushFollow(Follow._statement_in_whileStatement1281);
			statement35=statement();
			PopFollow();

			DebugLocation(382, 7);

				    		foreach(var child in statement35)
			    			{
			    				st.AddChild(child);
			    			}
			    		
			DebugLocation(388, 7);
			Match(input,SEMI,Follow._SEMI_in_whileStatement1297); 

			}

		}

			catch (RecognitionException e)
			{
		        	throw e;
		    	}

		finally
		{
			TraceOut("whileStatement", 18);
			LeaveRule("whileStatement", 18);
			LeaveRule_whileStatement();
		}
		DebugLocation(389, 5);
		} finally { DebugExitRule(GrammarFileName, "whileStatement"); }
		return st;

	}
开发者ID:BooMWax,项目名称:ifmo,代码行数:70,代码来源:PascalParser.cs


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