protected SyntaxParser( SourceText text, Language language, LanguageParseOptions options, SyntaxNode oldTree, IEnumerable <TextChangeRange> changes, CancellationToken cancellationToken = default(CancellationToken)) { this.text = text; this.language = language; this.factory = this.language.InternalSyntaxFactory; this.options = options; this.cancellationToken = cancellationToken; }
public Antlr4SyntaxParser(SourceText text, Language language, LanguageParseOptions options, SyntaxNode oldTree, IEnumerable <TextChangeRange> changes, CancellationToken cancellationToken = default(CancellationToken)) : base(text, language, options, oldTree, changes, cancellationToken) { this.Antlr4Errors = new Dictionary <int, string>(); AntlrInputStream inputStream = new AntlrInputStream(text.ToString()); this.Lexer = this.CreateLexer(inputStream); this.CommonTokenStream = new CommonTokenStream(this.Lexer); this.Parser = this.CreateParser(this.CommonTokenStream); this.Lexer.RemoveErrorListeners(); this.Parser.RemoveErrorListeners(); this.Lexer.AddErrorListener(this); this.Parser.AddErrorListener(this); this.tokens = this.CommonTokenStream.GetTokens(); _syntaxFacts = language.SyntaxFacts; }