-
Notifications
You must be signed in to change notification settings - Fork 789
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
Allow using arrays as input to alt
#1556
Conversation
Now that min-const-generics is stabilized, it's possible to (backwards-compatibly) write a version of `alt` that uses a const array as input instead of being limited to only tuples - this allows us to lift the 21-element limitation on tuples passed to `alt`.
Hi, any update on this? I am running into a case where I have a grammar with 35 cases. Obviously this doesnt't work with current nom |
Now that min-const-generics is stabilized, it's possible to (backwards-compatibly) write a version of `alt` that uses a const array as input instead of being limited to only tuples - this allows us to lift the 21-element limitation on tuples passed to `alt`. Upstream: rust-bakery/nom#1556
Now that min-const-generics is stabilized, it's possible to (backwards-compatibly) write a version of `alt` that uses a const array as input instead of being limited to only tuples - this allows us to lift the 21-element limitation on tuples passed to `alt`. Upstream: rust-bakery/nom#1556
there were a few things missing to make the DX on this reasonable, mainly having most parsers return a concrete type instead of a closure, and having a |
great work @glittershark, thanks! |
match branch.parse(input.clone()) { | ||
for branch in &mut self.parser { | ||
match branch.process::<OM>(input.clone()) { | ||
//branch.parse(input.clone()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this have been committed?
for branch in &mut self.parser { | ||
match branch.process::<OM>(input.clone()) { | ||
//branch.parse(input.clone()) { | ||
Err(Err::Error(e)) => error = Some(e), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't or
ing the errors but only accepting the last one
good catch, fixed in 8c68e22 |
Now that min-const-generics is stabilized, it's possible to (backwards-compatibly) write a version of
alt
that uses a const array as input instead of being limited to only tuples - this allows us to lift the 21-element limitation on tuples passed toalt
.