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

Support prefixes 0X, 0O, 0B for hex, octal, binary literals #232

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jlapeyre
Copy link
Collaborator

Closes #226

Previously, literals with prefix 0x were parsed and analyzed correctly. But literals
with prefix 0X were analyzed as value 0. This is now fixed. Prefixes 0B and 0O
were broken in the same way and are now fixed.

This fix also uncovers a bug that will be opened and fixed separately: Illegal (nonsense)
integer literals, with prefixes such as 0Q will be analyzed as valid, decimal,
literals. They should instead cause an error to be logged. A lex-, or possibly parse,
error.

Closes Qiskit#226

Previously, literals with prefix `0x` were parsed and analyzed correctly. But literals
with prefix `0X` were analyzed as value `0`. This is now fixed. Prefixes `0B` and `0O`
were broken in the same way and are now fixed.

This fix also uncovers a bug that will be opened and fixed separately: Illegal (nonsense)
integer literals, with prefixes such as 0Q will be analyzed as valid, decimal,
literals. Instead they should cause an error to be logged. A lex, or possibly parse,
error.
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.

Hex and binary literals with capital base specifiers aren't parsed correctly
1 participant