Esempio n. 1
0
 private void ClassifyDefineDirective(DefineDirectiveTriviaSyntax node)
 {
     AddClassification(node.HashToken, ClassificationTypeNames.PreprocessorKeyword);
     AddClassification(node.DefineKeyword, ClassificationTypeNames.PreprocessorKeyword);
     AddClassification(node.Name, ClassificationTypeNames.Identifier);
     ClassifyDirectiveTrivia(node);
 }
Esempio n. 2
0
 public override void VisitDefineDirectiveTrivia(DefineDirectiveTriviaSyntax node)
 {
     // if (debug) Console.WriteLine(node.ToFullString());
     // Todo("DefineDirectiveTrivia"); var nl = OurLine.NewLine(LineKind.Decl, "DefineDirectiveTrivia");
     // nl.Source = node.ToFullString();
     // nl.ParentKind = node.Parent.RawKind;
     // nl.RawKind = node.RawKind;
     // LogCommand(nl);
     base.VisitDefineDirectiveTrivia(node);
 }
Esempio n. 3
0
        public override void VisitDefineDirectiveTrivia(DefineDirectiveTriviaSyntax node)
        {
            if (!PreVisit(node))
            {
                return;
            }

            base.VisitDefineDirectiveTrivia(node);

            PostVisit(node);
        }
Esempio n. 4
0
        public DefineState IsDefined(string id, out DefineDirectiveTriviaSyntax directive)
        {
            for (var current = _directives; current != null && current.Any(); current = current.Tail)
            {
                switch (current.Head.Kind)
                {
                    case SyntaxKind.ObjectLikeDefineDirectiveTrivia:
                    case SyntaxKind.FunctionLikeDefineDirectiveTrivia:
                        if (current.Head.GetIdentifier() == id)
                        {
                            directive = (DefineDirectiveTriviaSyntax) current.Head.Node;
                            return DefineState.Defined;
                        }
                        break;

                    case SyntaxKind.UndefDirectiveTrivia:
                        if (current.Head.GetIdentifier() == id)
                        {
                            directive = null;
                            return DefineState.Undefined;
                        }
                        break;


                    case SyntaxKind.ElifDirectiveTrivia:
                    case SyntaxKind.ElseDirectiveTrivia:
                        // Skip directives from previous branches of the same #if.
                        do
                        {
                            current = current.Tail;

                            if (current == null || !current.Any())
                            {
                                directive = null;
                                return DefineState.Unspecified;
                            }
                        }
                        while (!current.Head.Kind.IsIfLikeDirective());

                        break;
                }
            }

            directive = null;
            return DefineState.Unspecified;
        }
Esempio n. 5
0
        public DefineState IsDefined(string id, out DefineDirectiveTriviaSyntax directive)
        {
            for (var current = _directives; current != null && current.Any(); current = current.Tail)
            {
                switch (current.Head.Kind)
                {
                case SyntaxKind.ObjectLikeDefineDirectiveTrivia:
                case SyntaxKind.FunctionLikeDefineDirectiveTrivia:
                    if (current.Head.GetIdentifier() == id)
                    {
                        directive = (DefineDirectiveTriviaSyntax)current.Head.Node;
                        return(DefineState.Defined);
                    }
                    break;

                case SyntaxKind.UndefDirectiveTrivia:
                    if (current.Head.GetIdentifier() == id)
                    {
                        directive = null;
                        return(DefineState.Undefined);
                    }
                    break;


                case SyntaxKind.ElifDirectiveTrivia:
                case SyntaxKind.ElseDirectiveTrivia:
                    // Skip directives from previous branches of the same #if.
                    do
                    {
                        current = current.Tail;

                        if (current == null || !current.Any())
                        {
                            directive = null;
                            return(DefineState.Unspecified);
                        }
                    }while (!current.Head.Kind.IsIfLikeDirective());

                    break;
                }
            }

            directive = null;
            return(DefineState.Unspecified);
        }
