Ejemplo n.º 1
0
        public override IListSource <ITagSpan <ITag> > RunAnalysis(ITextSnapshot snapshot,
                                                                   SparseAList <EditorToken> eTokens, CancellationToken cancellationToken)
        {
            var sourceFile = new TextSnapshotAsSourceFile(snapshot);
            var tokens     = ToNormalTokens(eTokens);
            var results    = new DList <ITagSpan <ClassificationTag> >();
            var parser     = new MyLesParser(tokens, sourceFile, TraceMessageSink.Value, results);
            var _          = parser.StmtList();

            results.Sort((t1, t2) => t1.Span.Start.Position.CompareTo(t2.Span.Start.Position));
            return(results);
        }
Ejemplo n.º 2
0
        public override IListSource <ITagSpan <ITag> > RunAnalysis(ITextSnapshot snapshot,
                                                                   SparseAList <EditorToken> eTokens, CancellationToken cancellationToken)
        {
            var sourceFile    = new TextSnapshotAsSourceFile(snapshot);
            var tokens        = ToNormalTokens(eTokens);
            var tokensAsLexer = new TokenListAsLexer(tokens, sourceFile);
            var tokensTree    = new TokensToTree(new TokenListAsLexer(tokens, sourceFile), true)
            {
                ErrorSink = MessageSink.Trace
            };
            var results = new DList <ITagSpan <ClassificationTag> >();
            var parser  = new MyLesParser(tokensTree.Buffered(), sourceFile, MessageSink.Trace, results);

            parser.ParseStmtsGreedy();
            results.Sort((t1, t2) => t1.Span.Start.Position.CompareTo(t2.Span.Start.Position));
            return(results);
        }