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 "input shrunk" bug #168

Merged
merged 2 commits into from
Mar 27, 2020
Merged

Fix "input shrunk" bug #168

merged 2 commits into from
Mar 27, 2020

Conversation

seliopou
Copy link
Member

When the parser has been fed input but has not hit a commit point so the entire buffer can be consumed, a subsequent report_exn call will result in the parser raising with the message "input shrunk".

The fix is to not feed any input to the parser when it is force-closed, but instead make the next call to next report close. This will give the caller the opportunity to feed the parser the final bytes available (or to not) before everything shuts down.

When the parser has been fed input but has not hit a commit point so the
entire buffer can be consumed, a subseqent report_exn call will result
in the parser raising with the message "input shrunk".

This is a requirement of angstrom. After it sees some input, you can't
take it away.

Fixed in a subsequent commt.
When the parser is forced-closed, make the next call to `next` report
close. This will give the caller the opportunity to feed the parser the
final bytes available (or to not) before everything shuts down.
@seliopou seliopou merged commit 1144ec4 into master Mar 27, 2020
@seliopou seliopou deleted the input-shrunk-on-exn branch March 27, 2020 16:49
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.

1 participant