Ejemplo n.º 1
0
        public static XmlDocumentSyntax Analyze(BoundSourceFileBuilder binder)
        {
            var text = binder.SourceFile.Content;
            XmlDocumentSyntax parsedXml = Parser.ParseText(text);

            Classify(binder, parsedXml);
            return(parsedXml);
        }
Ejemplo n.º 2
0
        public static void AddElementNameReferences(
            this BoundSourceFileBuilder binder,
            IXmlElement element,
            params ReferenceSymbol[] references)
        {
            var nameNode = element.NameNode();

            binder.AnnotateReferences(nameNode.Start, nameNode.FullWidth - nameNode.GetTrailingTriviaWidth(), references);
        }
Ejemplo n.º 3
0
        public static void AddAttributeValueDefinition(
            this BoundSourceFileBuilder binder,
            XmlAttributeSyntax attribute,
            DefinitionSymbol definition)
        {
            var node = attribute?.ValueNode.As <XmlStringSyntax>()?.TextTokens.Node;

            if (node != null)
            {
                binder.AnnotateDefinition(node.Start, node.FullWidth, definition);
            }
        }
Ejemplo n.º 4
0
        public static void AddAttributeNameReferences(
            this BoundSourceFileBuilder binder,
            XmlAttributeSyntax attribute,
            params ReferenceSymbol[] references)
        {
            var node = attribute?.NameNode;

            if (node != null)
            {
                binder.AnnotateReferences(node.Start, node.FullWidth, references);
            }
        }
Ejemplo n.º 5
0
        public static void AddAttributeValueReferences(
            this BoundSourceFileBuilder binder,
            XmlAttributeSyntax attribute,
            params ReferenceSymbol[] references)
        {
            var node = attribute?.ValueNode.As <XmlStringSyntax>()?.TextTokens.Node;

            if (node != null)
            {
                binder.AnnotateReferences(node.Start, node.FullWidth, references);
            }
        }
Ejemplo n.º 6
0
        private static void Classify(BoundSourceFileBuilder binder, XmlDocumentSyntax parsedXml)
        {
            ClassifierVisitor.Visit(parsedXml, 0, parsedXml.FullWidth, (start, length, node, classification) =>
            {
                var leadingTriviaWidth  = node.GetLeadingTriviaWidth();
                var trailingTriviaWidth = node.GetTrailingTriviaWidth();
                start  += leadingTriviaWidth;
                length -= (leadingTriviaWidth + trailingTriviaWidth);

                binder.AnnotateClassification(start, length, ClassificationTypeNamesLookup[(int)classification]);
            });
        }
Ejemplo n.º 7
0
        public DocumentAnalyzer(
            SemanticServices semanticServices,
            Document document,
            CompilationServices compilationServices,
            string logicalPath,
            AnalyzedProjectContext context,
            BoundSourceFileBuilder boundSourceFile)
        {
            _document             = document;
            CompilationServices   = compilationServices;
            _compilation          = compilationServices.Compilation;
            _analyzedProject      = context.Project;
            this.semanticServices = semanticServices;
            this.context          = context;

            references = new List <ReferenceSpan>();

            this.boundSourceFile = boundSourceFile;
        }