本文整理汇总了C#中ParseNode.IsUnnamed方法的典型用法代码示例。如果您正苦于以下问题:C# ParseNode.IsUnnamed方法的具体用法?C# ParseNode.IsUnnamed怎么用?C# ParseNode.IsUnnamed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParseNode
的用法示例。
在下文中一共展示了ParseNode.IsUnnamed方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PrintSimpleNode
public void PrintSimpleNode(ParseNode pn)
{
string s = "<" + pn.RuleType;
if (!pn.IsUnnamed())
s += " name='" + pn.RuleName + "'";
s += ">";
s += pn.ToString();
s += "</" + pn.RuleType + ">";
WriteLine(s);
}
示例2: PrintNode
public override void PrintNode(ParseNode pn, int depth)
{
indent = new String(' ', depth * 2);
if (pn.IsUnnamed())
{
foreach (ParseNode child in pn)
PrintNode(child, depth);
}
else if (pn.RuleName == "pp_directive")
{
PrintSimpleNode(pn);
}
else if (pn.RuleName == "comment_set")
{
PrintSimpleNode(pn);
}
else
{
string s = "<" + pn.RuleType;
if (!pn.IsUnnamed())
s += " name='" + pn.RuleName + "'";
s += ">";
WriteLine(s);
if (pn.Count == 0)
{
WriteLine(pn.ToString());
}
else
{
foreach (ParseNode tmp in pn)
PrintNode(tmp, depth + 1);
}
WriteLine("</" + pn.RuleType + ">");
}
}
示例3: PrintSimpleNode
private void PrintSimpleNode(ParseNode node)
{
string name = node.IsUnnamed() ? "" : " name='" + node.RuleName + "'";
string value = string.Format("<{0}{1}>{2}</{0}>", node.RuleType, name, Escape(node));
WriteLine(value);
}
示例4: PrintFunction
public override void PrintFunction(ParseNode pn,int depth)
{
if (pn.IsUnnamed())
{
foreach (ParseNode child in pn)
PrintFunction(child, depth);
}
else if (pn.RuleName == "pp_directive")
{
//PrintSimpleNode(pn);
}
else if (pn.RuleName == "comment_set")
{
//PrintSimpleNode(pn);
}
else if (pn.RuleName == "function_group")
{
if (pn.Count != 6)
{
Trace.Assert(false);
return;
}
//string debug = pn[1].ToString();
FunctionDefine func = new FunctionDefine();
func.ReturnType = pn[2].ToString();
func.FunctionName = pn[3].ToString();
func.Param = pn[4].ToString();
func.Body = pn[5].ToString();
funList.Add(func);
}
else
{
if (pn.Count != 0)
{
foreach (ParseNode tmp in pn)
PrintFunction(tmp, depth + 1);
}
}
}
示例5: Add
protected override void Add(ParseNode node, int depth)
{
Indent = new String(' ', depth*2);
if (node.IsUnnamed())
{
if (node.Count == 0)
WriteLine(Escape(node));
foreach (var child in node)
Add(child, depth);
return;
}
switch (node.RuleName)
{
case "pp_directive":
PrintSimpleNode(node);
return;
case "comment_set":
PrintSimpleNode(node);
return;
}
string name = node.IsUnnamed() ? "" : $" name='{node.RuleName}'";
string beginTag = $"<{node.RuleType}{name}>";
WriteLine(beginTag);
if (node.Count == 0)
{
WriteLine(Escape(node));
}
else
{
foreach (ParseNode tmp in node)
Add(tmp, depth + 1);
}
WriteLine($"</{node.RuleType}>");
}