本文整理汇总了C#中SyntaxNodeOrToken.ToFullString方法的典型用法代码示例。如果您正苦于以下问题:C# SyntaxNodeOrToken.ToFullString方法的具体用法?C# SyntaxNodeOrToken.ToFullString怎么用?C# SyntaxNodeOrToken.ToFullString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SyntaxNodeOrToken
的用法示例。
在下文中一共展示了SyntaxNodeOrToken.ToFullString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindBestMatch
private void FindBestMatch(Stack<SyntaxNodeOrToken> stack, SyntaxNodeOrToken node, out int index, out int similarity)
{
index = -1;
similarity = -1;
int i = 0;
foreach (var listNode in stack)
{
if (i >= MaxSearchLength)
{
break;
}
if (AreIdentical(listNode, node))
{
var sim = node.FullSpan.Length;
if (sim > similarity)
{
index = i;
similarity = sim;
return;
}
}
else if (AreSimilar(listNode, node))
{
var sim = GetSimilarity(listNode, node);
// Are these really the same? This may be expensive so only check this if
// similarity is rated equal to them being identical.
if (sim == node.FullSpan.Length && node.IsToken)
{
if (listNode.ToFullString() == node.ToFullString())
{
index = i;
similarity = sim;
return;
}
}
if (sim > similarity)
{
index = i;
similarity = sim;
}
}
else
{
// check one level deep inside list node's children
int j = 0;
foreach (var child in listNode.ChildNodesAndTokens())
{
if (j >= MaxSearchLength)
{
break;
}
j++;
if (AreIdentical(child, node))
{
index = i;
similarity = node.FullSpan.Length;
return;
}
else if (AreSimilar(child, node))
{
var sim = GetSimilarity(child, node);
if (sim > similarity)
{
index = i;
similarity = sim;
}
}
}
}
i++;
}
}