This PR fixes a bug in the QASM parser that would treat timing literal suffixes as individual tokens, which can lead to strange errors with gate declarations whose name matches a timing literal suffix, e.g., ms.
Timing literals are now properly treated and do not lead to clashes.
In the process, it was noticed that the Python import of long QASM strings would fail due to pathlib throwing an OSError for too long paths.
This is now fixed by short circuiting if the path is too long.
Fixes #723
Checklist:
[x] The pull request only contains commits that are related to it.
[x] I have added appropriate tests and documentation.
[x] I have made sure that all CI jobs on GitHub pass.
[x] The pull request introduces no new warnings and follows the project's style guidelines.
Description
This PR fixes a bug in the QASM parser that would treat timing literal suffixes as individual tokens, which can lead to strange errors with gate declarations whose name matches a timing literal suffix, e.g.,
ms
. Timing literals are now properly treated and do not lead to clashes.In the process, it was noticed that the Python import of long QASM strings would fail due to pathlib throwing an
OSError
for too long paths. This is now fixed by short circuiting if the path is too long.Fixes #723
Checklist: