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

[postgresql] Fix for #4311 -- remove Antlr "locals", stop calling sub-parser. #4314

Merged
merged 1 commit into from
Nov 9, 2024

Conversation

kaby76
Copy link
Contributor

@kaby76 kaby76 commented Nov 7, 2024

This PR fixes #4311. The problem is that the .g4 grammar file used locals [ ... ]. This cannot work for a multi-targeted grammar. In addition, the grammar tried to parse function bodies as always Pl/SQL. It ignores the fact that it could be something else.

  • The locals [ ... ] declaration has been removed.
  • The sub-parse of the function bodies was removed. I added //NB comments to re-implement the sub-parse in the correct way later.

The grammar is now twice as fast to parse the test suite in examples/, likely because it is not parsing pl/pgsql. To consider: is it better to create the parser once and use Reset() instead of creating a parser for each pl/pgsql input?

@kaby76 kaby76 changed the title [postgresql] Fix for #4311 -- remove Antlr "locals" -- not target agnostic. [postgresql] Fix for #4311 -- remove Antlr "locals", stop calling sub-parser. Nov 9, 2024
@teverett
Copy link
Member

teverett commented Nov 9, 2024

@kaby76 thanks!

@teverett teverett merged commit 613f1ab into antlr:master Nov 9, 2024
10 checks passed
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.

[postgresql] Grammar contains target-specific declarations via locals.
2 participants