mike-lischke/antlr4ng

ParserRuleContext, access to InputStrem and Parser

Closed this issue · 2 comments

Hi,
When I was using antlr4ts I think I was able to get InputStream and Parser from context with:

input: ctx.parser.getInputStream(),
recognizer: ctx.parser,

I don't find a way to do so with antlr4ng.

Is it possible?

I removed rarely needed members that increase memory consumption and initialization time, to improve the performance of the runtime. Since the parse tree is returned from a parser instance, you could just pass that around, if needed. From that you can get the input stream using parser.inputStream and the lexer parser.inputStream.tokenSource.

In error handlers the recognizer is passed in as first parameter.

Thanks for precisions.