You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ClosesQiskit#226
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.
jlapeyre
added a commit
to jlapeyre/openqasm3_parser
that referenced
this issue
Oct 29, 2024
ClosesQiskit#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.
From the spec for hex and binary literals, using
x
|X
andb
|B
should be allowed. The values are lexed without error, but aren't handled correctly.Here you can see the result of parsing
int x = 0xFa_1F;
andint x = 0XFa_1F;
into anasg::Program
And the result of parsing
int x = 0b1010_1100;
andint x = 0B1010_1100;
into anasg::Program
In both cases the
IntLiteral
value is 0 instead of the correct value when the base specifier is a capital.The text was updated successfully, but these errors were encountered: