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

NULL as a keyword in the target language breaks compilation #15

Closed
jacobobq opened this issue Jun 3, 2022 · 2 comments
Closed

NULL as a keyword in the target language breaks compilation #15

jacobobq opened this issue Jun 3, 2022 · 2 comments

Comments

@jacobobq
Copy link

jacobobq commented Jun 3, 2022

So... C++, right? Has a macro somewhere called NULL. And when tokens are generated in the source code of the parser they use the token itself as name. Now, SQL has a NULL keyword so trying to generate a grammar for any flavor of it fails because NULL is already defined.

For instance, take the Trino's (formerly PrestoSQL) grammar definition. This will fail to compile the generated .h/.cpp files.

Expected behaviour:
It compiles normally.

@jacobobq
Copy link
Author

jacobobq commented Jun 3, 2022

I'm trying to find a way to solve this (probably prefix all tokens) and I will try to send you a PR.

Currently no luck.

@camertron
Copy link
Owner

Hey @jacobobq, thanks for bringing this up. Symbol clashes like this are a known class of problem with ANTLR that is unlikely to be addressed. Here's a very similar issue to the one you brought up. As suggested, you might try adding an underscore to the end, eg. NULL_.

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

No branches or pull requests

2 participants