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

Rename lexer and parser to prevent conflicts #54

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

marcelotto
Copy link

@marcelotto marcelotto commented Dec 20, 2023

Within erlex, the lexer and parser are generically named as :lexer and :parser. This generic naming has led to conflicts with other libraries that employ :lexer and :parser modules in their own implementations.
A particular example of such a conflict is the clash with the lexer and parser in the SPARQL.ex library. This issue came to my attention after extensive troubleshooting, highlighting the difficulty in diagnosing such conflicts.

Historically, in older versions of Elixir, the SPARQL lexer and parser seemed to be preferentially loaded, which led to concealed issues when using dialyxir. These issues typically manifested as legacy warnings, triggered by the unsuccessful use of the SPARQL parser in parsing Dialyzer data. Given that legacy warnings are also commonly produced for unsupported formats (notably, dialyxir currently has 74 issues related to legacy warnings), this underlying conflict between parsers remained unrecognized for a considerable duration.

The conflict became evident with recent changes in the compilation process introduced in Elixir 1.15. These modifications in module loading behavior brought the previously unnoticed conflict to light, where the erlex parser was unexpectedly employed in parsing SPARQL queries. Intriguingly, this issue did not arise consistently but only manifested from the second attempt after a recompilation and was still not immediately recognizable as a parser conflict, since the parser errors were translated to regular SPARQL.ex parser errors.

Although I have already addressed this issue in SPARQL.ex by adopting more unique names for the lexer and parser, I believe that a similar resolution should be implemented in erlex. Considering its widespread use, primarily as a transitive dependency of dialyxir, many projects may unknowingly be at risk of similar conflicts.

christhekeele added a commit to christhekeele/erlex that referenced this pull request Apr 14, 2024
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 this pull request may close these issues.

None yet

1 participant