• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# CSharp.For类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Mono.CSharp.For的典型用法代码示例。如果您正苦于以下问题:C# For类的具体用法?C# For怎么用?C# For使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



For类属于Mono.CSharp命名空间,在下文中一共展示了For类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Visit

			public override object Visit(For forStatement)
			{
				var result = new ForStatement();
				
				var location = LocationsBag.GetLocations(forStatement);
				
				result.AddChild(new CSharpTokenNode(Convert(forStatement.loc), ForStatement.ForKeywordRole), ForStatement.ForKeywordRole);
				if (location != null)
					result.AddChild(new CSharpTokenNode(Convert(location [0]), Roles.LPar), Roles.LPar);
				
				AddStatementOrList(result, forStatement.Initializer, ForStatement.InitializerRole);
				
				if (location != null && location.Count > 1)
					result.AddChild(new CSharpTokenNode(Convert(location [1]), Roles.Semicolon), Roles.Semicolon);
				if (forStatement.Condition != null)
					result.AddChild((Expression)forStatement.Condition.Accept(this), Roles.Condition);
				if (location != null && location.Count >= 3)
					result.AddChild(new CSharpTokenNode(Convert(location [2]), Roles.Semicolon), Roles.Semicolon);
				
				AddStatementOrList(result, forStatement.Iterator, ForStatement.IteratorRole);
				
				if (location != null && location.Count >= 4)
					result.AddChild(new CSharpTokenNode(Convert(location [3]), Roles.RPar), Roles.RPar);
				
				if (forStatement.Statement != null)
					result.AddChild((Statement)forStatement.Statement.Accept(this), Roles.EmbeddedStatement);
				
				return result;
			}
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:29,代码来源:CSharpParser.cs


示例2: Visit

			public override object Visit (For forStatement)
			{
				var result = new ForStatement ();
				
				var location = LocationsBag.GetLocations (forStatement);
				
				result.AddChild (new CSharpTokenNode (Convert (forStatement.loc), "for".Length), ForStatement.Roles.Keyword);
				if (location != null)
					result.AddChild (new CSharpTokenNode (Convert (location[0]), 1), ForStatement.Roles.LPar);
				if (forStatement.InitStatement != null)
					result.AddChild ((INode)forStatement.InitStatement.Accept (this), ForStatement.Roles.Initializer);
				if (location != null)
					result.AddChild (new CSharpTokenNode (Convert (location[1]), 1), ForStatement.Roles.Semicolon);
				if (forStatement.Test != null)
					result.AddChild ((INode)forStatement.Test.Accept (this), ForStatement.Roles.Condition);
				if (location != null)
					result.AddChild (new CSharpTokenNode (Convert (location[2]), 1), ForStatement.Roles.Semicolon);
				if (forStatement.Increment != null)
					result.AddChild ((INode)forStatement.Increment.Accept (this), ForStatement.Roles.Iterator);
				if (location != null)
					result.AddChild (new CSharpTokenNode (Convert (location[3]), 1), ForStatement.Roles.RPar);
				
				result.AddChild ((INode)forStatement.Statement.Accept (this), ForStatement.Roles.EmbeddedStatement);
				
				return result;
			}
开发者ID:pgoron,项目名称:monodevelop,代码行数:26,代码来源:CSharpParser.cs


示例3: Visit

		public virtual object Visit (For forStatement)
		{
			return null;
		}
开发者ID:KAW0,项目名称:Alter-Native,代码行数:4,代码来源:visit.cs


示例4: case_861

void case_861()
#line 5731 "cs-parser.jay"
{
		start_block (GetLocation (yyVals[0+yyTop]));
		current_block.IsCompilerGenerated = true;
		For f = new For (GetLocation (yyVals[-1+yyTop]));
		current_block.AddStatement (f);
		lbag.AddStatement (f, current_block.StartLocation);
		yyVal = f;
	  }
开发者ID:segaman,项目名称:NRefactory,代码行数:10,代码来源:cs-parser.cs


示例5: case_795

void case_795()
#line 5071 "cs-parser.jay"
{
		if (yyVals[0+yyTop] is EmptyStatement && lexer.peek_token () == Token.OPEN_BRACE)
			Warning_EmptyStatement (GetLocation (yyVals[0+yyTop]));
	  
		For f = new For ((Statement) yyVals[-6+yyTop], (BooleanExpression) yyVals[-4+yyTop], (Statement) yyVals[-2+yyTop], (Statement) yyVals[0+yyTop], GetLocation (yyVals[-9+yyTop]));
		current_block.AddStatement (f);
		
		lbag.AddStatement (f, GetLocation (yyVals[-8+yyTop]), GetLocation (yyVals[-5+yyTop]), GetLocation (yyVals[-3+yyTop]), GetLocation (yyVals[-1+yyTop]));

		yyVal = end_block (GetLocation (yyVals[-5+yyTop]));
	  }
开发者ID:Ein,项目名称:monodevelop,代码行数:13,代码来源:cs-parser.cs


示例6: yyparse


//.........这里部分代码省略.........
#line 949 "cs-parser.jay"
  {
		--lexer.parsing_declaration;	  
		if (RootContext.Documentation != null)
			Lexer.doc_state = XmlCommentState.Allowed;
	  }
  break;
case 109:
#line 955 "cs-parser.jay"
  {
		yyVal = pop_current_class ();
	  }
  break;
case 110:
#line 958 "cs-parser.jay"
  {
		CheckIdentifierToken (yyToken, GetLocation (yyVals[0+yyTop]));
	  }
  break;
case 111:
#line 965 "cs-parser.jay"
  {
		if (RootContext.Documentation != null)
			Lexer.doc_state = XmlCommentState.Allowed;
	  }
  break;
case 127:
#line 1007 "cs-parser.jay"
  {
		var modflags = (Modifiers) yyVals[-4+yyTop];
		foreach (VariableDeclaration constant in (List<object>) yyVals[-1+yyTop]){
			Location l = constant.Location;
			if ((modflags & Modifiers.STATIC) != 0) {
				Report.Error (504, l, "The constant `{0}' cannot be marked static", current_container.GetSignatureForError () + "." + (string) constant.identifier);
				continue;
			}

			Const c = new Const (
				current_class, (FullNamedExpression) yyVals[-2+yyTop], (string) constant.identifier, 
				constant.GetInitializer ((FullNamedExpression) yyVals[-2+yyTop]), modflags, 
				(Attributes) yyVals[-5+yyTop], l);

			if (RootContext.Documentation != null) {
				c.DocComment = Lexer.consume_doc_comment ();
				Lexer.doc_state = XmlCommentState.Allowed;
			}
			current_container.AddConstant (c);
		}
	  }
  break;
case 128:
#line 1032 "cs-parser.jay"
  {
  	  	variables_bucket.Clear ();
		if (yyVals[0+yyTop] != null)
			variables_bucket.Add (yyVals[0+yyTop]);
		yyVal = variables_bucket;
	  }
  break;
case 129:
#line 1039 "cs-parser.jay"
  {
		if (yyVals[0+yyTop] != null) {
			var constants = (List<object>) yyVals[-2+yyTop];
			constants.Add (yyVals[0+yyTop]);
		}
开发者ID:speier,项目名称:shake,代码行数:67,代码来源:cs-parser.cs


示例7: case_810

void case_810()
{
		start_block (GetLocation (yyVals[0+yyTop]));
		current_block.IsCompilerGenerated = true;
		For f = new For (GetLocation (yyVals[-1+yyTop]));
		current_block.AddStatement (f);
		yyVal = f;
	  }
开发者ID:animaonline,项目名称:Portable-Mono.CSharp,代码行数:8,代码来源:cs-parser.cs


示例8: yyparse


//.........这里部分代码省略.........
			Lexer.doc_state = XmlCommentState.Allowed;
	  }
  break;
case 102:
#line 936 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
  {
		--lexer.parsing_declaration;
		if (doc_support)
			Lexer.doc_state = XmlCommentState.Allowed;
	  }
  break;
case 103:
#line 942 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
  {
		lbag.AppendToMember (current_class, GetLocation (yyVals[-5+yyTop]), GetLocation (yyVals[-2+yyTop]), GetLocation (yyVals[0+yyTop]));
		yyVal = pop_current_class ();
	  }
  break;
case 104:
#line 947 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
  {
		Error_SyntaxError (yyToken);
	  }
  break;
case 105:
#line 956 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
  {
		var lt = (Tokenizer.LocatedToken) yyVals[0+yyTop];
		var mod = (Modifiers) yyVals[-3+yyTop];
		current_field = new Const (current_class, (FullNamedExpression) yyVals[-1+yyTop], mod, new MemberName (lt.Value, lt.Location), (Attributes) yyVals[-4+yyTop]);
		current_container.AddConstant ((Const) current_field);
		
		if ((mod & Modifiers.STATIC) != 0) {
			report.Error (504, current_field.Location, "The constant `{0}' cannot be marked static", current_field.GetSignatureForError ());
		}
		
		yyVal = current_field;
	  }
  break;
case 106:
#line 969 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
  {
		if (doc_support) {
			current_field.DocComment = Lexer.consume_doc_comment ();
			Lexer.doc_state = XmlCommentState.Allowed;
		}
		
		current_field.Initializer = (ConstInitializer) yyVals[-2+yyTop];
		lbag.AddMember (current_field, mod_locations, GetLocation (yyVals[-6+yyTop]), GetLocation (yyVals[0+yyTop]));
		current_field = null;
	  }
  break;
case 117:
#line 1003 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
  {
         yyVal = yyVals[0+yyTop];
      }
  break;
case 118:
#line 1007 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
  {
        yyVal = new SimpleName("dynamic",new Location(0,0));
      }
  break;
case 119:
#line 1013 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
开发者ID:runefs,项目名称:Marvin,代码行数:67,代码来源:cs-parser.cs


示例9: case_796

void case_796()
#line 5059 "C:\Projects\Junk\mono\mcs\class\Mono.CSharp\..\..\mcs\cs-parser.jay"
{
		if (yyVals[0+yyTop] is EmptyStatement && lexer.peek_token () == Token.OPEN_BRACE)
			Warning_EmptyStatement (GetLocation (yyVals[0+yyTop]));
	  
		For f = new For ((Statement) yyVals[-6+yyTop], (BooleanExpression) yyVals[-4+yyTop], (Statement) yyVals[-2+yyTop], (Statement) yyVals[0+yyTop], GetLocation (yyVals[-9+yyTop]));
		current_block.AddStatement (f);
		
		lbag.AddStatement (f, current_block.StartLocation, GetLocation (yyVals[-5+yyTop]), GetLocation (yyVals[-3+yyTop]), GetLocation (yyVals[-1+yyTop]));

		yyVal = end_block (GetLocation (yyVals[-5+yyTop]));
	  }
开发者ID:RainsSoft,项目名称:MonoCompilerAsAService,代码行数:13,代码来源:cs-parser.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# CSharp.Foreach类代码示例发布时间:2022-05-26
下一篇:
C# CSharp.FlowBranching类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap