Closed woile closed 3 months ago
For the tutorial,
parse
in. We need to be using parse_next
as part of teaching what the parser is doing. Understanding it is incremental is an important concept.As far as the Color
example, I get where you are coming from but it is also important to idiomatic code and that is how it would be written in an idiomtic way.
Maybe for the tutorial, in chapter 1, it could be a small mention right after the example.
Do not confuse
parse_next
withparse
, the latter is used as the entry point for the top level parse, whileparse_next
is used when parsers call other parsers
What do you think?
As far as the Color example, I get where you are coming from but it is also important to idiomatic code and that is how it would be written in an idiomtic way.
I think the example you see the moment you go to https://docs.rs/winnow/latest/winnow/ can be a bit hard for beginners. But I agree with your point.
Feel free to close the issue if it doesn't apply, I think my main wish would be to see the parse
highlighted somewhere early on
What are your thoughts on #536?
That looks much better! Thanks šš»
On Tue, 4 Jun 2024, 19:59 Ed Page, @.***> wrote:
What are your thoughts on #536 https://github.com/winnow-rs/winnow/pull/536?
ā Reply to this email directly, view it on GitHub https://github.com/winnow-rs/winnow/issues/529#issuecomment-2148204356, or unsubscribe https://github.com/notifications/unsubscribe-auth/AATXJWDDZ7VWJF5O676JTMTZFYFBBAVCNFSM6AAAAABIQLHR5SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNBYGIYDIMZVGY . You are receiving this because you authored the thread.Message ID: @.***>
Please complete the following tasks
winnow version
1.65
Describe your use case
The docs don't make enough use of
parse
till Tutorial 7. I think introducing earlier would help people close the gap between the initial parser and the finished app.On top of that, it makes
winnow
"less scary", because the&mut str
is only required while parsing, you can still use your&str
with it, which doesn't have to be mutable (does it make sense?)The way I usually approach it, is to write a simple parser and then I want to see it working.
Describe the solution you'd like
I propose adding
parse
earlier on. On:parse_next
, but at that point I think it should be used the user facingparse
, or at least mention it)libs.rs
I think it should be changed, theparse
inside theColor::from_str
IMO is a very important point, but it's a bit lost. And it's not used oncss/main.rs
as far as I can see, I propose keeping it as simple as possible.Something like this, would highlight the most important parts of the parser:
Thoughts? I don't mind sending some PRs
Alternatives, if applicable
No response
Additional Context
No response