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

port branch combinators to the new design #894

Closed
Geal opened this issue Apr 6, 2019 · 4 comments
Closed

port branch combinators to the new design #894

Geal opened this issue Apr 6, 2019 · 4 comments
Milestone

Comments

@Geal
Copy link
Collaborator

Geal commented Apr 6, 2019

I got started on a function version of alt in src/branch/mod.rs. The combinators to rewrite are in src/branch/macros.rs. To rewrite:

  • alt
  • alt_complete (maybe remove this one?)
  • switch
  • permutation: that's a big one, but it might be easier to rewrite as a function
@Geal Geal added this to the 5.0 milestone Apr 6, 2019
@Geal Geal mentioned this issue Apr 6, 2019
22 tasks
@Geal
Copy link
Collaborator Author

Geal commented Apr 13, 2019

alt is now reimplemented here: https://github.com/Geal/nom/blob/master/src/branch/mod.rs#L89-L93
it works by accepting a tuple of parsers as argument.
I'm not sure switch should really be reimplemented, since it can be written directly as a pattern match.
permutation will be tricky to do

@Geal
Copy link
Collaborator Author

Geal commented Apr 27, 2019

after some tests, it appears switch! can easily be replaced with a closure that does pattern matching before calling other parsers. permutation is still not done

@Geal
Copy link
Collaborator Author

Geal commented May 1, 2019

permutation was done in 66dec05

@Geal
Copy link
Collaborator Author

Geal commented May 25, 2019

alt, switch and permutation now have function equivalent, but their underlying implementation will not use them

@Geal Geal closed this as completed May 25, 2019
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

No branches or pull requests

1 participant