mike-lischke / antlr4-c3

A grammar agnostic code completion engine for ANTLR4 based parsers
MIT License
396 stars 62 forks source link

`followSetsByATN` constuctor name conflicts #125

Closed roberthovsepyan closed 2 months ago

roberthovsepyan commented 2 months ago

Because of followSetsByATN Map using this.parser.constructor.name as keys, it can cause conflicts. Especially if the code is minified and obfuscated then constructor names might be identical.

This behaviour is really unexpected, especially since we're creating a new c3 instance for new parser and don't expect to have any shared logic.

I would at least have this info in README. Thanks

mike-lischke commented 2 months ago

I need a mapping from parser class to the cache for its instances. I know that can create trouble with minification. But usually you can disable name mangling for the project or a single file in build tools like webpack or esbuild. Name mangling is not really a big help, as it also causes trouble if you have to debug into a third party package. All it does is to make the package a bit smaller, which is not a real time saver these days.