Esempio n. 6
0
 private void ClassifyDefineDirective(DefineDirectiveTriviaSyntax node)
 {
     AddClassification(node.HashToken, ClassificationTypeNames.PreprocessorKeyword);
     AddClassification(node.DefineKeyword, ClassificationTypeNames.PreprocessorKeyword);
     AddClassification(node.Name, ClassificationTypeNames.Identifier);
     ClassifyDirectiveTrivia(node);
 }
        //public override void VisitDefaultSwitchLabel(DefaultSwitchLabelSyntax node)
        //{
        //    base.VisitDefaultSwitchLabel(node);
        //}

        public override void VisitDefineDirectiveTrivia(DefineDirectiveTriviaSyntax node)
        {
            Debug.Fail(node.ToString());
            base.VisitDefineDirectiveTrivia(node);
        }
Esempio n. 8
0
 public override Evaluation VisitDefineDirectiveTrivia(DefineDirectiveTriviaSyntax node)
 {
     return(base.VisitDefineDirectiveTrivia(node));
 }
Esempio n. 9
0
 public override void VisitDefineDirectiveTrivia(DefineDirectiveTriviaSyntax node)
 {
     throw new NotImplementedException();
 }
Esempio n. 10
0
 public override SyntaxNode VisitDefineDirectiveTrivia(DefineDirectiveTriviaSyntax node)
 {
     node = (DefineDirectiveTriviaSyntax)base.VisitDefineDirectiveTrivia(node);
     Classes.Add(node);
     return(node);
 }
Esempio n. 11
0
 public override Ust VisitDefineDirectiveTrivia(DefineDirectiveTriviaSyntax node)
 {
     throw new InvalidOperationException();
 }
Esempio n. 12
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="node"></param>
 public override sealed void VisitDefineDirectiveTrivia(DefineDirectiveTriviaSyntax node)
 {
     this.OnNodeVisited(node);
     if (!this.traverseRootOnly) base.VisitDefineDirectiveTrivia(node);
 }
Esempio n. 13
0
        public static QuickInfoModel ForMacroDefinition(SemanticModel semanticModel, TextSpan span, DefineDirectiveTriviaSyntax macroDefinition)
        {
            var glyph        = Glyph.Macro;
            var symbolMarkup = new SymbolMarkup(new[] { new SymbolMarkupToken(SymbolMarkupKind.PlainText, $"(macro definition) {macroDefinition}") });

            return(new QuickInfoModel(semanticModel, span, glyph, symbolMarkup, string.Empty));
        }
Esempio n. 14
0
 public TameDefineDirectiveTriviaSyntax(DefineDirectiveTriviaSyntax node)
 {
     Node = node;
     AddChildren();
 }
Esempio n. 15
0
 public override void VisitDefineDirectiveTrivia(DefineDirectiveTriviaSyntax node)
 {
     InsertLLOCMap(node.GetLocation());
     base.VisitDefineDirectiveTrivia(node);
 }
Esempio n. 16
0
 public static QuickInfoModel ForMacroDefinition(SemanticModel semanticModel, TextSpan span, DefineDirectiveTriviaSyntax macroDefinition)
 {
     var glyph = Glyph.Macro;
     var symbolMarkup = new SymbolMarkup(new[] { new SymbolMarkupToken(SymbolMarkupKind.PlainText, $"(macro definition) {macroDefinition}") });
     return new QuickInfoModel(semanticModel, span, glyph, symbolMarkup, string.Empty);
 }
Esempio n. 17
0
 public override void VisitDefineDirectiveTrivia(DefineDirectiveTriviaSyntax node)
 {
     new Entities.DefineDirective(cx, node);
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="node"></param>
 public override sealed void VisitDefineDirectiveTrivia(DefineDirectiveTriviaSyntax node)
 {
     this.OnNodeVisited(node, this.type.IsInstanceOfType(node));
     base.VisitDefineDirectiveTrivia(node);
 }
Esempio n. 19
0
 public override void VisitDefineDirectiveTrivia(DefineDirectiveTriviaSyntax node)
 {
 }
 //
 // Summary:
 //     Called when the visitor visits a DefineDirectiveTriviaSyntax node.
 public virtual void VisitDefineDirectiveTrivia(DefineDirectiveTriviaSyntax node);