本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}