-
Notifications
You must be signed in to change notification settings - Fork 809
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
is there a "skip" or "drop", like "take"? #1223
Comments
Hello! any updates?) |
Since |
I created PR: https://github.com/Geal/nom/pull/1566/files |
I'm trying to learn rust, and for the project I decided on, I need a parser and decided on nom. I literally just started looking at this library 10 minutes ago, and I was looking for "skip". Since @ikrivosheev didn't provide a reasoning, I thought I'd provide mine. My experience comes from nimble_parsec which, being Elixir, uses chaining heavily. It's a small thing, but I was just after the same type of streamlined code. You can see they have an Again, in my case, it was just about removing the unnecessary extra My parse has a lot of places where it reads up to a pattern (like, a single character that can be ignored), skips the character, then keeps going. I can write my own function that does this, but first I thought there might be something built-in, which is how I saw this issue. (I'm not suggesting that what's idiomatic in Elixir would make sense or belongs in Rust. Obviously, I need to adapt to the Rust-way.) |
Except That said, I feel like a generic combinator is better than specialized versions of each function. |
Hi there,
Firstly, thank you so much for nom, it is a true pleasure to use. We use it regularly in production and it has been rock solid, and a real joy to develop with. Hopefully I will be able to open-source a parser we have written soon.
I have no issue to report, just a question:
I am wondering if there is a combinator that is similar to
take
, but drops/discards/skips the given number of bytes rather than returning them. Saying this another way, is there something like:that simply returns the input with a certain number of prefix bytes removed, as opposed to using
take
like so:I certainly can make a function that does this, I'm just curious if such a thing exists as a primitive in nom.
I have searched the documentation and the source and so far not been able to find anything, but I may have missed it. Thank you!
The text was updated successfully, but these errors were encountered: