-
Notifications
You must be signed in to change notification settings - Fork 808
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
nom 5.0 roadmap #903
Comments
One pain point I keep hitting with nom < 5 is the lacking docs for the macros list. A lot of the time, I just want to see a quick copypasta of how to apply a combinator. I think it'd be really useful to have most of the usage-level docs alongside the functions/macros themselves in the generated docs, with perhaps guide-level docs as separate documents so they can be longer and more in-depth. I don't know if this is already the plan, but that's my two pence 🙂 |
the macros are missing a lot of examples, I plan to add a lot more with this version |
FWIW, I wrote a PDF parser for lopdf using nom5 and found the experience quite pleasant. The resulting parser is very fast and maintainable. See https://github.com/J-F-Liu/lopdf/blob/master/src/nom_parser.rs |
Following up on what @jothan said, I also just wrote an s-expression parser for wasm contracts using nom5 and had a good experience too! The last version I had seriously used prior to this was version 2.2 and compared to that, the error messages have improved a ton, which was my biggest pain point. I found that actually using I didn't use any of nom's macros this time because they don't seem to work with the function parsers at all. The biggest issues I ran into were:
I think both of the above can be fixed purely through additional examples. Anyways, just stopping by to give some feedback and thank you all your work on this project over the years! It's been very useful for me multiple times and seems to be getting even better! |
it's good to see that nom 5 is easier to use than previous versions :) |
@Geal Thanks! That's exactly what I was looking for. Unfortunately, when I tried to use cut just now, I ran into issues with the |
Hey! ) I'm very new to nom and started with nom4 but after suggest in gitter I switched to nom5. Everything looks much better. I miss only two things: dbg! and ws! macro. I didn't find how to use it with functions. And thanks. You are doing great job. I spent not more that few hours to start writing productive code with nom. It's awesome. |
I also wrote a parser for regular expressions with nom 5 without any prior experience with parser combinators. IME functions seem way easier than macros. :) I didn't look into error handling though, mainly because it wasn't covered in docs. https://github.com/miedzinski/regex/blob/master/src/ast.rs |
now that I'm done with the experimental phase, it's time to plan the nom 5.0 release.
Here's the rough plan:
ParseError
trait. The calling site can decide which error type to use (there's a default one of(Input, ErrorKind)
). This fixes the issue of additive cargo features, and we'll get much better error handling if needed. See https://github.com/Geal/nom/blob/5.0/examples/json.rs for an exampleCompleteByteSlice
andCompleteStr
, since those types are hard to manipulate and don't fully solve the issuerecognize_float
and then callingparse::<f64>()
on itI've advanced a lot on the first two points, but it's still going to be a lot of work, so I'm adding issues with small tasks that could be contributed:
FnMut
? #898: should combinators return aFnMut
ParseError
doc/
) are obsolete, they refer to older versions of nom. Also we might have better ways to write most of those now. The new documentation should also show the different patterns: macros or functionsAnything else to add here?
The text was updated successfully, but these errors were encountered: