本文整理汇总了C#中Identifier.Annotation方法的典型用法代码示例。如果您正苦于以下问题:C# Identifier.Annotation方法的具体用法?C# Identifier.Annotation怎么用?C# Identifier.Annotation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Identifier
的用法示例。
在下文中一共展示了Identifier.Annotation方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteIdentifier
public override void WriteIdentifier(Identifier identifier, TextTokenType tokenType)
{
if (tokenType == TextTokenType.Text)
tokenType = TextTokenHelper.GetTextTokenType(identifier.AnnotationVT<TextTokenType>() ?? identifier.Annotation<object>());
if (tokenType != TextTokenType.Keyword && (identifier.IsVerbatim || CSharpOutputVisitor.IsKeyword(identifier.Name, identifier))) {
output.Write('@', TextTokenType.Operator);
}
var definition = GetCurrentDefinition(identifier);
if (definition != null) {
output.WriteDefinition(IdentifierEscaper.Escape(identifier.Name), definition, tokenType, false);
return;
}
object memberRef = GetCurrentMemberReference();
if (memberRef != null) {
output.WriteReference(IdentifierEscaper.Escape(identifier.Name), memberRef, tokenType);
return;
}
definition = GetCurrentLocalDefinition();
if (definition != null) {
output.WriteDefinition(IdentifierEscaper.Escape(identifier.Name), definition, tokenType);
return;
}
memberRef = GetCurrentLocalReference();
if (memberRef != null) {
output.WriteReference(IdentifierEscaper.Escape(identifier.Name), memberRef, tokenType, true);
return;
}
if (firstUsingDeclaration) {
output.MarkFoldStart(defaultCollapsed: true);
firstUsingDeclaration = false;
}
var s = identifier.Name;
if (identifier.Annotation<IdentifierFormatted>() == null)
s = IdentifierEscaper.Escape(s);
output.Write(s, tokenType);
}
示例2: WriteIdentifier
public override void WriteIdentifier(Identifier identifier, TextTokenKind tokenKind)
{
if (tokenKind == TextTokenKind.Text)
tokenKind = TextTokenKindUtils.GetTextTokenType(identifier.AnnotationVT<TextTokenKind>() ?? identifier.Annotation<object>());
if (tokenKind != TextTokenKind.Keyword && (identifier.IsVerbatim || CSharpOutputVisitor.IsKeyword(identifier.Name, identifier))) {
output.Write("@", TextTokenKind.Operator);
}
var definition = GetCurrentDefinition(identifier);
if (definition != null) {
output.WriteDefinition(IdentifierEscaper.Escape(identifier.Name), definition, tokenKind, false);
return;
}
object memberRef = GetCurrentMemberReference();
if (memberRef != null) {
output.WriteReference(IdentifierEscaper.Escape(identifier.Name), memberRef, tokenKind);
return;
}
definition = GetCurrentLocalDefinition();
if (definition != null) {
output.WriteDefinition(IdentifierEscaper.Escape(identifier.Name), definition, tokenKind);
return;
}
memberRef = GetCurrentLocalReference();
if (memberRef != null) {
output.WriteReference(IdentifierEscaper.Escape(identifier.Name), memberRef, tokenKind, true);
return;
}
if (firstUsingDeclaration) {
firstUsingDeclaration = false;
}
var s = identifier.Name;
if (identifier.Annotation<IdentifierFormatted>() == null)
s = IdentifierEscaper.Escape(s);
output.Write(s, tokenKind);
}
示例3: WriteIdentifier
public override void WriteIdentifier(Identifier identifier, TextTokenType tokenType)
{
if (tokenType == TextTokenType.Text)
tokenType = TextTokenHelper.GetTextTokenType(identifier.AnnotationVT<TextTokenType>() ?? identifier.Annotation<object>());
var definition = GetCurrentDefinition(identifier);
if (definition != null) {
output.WriteDefinition(IdentifierEscaper.Escape(identifier.Name), definition, tokenType, false);
return;
}
object memberRef = GetCurrentMemberReference();
if (memberRef != null) {
output.WriteReference(IdentifierEscaper.Escape(identifier.Name), memberRef, tokenType);
return;
}
definition = GetCurrentLocalDefinition();
if (definition != null) {
output.WriteDefinition(IdentifierEscaper.Escape(identifier.Name), definition, tokenType);
return;
}
memberRef = GetCurrentLocalReference();
if (memberRef != null) {
output.WriteReference(IdentifierEscaper.Escape(identifier.Name), memberRef, tokenType, true);
return;
}
if (firstUsingDeclaration) {
output.MarkFoldStart(defaultCollapsed: true);
firstUsingDeclaration = false;
}
output.Write(IdentifierEscaper.Escape(identifier.Name), tokenType);
}
示例4: VisitIdentifier
public virtual void VisitIdentifier(Identifier identifier)
{
// Do not call StartNode and EndNode for Identifier, because they are handled by the ITokenWriter.
// ITokenWriter assumes that each node processed between a
// StartNode(parentNode)-EndNode(parentNode)-pair is a child of parentNode.
WriteIdentifier(identifier, CSharpMetadataTextColorProvider.Instance.GetColor(identifier.Annotation<object>()));
}
示例5: VisitIdentifier
public virtual void VisitIdentifier(Identifier identifier)
{
// Do not call StartNode and EndNode for Identifier, because they are handled by the ITokenWriter.
// ITokenWriter assumes that each node processed between a
// StartNode(parentNode)-EndNode(parentNode)-pair is a child of parentNode.
WriteIdentifier(identifier, TextTokenHelper.GetTextTokenType(identifier.Annotation<object>()));
}