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

Fixing reserve word NULL for cpp targets #3889

Merged
merged 21 commits into from
Oct 13, 2022

Conversation

1sand0s
Copy link
Contributor

@1sand0s 1sand0s commented Sep 15, 2022

PR Summary

  1. The ANTLR grammar for Cypher contains a Token named NULL which is a reserve word in Cpp. This PR adds NULL to the list of reserve words in CppTarget.java.
  2. I passed the String arguments of getTargetStringLiteralFromString and getTargetStringLiteralFromANTLRStringLiteral in Target.java, s and literal respectively, to Target's escapeIfNeeded function since potential reserve words must be handled before being accumulated into the StringBuilders
  3. I passed the Key of g.tokenNameToTypeMap in Recognizer to Target's escapeIfNeeded function before being inserted into tokens in Recognizer

Best

Signed-off-by: 1sand0s <1sand0sardpi@gmail.com>
@1sand0s 1sand0s changed the title Fixing reserve word null for cpp targets Fixing reserve word NULL for cpp targets Sep 15, 2022
Copy link
Member

@KvanTTT KvanTTT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add new or extend the existing test ReservedWordsEscaping.txt that covers suggested changes.

tool/src/org/antlr/v4/codegen/Target.java Outdated Show resolved Hide resolved
@1sand0s 1sand0s force-pushed the Fixing_Reserve_Word_NULL_for_Cpp_Targets branch 2 times, most recently from bf5e884 to b20db8c Compare September 23, 2022 07:44
Jim.Idle and others added 13 commits September 23, 2022 16:32
I had not though about this, but I guess some of the fix PRs did not have one fix
that was in the legacy version of the runtime, copied in to the v4 branch. This
commit fixes that.

Signed-off-by: Jim.Idle <jimi@gatherstars.com>
Signed-off-by: 1sand0s <1sand0sardpi@gmail.com>
Signed-off-by: Terence Parr <parrt@antlr.org>
Signed-off-by: 1sand0s <1sand0sardpi@gmail.com>
Signed-off-by: Terence Parr <parrt@antlr.org>
Signed-off-by: 1sand0s <1sand0sardpi@gmail.com>
Signed-off-by: Terence Parr <parrt@antlr.org>
Signed-off-by: 1sand0s <1sand0sardpi@gmail.com>
Signed-off-by: 1sand0s <1sand0sardpi@gmail.com>
Signed-off-by: Terence Parr <parrt@antlr.org>
Signed-off-by: 1sand0s <1sand0sardpi@gmail.com>
Signed-off-by: 1sand0s <1sand0sardpi@gmail.com>
Signed-off-by: 1sand0s <1sand0sardpi@gmail.com>
Signed-off-by: 1sand0s <1sand0sardpi@gmail.com>
Signed-off-by: 1sand0s <1sand0sardpi@gmail.com>
Signed-off-by: 1sand0s <1sand0sardpi@gmail.com>
Signed-off-by: 1sand0s <1sand0sardpi@gmail.com>
Signed-off-by: 1sand0s <1sand0sardpi@gmail.com>
@1sand0s 1sand0s force-pushed the Fixing_Reserve_Word_NULL_for_Cpp_Targets branch from 515dc16 to d26c064 Compare September 23, 2022 21:35
@KvanTTT
Copy link
Member

KvanTTT commented Sep 24, 2022

Could you please get rid of unrelated commits (using interactive rebase)? Some changes are unrelated to the topic.

1sand0s and others added 7 commits September 26, 2022 11:14
Signed-off-by: 1sand0s <1sand0sardpi@gmail.com>
Signed-off-by: 1sand0s <1sand0sardpi@gmail.com>
Signed-off-by: 1sand0s <1sand0sardpi@gmail.com>
Signed-off-by: 1sand0s <1sand0sardpi@gmail.com>
Signed-off-by: 1sand0s <1sand0sardpi@gmail.com>
Signed-off-by: 1sand0s <1sand0sardpi@gmail.com>
@1sand0s
Copy link
Contributor Author

1sand0s commented Sep 26, 2022

Could you please get rid of unrelated commits (using interactive rebase)? Some changes are unrelated to the topic.

@KvanTTT Done !

@1sand0s
Copy link
Contributor Author

1sand0s commented Oct 1, 2022

Could you please get rid of unrelated commits (using interactive rebase)? Some changes are unrelated to the topic.

@KvanTTT Just a reminder that I have removed unrelated commits.

Thanks !

@KvanTTT
Copy link
Member

KvanTTT commented Oct 4, 2022

I see unrelated commits anyway. @parrt the changes look good to me, but I suggest squashing all commits since most of them are useless.

@parrt
Copy link
Member

parrt commented Oct 9, 2022

Looks like we have a merge conflict. Can you take a look / rebase?

@1sand0s
Copy link
Contributor Author

1sand0s commented Oct 10, 2022

Looks like we have a merge conflict. Can you take a look / rebase?

@parrt I compared the antlr4/dev branch with 1sand0s/antlr4/Fixing_Reserve_Word_NULL_for_Cpp_Targets branch and did not find merge conflicts on my end.

@parrt parrt merged commit d685f7b into antlr:dev Oct 13, 2022
@parrt
Copy link
Member

parrt commented Oct 13, 2022

AH. it was set at rebase not merge. A merge will work. thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants