cda-tum / mqt-core

MQT Core - The Backbone of the Munich Quantum Toolkit
https://mqt.readthedocs.io/projects/core
MIT License
62 stars 31 forks source link

🩹 fix endless loop on unsupported operations in OpenQASM gate declarations #700

Closed burgholzer closed 2 months ago

burgholzer commented 2 months ago

Description

This PR fixes an endless loop in the OpenQASM parser upon encountering unexpected statements in gate declarations. WIth this PR, the parser actually errors out with an appropriate error message instead of looping forever.

Checklist:

codecov[bot] commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 92.1%. Comparing base (698af02) to head (b8fd529). Report is 1 commits behind head on main.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/cda-tum/mqt-core/pull/700/graphs/tree.svg?width=650&height=150&src=pr&token=MqstsRKdqp&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cda-tum)](https://app.codecov.io/gh/cda-tum/mqt-core/pull/700?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cda-tum) ```diff @@ Coverage Diff @@ ## main #700 +/- ## ======================================= - Coverage 92.1% 92.1% -0.1% ======================================= Files 125 125 Lines 13759 13757 -2 Branches 2151 2150 -1 ======================================= - Hits 12673 12671 -2 Misses 1086 1086 ``` | [Flag](https://app.codecov.io/gh/cda-tum/mqt-core/pull/700/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cda-tum) | Coverage Δ | | |---|---|---| | [cpp](https://app.codecov.io/gh/cda-tum/mqt-core/pull/700/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cda-tum) | `91.8% <100.0%> (-0.1%)` | :arrow_down: | | [python](https://app.codecov.io/gh/cda-tum/mqt-core/pull/700/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cda-tum) | `99.7% <ø> (ø)` | | | [Files with missing lines](https://app.codecov.io/gh/cda-tum/mqt-core/pull/700?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cda-tum) | Coverage Δ | | |---|---|---| | [src/ir/parsers/qasm3\_parser/Parser.cpp](https://app.codecov.io/gh/cda-tum/mqt-core/pull/700?src=pr&el=tree&filepath=src%2Fir%2Fparsers%2Fqasm3_parser%2FParser.cpp&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cda-tum#diff-c3JjL2lyL3BhcnNlcnMvcWFzbTNfcGFyc2VyL1BhcnNlci5jcHA=) | `92.6% <100.0%> (-0.1%)` | :arrow_down: |