Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JavaScript-Runtime makes it hard to work with the ATN #4810

Open
MatthiasHarzer opened this issue Apr 1, 2025 · 1 comment · May be fixed by #4805
Open

JavaScript-Runtime makes it hard to work with the ATN #4810

MatthiasHarzer opened this issue Apr 1, 2025 · 1 comment · May be fixed by #4805

Comments

@MatthiasHarzer
Copy link

MatthiasHarzer commented Apr 1, 2025

I'm trying to build a suggestion system for my ANTLR4 grammer in a TypeScript project, based on this guide by Daniel Bazaco. It makes use of the ATN generated by ANTLR and distignuishes between the ATN-transitions using instanceof checks. However since the npm-bundle does neither export the ATN-transition, nor its types, it's virtualy impossible to distinguish between the different transition-types like AtomTransition, RuleTransition, etc.

Exporting the ATN transitions and adding its types wouldn't impact the functionality of the remaining runtime at all, there for I'd really like to see them added soon. It would make working with the ATN a lot easier.

I have already setup a PR #4805 which addresses this issue,

@0xENDER
Copy link

0xENDER commented Apr 5, 2025

I think people keep asking for the ATN types and objects to be exposed in all sorts of development environments. But the way I see it, I don't think they will ever do so (as hinted by #4805 (comment)).

I'd suggest you simply apply your own patches to the source code! (Possibly using .diff files after fetching the runtime's codebase)
Seeing as releases are not very frequent, it wouldn't be terribly hard to maintain in the long run on your own.

Edit: you could use patch-package..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants