-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
FIX: SimpleSQLGrammar quote parsing regression #5700
FIX: SimpleSQLGrammar quote parsing regression #5700
Conversation
…onlyle88/liquibase into jasonlyle88-fix-quote-parsing-regression
Hey @MalloD12 ! Thanks for picking this up for review. I think this is all set, let me know if you need anything. I think this is a pretty big deal, so would love to try to get this in for the next release if possible! |
Hi @jasonlyle88, I started looking into this on Friday. I'm not a grammar expert, but your rule changes look good to me. Also, previous tests added in #5108 keep working as expected. For debugging the different rules for example, Thanks, |
I did use the Additionally, I added some output to the |
Made me second guess myself since I just did a manual checking of the output across tests for the token type and text for each token. Added my output code to my local master, compiled, captured and saved the output. Then switched to this branch, compiled, captured and saved the output. Did a diff of the two files and the results are identical (other than my branch had the additional tests). Attaching the files here in case anyone wants to see the results |
Hey @jasonlyle88, Nice, I liked that manual testing check. I didn't get how you generated those output files. Could you please detail those steps you mentioned for me? That could be very useful for me when having to review any other grammar issue next time. Other than that, this PR looks good to me. I just made a formatting change to the test class and added two of the scenarios you listed in the description of #5674, I think they are already covered by the ones you already added but like of those random mixed symbols 😄. |
Awesome, sounds good! Thanks. As for how I generated them: I'm using IntilliJ Idea. When I have the I'm sure you can do this when running the test through the CLI as well... but I don't know how to run individual tests via the CLI (letting my Java noob show through here 🤣). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the fix @jasonlyle88 !
No problem, always happy to contribute! |
Thanks @jasonlyle88! I thought you had a trick to run these tests and grab the output from all of them automatically. |
Thanks everyone for the quick work here! Appreciate it! |
Impact
Description
Fixes #5674
PR #5108 made a modification to the grammar used to parse strings. It expanded functionality for string identification with escaped quotes and characters.
However, it broke identification of other strings. This PR aims to correct that.
The issue was that non-escape characters that followed a
\
character would pre-maturely end the token regex looking for character literals. I fixed this by not looking for specific escape sequences but allowing for any character to follow a\
character without issue.I have also updated the associated test file to add more test cases. All existing test cases pass un-modified while the new test cases pass with these new modifications.
Things to be aware of
Things to worry about
Additional Context
The changes to the identifier tokens (
S_IDENTIFIER
,SPECIAL_CHARS
, etc) are functionally equivalent to what they were before. However, in the process of debugging the grammar, I was unsure where to start and started from the top down. The identifier grammar was a little unclear, so the changes are just to make the grammar more explicit in this area.