本文整理匯總了C#中AST.getNumberOfChildren方法的典型用法代碼示例。如果您正苦於以下問題:C# AST.getNumberOfChildren方法的具體用法?C# AST.getNumberOfChildren怎麽用?C# AST.getNumberOfChildren使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類AST
的用法示例。
在下文中一共展示了AST.getNumberOfChildren方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Emit
private INode Emit(AST a, IGraph to)
{
String text = a.getText();
int iType = a.Type;
String type = parserpackage.GetTypeName(iType);
NodeType currentNodeType = GetNodeType(type, to);
INode currentNode = to.AddNode(currentNodeType);
currentNode.SetAttribute("value", text);
if (a.getNumberOfChildren() > 0)
{
List<AST> l = GetChildren(a);
INode previousChild = null;
foreach (AST current in l)
{
INode childNode = Emit(current, to);
EdgeType childType = GetEdgeType("child", to);
to.AddEdge(childType, currentNode, childNode);
if (previousChild != null)
{
EdgeType nextType = GetEdgeType("next", to);
to.AddEdge(nextType, previousChild, childNode);
}
previousChild = childNode;
}
}
return currentNode;
}
示例2: DumpNode
private static void DumpNode(AST rootNode, int level)
{
Trace.WriteLine(new string(' ', level) + rootNode.ToString());
int numberOfChildren = rootNode.getNumberOfChildren();
if (numberOfChildren > 0)
{
AST node = rootNode.getFirstChild();
while (node != null)
{
DumpNode(node, level + 2);
node = node.getNextSibling();
}
}
}