-
Notifications
You must be signed in to change notification settings - Fork 9
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: mangle OpenQASM keywords #28
Merged
rmshaffer
merged 8 commits into
amazon-braket:main
from
atharva-satpute:mangle-openqasm-reserved-words
Jun 13, 2024
Merged
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
54ff709
Fix: Append '_' to the variable names that are reserved keywords
atharva-satpute 3d477b0
Add test to verify name mangling works for reserved keywords
atharva-satpute 19084a9
Change return type to tuple
atharva-satpute 7cdc39d
Change function signature to return new name
atharva-satpute beb4801
Separate keywords using comments
atharva-satpute 83dfd3c
Merge branch 'main' into mangle-openqasm-reserved-words
jcjaskula-aws 58dadab
Merge branch 'main' into mangle-openqasm-reserved-words
rmshaffer cd088a6
turn into single-liner
jcjaskula-aws File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Do you have a reference/link to the source of this list?
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.
https://openqasm.com/grammar/index.html
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.
Could you please include a permalink reference as a comment in the code here? Perhaps you can use this URL: https://github.com/openqasm/openqasm/blob/909379e450f5e1b6cdd67b8a96683caca7b13e4d/source/grammar/qasm3Lexer.g4
Also, it would be ideal to move this list (and the function
is_reserved_keyword
) to a separate file (e.g. reserved_keywords.py) and then just import the functionis_reserved_keyword
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, I think in long term, it would be better that this list is not hard-coded. Rather, the list depends on the qasm3lexer from the lexer file. But I think it does not necessary need to be implement in this PR. Could you add the reference link as an inline comment?
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.
Yes, initially, I had done it that way.