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

🐛 properly handle timing literals in QASM parser #724

Merged
merged 4 commits into from
Oct 11, 2024
Merged

Conversation

burgholzer
Copy link
Member

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:

  • The pull request only contains commits that are related to it.
  • I have added appropriate tests and documentation.
  • I have made sure that all CI jobs on GitHub pass.
  • The pull request introduces no new warnings and follows the project's style guidelines.

@burgholzer burgholzer self-assigned this Oct 11, 2024
@burgholzer burgholzer added fix Fix for something that isn't working Core Anything related to the Core library and IR c++ Anything related to C++ code labels Oct 11, 2024
Copy link

codecov bot commented Oct 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.2%. Comparing base (11a7d49) to head (896257d).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##            main    #724     +/-   ##
=======================================
+ Coverage   92.1%   92.2%   +0.1%     
=======================================
  Files        125     125             
  Lines      13757   13739     -18     
  Branches    2150    2158      +8     
=======================================
+ Hits       12671   12678      +7     
+ Misses      1086    1061     -25     
Flag Coverage Δ
cpp 92.0% <100.0%> (+0.1%) ⬆️
python 99.7% <100.0%> (+<0.1%) ⬆️
Files with missing lines Coverage Δ
...clude/mqt-core/ir/parsers/qasm3_parser/Scanner.hpp 71.4% <ø> (ø)
include/mqt-core/ir/parsers/qasm3_parser/Token.hpp 98.2% <100.0%> (-0.1%) ⬇️
src/ir/parsers/qasm3_parser/Parser.cpp 92.6% <100.0%> (-0.1%) ⬇️
src/ir/parsers/qasm3_parser/Scanner.cpp 97.0% <100.0%> (+0.1%) ⬆️
src/mqt/core/__init__.py 100.0% <100.0%> (ø)

... and 16 files with indirect coverage changes

@burgholzer burgholzer enabled auto-merge (squash) October 11, 2024 14:52
@burgholzer burgholzer merged commit 008ad6a into main Oct 11, 2024
28 checks passed
@burgholzer burgholzer deleted the timing-literals branch October 11, 2024 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ Anything related to C++ code Core Anything related to the Core library and IR fix Fix for something that isn't working
Projects
Status: Done
Status: Done
Development

Successfully merging this pull request may close these issues.

🐛 Error parsing ms gate in OpenQASM with mqt-core.
1 participant