Closed alwonder closed 6 years ago
@alwonder Reviewing now
@alwonder Looks great, I'm done reviewing and will merge and release. And thanks again, I appreciate your contribution to the project. I have some other changes that I plan to release in the future that I would like for you and others to review.
Problem
The other day I've came across the issue that I can't access my labeled alternative rule contexts. It won't declare neither in .d.ts file nor
exports
section in Parser.js file. For example, if I have the grammar with rules like:it compiles only
ExpressionContext
andLiteralContext
classes although Parser.js has members for labeled alternatives.Solution
I found out this happens because labeled alternative contexts don't exist inside the parser instance. But we can get it from the Parser class itself as static methods. So, if we pass through Parser class keys, we'll get both labeled alternatives and regular rule contexts. Thereby after some corrections I get the following output.
After this change I'm able to check the current context instance and safely invoke its inner methods