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
It seems that numbers of the form 1e-5 (an integer followed by an "e" followed by a power) raise a bug in the parser. I think the parser is expecting another integer or a decimal point.
Numbers of the form 1.1e-10 seem to work fine
Minimum Example
from bqskit.ir import Circuit
from bqskit.ir.gates import U3Gate
c = Circuit(1)
c.append_gate(U3Gate(), (0,), [1e-4, 1e-10, 1e-8])
0
c_str = c.to("qasm")
c_str
'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg q[1];\nu3(0.0001, 1e-10, 1e-08) q[0];\n'
from bqskit.ir.lang.qasm2 import OPENQASM2Language
lang = OPENQASM2Language()
lang.decode(c_str)
Traceback (most recent call last):
File "/global/common/software/m4141/ensemble_env_2/lib/python3.10/site-packages/lark/lexer.py", line 665, in lex
yield lexer.next_token(lexer_state, parser_state)
File "/global/common/software/m4141/ensemble_env_2/lib/python3.10/site-packages/lark/lexer.py", line 598, in next_token
raise UnexpectedCharacters(lex_state.text, line_ctr.char_pos, line_ctr.line, line_ctr.column,
lark.exceptions.UnexpectedCharacters: No terminal matches 'e' in the current parser context, at line 4 col 13
u3(0.0001, 1e-10, 1e-08) q[0];
^
The text was updated successfully, but these errors were encountered:
It seems that numbers of the form 1e-5 (an integer followed by an "e" followed by a power) raise a bug in the parser. I think the parser is expecting another integer or a decimal point.
Numbers of the form 1.1e-10 seem to work fine
Minimum Example
Traceback (most recent call last):
File "/global/common/software/m4141/ensemble_env_2/lib/python3.10/site-packages/lark/lexer.py", line 665, in lex
yield lexer.next_token(lexer_state, parser_state)
File "/global/common/software/m4141/ensemble_env_2/lib/python3.10/site-packages/lark/lexer.py", line 598, in next_token
raise UnexpectedCharacters(lex_state.text, line_ctr.char_pos, line_ctr.line, line_ctr.column,
lark.exceptions.UnexpectedCharacters: No terminal matches 'e' in the current parser context, at line 4 col 13
u3(0.0001, 1e-10, 1e-08) q[0];
^
The text was updated successfully, but these errors were encountered: