本文整理汇总了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;
}
示例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;
}
示例3: Visit
public virtual object Visit (For forStatement)
{
return null;
}
示例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;
}
示例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]));
}
示例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]);
}
示例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;
}
示例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"
示例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]));
}