Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
		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);
		}
Exemplo n.º 5
0
		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);
		}
Exemplo n.º 6
0
		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);
		}
Exemplo n.º 7
0
		protected virtual void WriteIdentifier(Identifier identifier)
		{
			WriteIdentifier(identifier, (identifier.AnnotationVT<TextColor>() ?? TextColor.Text).Box());
		}
		protected virtual void WriteIdentifier(Identifier identifier)
		{
			WriteIdentifier(identifier, identifier.AnnotationVT<TextTokenType>() ?? TextTokenType.Text);
		}