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

fix(parser): reset stream position for direct string input, close #35 #39

Merged
merged 1 commit into from
Jul 29, 2024

Conversation

Zhaoyilunnn
Copy link
Contributor

Hi Team,

The root cause of #35 is as follows

https://github.com/openqasm/qe-qasm/blob/main/lib/Parser/QasmParser.y#L338-L342

Here IIS and ISS points to the same buffer, as std::getline moves the pointer to the next line, we got the wrong line number when directly parsing string.

Thus we just need to reset the position of IIS to make QASM::QasmPreprocessor::Instance().Preprocess(IIS) work as expected

I did not find any test codes in this repo to directly test QasmParser.y. I'm willing to add some tests and wish to know the proper way to do so.

Thanks,
Yilun

@Zhaoyilunnn Zhaoyilunnn requested a review from a team as a code owner July 28, 2024 15:02
Copy link
Collaborator

@taalexander taalexander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is tricky to test with the current test suite. We'll test next time we pull an updated version into the qe-compiler.

@taalexander taalexander merged commit 654ea08 into openqasm:main Jul 29, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants