I'm trying to parse a QASM code. But when I use parser functions by this way:
from qiskit import qasm
_qasm = qasm.Qasm(filename="test.qasm")
print(_qasm.print_tokens())
the method print_tokens() (https://github.com/QISKit/qiskit-sdk-py/blob/master/qiskit/qasm/_qasmparser.py#L1050) does not return anything and the print() I used raises only None. Reviewing the code, the method print_tokens under _QasmParser_ (which is used within the method print_tokens() under the Qasm class https://github.com/QISKit/qiskit-sdk-py/blob/master/qiskit/qasm/_qasm.py#L42) class tries to print the tokens resulting, but it does not return that string with the results.
I think the solution is simple, the print_tokens() method under _QasmParser_ class should return the string with the tokens instead of trying to print() the string.
Possible related, the self.lexer.token() call in _qasmparser.py looks like returning None in every case.
Can I work on this issue?
PR #306 merged, so issue fixed!
Thanks @ysiraichi and @1ucian0 !!