diff --git a/src/qutip_qip/qasm.py b/src/qutip_qip/qasm.py index 456133c4..a985f6a6 100644 --- a/src/qutip_qip/qasm.py +++ b/src/qutip_qip/qasm.py @@ -886,7 +886,15 @@ def read_qasm(qasm_input, mode="qiskit", version="2.0", strmode=False): # split input into lines and ignore comments qasm_lines = [line.strip() for line in qasm_lines] qasm_lines = list(filter(lambda x: x[:2] != "//" and x != "", qasm_lines)) - + # QASMBench Benchmark Suite has lines that have comments after instructions. + # Not sure if QASM standard allows this. + for i in range(len(qasm_lines)): + qasm_line = qasm_lines[i] + loc_comment = qasm_line.find("//") + if loc_comment >= 0: + qasm_line = qasm_line[0:loc_comment] + qasm_lines[i] = qasm_line + if version != "2.0": raise NotImplementedError( "QASM: Only OpenQASM 2.0 \