winnow-rs / winnow

Making parsing a breeze
https://docs.rs/winnow
Other
525 stars 40 forks source link

Can weights be assigned to the combinators within alt #445

Closed baoyachi closed 7 months ago

baoyachi commented 8 months ago

Please complete the following tasks

winnow version

0.5.34

Describe your use case

"alt((A, B, C))" signifies that one of multiple combinators will be matched. Can weights be assigned to the combinators within alt so that those with higher hit rates are prioritized for parsing, rather than always parsing them in sequential order?

Describe the solution you'd like

no

Alternatives, if applicable

No response

Additional Context

No response

epage commented 8 months ago

Could you describe the use case for why an explicit weight would be use rather than the implicit one based on the ordering?

epage commented 7 months ago

Without extra context, I'm going to go ahead and close this. If there is a reason for us to re-evaluate, let us know!