Both Lexer and Parser have setInputStream method so they can be reused. We could add an option to reuse them between tests of the same grammar to make sure it works properly.
It's not about performance but verification. I had an issue with JavaScript lexer that affected my project. Reusing lexer and parser will allow us to test such case.
Both Lexer and Parser have
setInputStream
method so they can be reused. We could add an option to reuse them between tests of the same grammar to make sure it works properly.