protected static FifthParser GetParserFor(string fragment) { var lexer = new FifthLexer(new AntlrInputStream(fragment)); lexer.RemoveErrorListeners(); lexer.AddErrorListener(new ThrowingErrorListener <int>()); var parser = new FifthParser(new CommonTokenStream(lexer)); parser.RemoveErrorListeners(); parser.AddErrorListener(new ThrowingErrorListener <IToken>()); return(parser); }
private static FifthParser GetParserFor(ICharStream source) { var lexer = new FifthLexer(source); lexer.RemoveErrorListeners(); lexer.AddErrorListener(new ThrowingErrorListener <int>()); var parser = new FifthParser(new CommonTokenStream(lexer)); parser.RemoveErrorListeners(); parser.AddErrorListener(new ThrowingErrorListener <IToken>()); return(parser); }