本文整理汇总了C#中ITreeNode.GetTokenType方法的典型用法代码示例。如果您正苦于以下问题:C# ITreeNode.GetTokenType方法的具体用法?C# ITreeNode.GetTokenType怎么用?C# ITreeNode.GetTokenType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITreeNode
的用法示例。
在下文中一共展示了ITreeNode.GetTokenType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindDeclaredElement
public DeclaredElementInstance FindDeclaredElement(ITreeNode node, IFile file, out TextRange sourceRange) {
TokenNodeType tokenType = node.GetTokenType();
if (tokenType == CSharpTokenType.VAR_KEYWORD)
return FindElementFromVarKeyword(node, file, out sourceRange);
if (tokenType == CSharpTokenType.NEW_KEYWORD)
return FindElementFromNewKeyword(node, file, out sourceRange);
sourceRange = TextRange.InvalidRange;
return null;
}
示例2: ProcessBeforeInterior
/// <summary>
/// Processes a node, before its descendants are processed.
/// </summary>
/// <param name="element">The node to process.</param>
public override void ProcessBeforeInterior(ITreeNode element) {
var errorElement = element as MissingTokenErrorElement;
if (errorElement != null) {
AddHighlighting(new HighlightingInfo(GetMissingTokenRange(errorElement), new MissingTokenHighlighting(errorElement)));
return;
}
// can't have a statement block (<# #>) after a feature block (<#+ #>)
var statementBlock = element as T4StatementBlock;
if (statementBlock != null && _gotFeature) {
AddHighlighting(new HighlightingInfo(element.GetHighlightingRange(), new StatementAfterFeatureHighlighting(statementBlock)));
return;
}
// verify that a directive attribute value is valid
if (element.GetTokenType() == T4TokenNodeTypes.Value) {
ProcessAttributeValue((T4Token) element);
return;
}
var directive = element as IT4Directive;
if (directive != null)
ProcessDirective(directive);
else if (element is T4FeatureBlock) {
_gotFeature = true;
if (element == _lastFeature) {
_gotLastFeature = true;
_inLastFeature = true;
return;
}
}
// can't have anything after the last feature block
if (!_gotLastFeature || _inLastFeature || _afterLastFeatureErrorAdded)
return;
TokenNodeType tokenType = element.GetTokenType();
if (tokenType != null && tokenType.IsWhitespace)
return;
// highlight from just after the last feature to the end of the document
DocumentRange range = element.GetHighlightingRange().SetEndTo(File.GetDocumentRange().TextRange.EndOffset);
AddHighlighting(new HighlightingInfo(range, new AfterLastFeatureHighlighting(element)));
_afterLastFeatureErrorAdded = true;
}
示例3: IsFilteredNode
/// <summary>
/// Determines whether a given node is filtered.
/// </summary>
/// <param name="node">The node to check.</param>
/// <returns><c>true</c> if <paramref name="node"/> is a whitespace; otherwise, <c>false</c>.</returns>
public override bool IsFilteredNode(ITreeNode node)
{
TokenNodeType nodeType = node.GetTokenType();
return nodeType != null && nodeType.IsWhitespace;
}