public MyLesParser(IListSource <Token> tokens, TextSnapshotAsSourceFile file, IMessageSink messageSink, IAdd <ITagSpan <ClassificationTag> > results) : base(tokens, file, messageSink) { _file = file; _results = results; }
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); }
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); }
protected SyntaxClassifierForVS(VSBuffer ctx) { _ctx = ctx; _wrappedBuffer = new TextSnapshotAsSourceFile(Buffer.CurrentSnapshot); Buffer.Changed += OnTextBufferChanged; _lexerMessageSink = new MessageSinkFromDelegate((severity, context, fmt, args) => { if (severity >= Severity.Note) { _lexerError = new LexerMessage { OriginalValue = _lexerError, Msg = new LogMessage(severity, context, fmt, args) } } ; }); InitClassificationTypes(); }