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 multi combinators to the new design #897

Closed
Geal opened this issue Apr 6, 2019 · 1 comment
Closed

port multi combinators to the new design #897

Geal opened this issue Apr 6, 2019 · 1 comment
Milestone

Comments

@Geal
Copy link
Collaborator

Geal commented Apr 6, 2019

the code is in src/multi/macros.rs. To rewrite:

  • count_fixed (is it even possible?)
  • length_count
  • length_data
  • length_value

Some functions should be rewritten to return a closure instead of applying on the data directly (code is in src/multi/mod.rs):

  • count
  • fold_many0
  • fold_many1
  • fold_many_m_n

Finally, most of those functions could be refactored, because their previous design using macros did not allow early returns from inside the loop. Since we can do that in a function, they should be easier to rewrite.

@Geal Geal added this to the 5.0 milestone Apr 6, 2019
@Geal Geal mentioned this issue Apr 6, 2019
22 tasks
@loewenheim
Copy link

Something I ran into with length_value and length_count: The natural type for the first parser to return is usize because its return value is used as a length or count, respectively. But the current macros allow any parser in the first position that returns a number. For length_value, I’ve simulated this with a trait bound for the first parser that makes it return Into<usize>, but for length_count, that doesn’t work: in at least one place, length_count! is invoked with a first parser that returns u32, which is not Into<usize>.

@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

2 participants