Skip to content

AML: Fix DefIfElse parser returning UnexpectedEndOfStream when If (...) {} is not followed by anything #190

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

Merged

Conversation

alnyan
Copy link
Contributor

@alnyan alnyan commented Aug 25, 2023

The PR fixes issue #188

@@ -135,11 +143,11 @@ where
.map(move |then_branch| Ok((predicate_arg.as_bool()?, then_branch)))
})
.then(choice!(
Copy link
Member

Choose a reason for hiding this comment

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

This is fine as the fix to this, but I wonder if a cleaner solution would be to replace the whole choice!(..., id().map(&[]) construct with a wrapper combinator (e.g. maybe) that would catch either a WrongParser or an UnexpectedEndOfStream? I think that would work

@IsaacWoods
Copy link
Member

Interesting - now I see the problem, I'm kind of surprised we hadn't run into this sooner. Good catch though, and thanks for the PR!

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