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
nom4: take_while broken ? #766
Comments
I think this is expected: https://github.com/Geal/nom/blob/master/doc/upgrading_to_nom_4.md#dealing-with-incomplete-usage Change your parser to require
|
It could work, except it creates an apocalypse of mismatched types in all calling functions and subparsers :( |
Also, how can I use `str::from_utf8' on the result ? map_res!(parse_name, str::from_utf8) fails on a map_res!(parse_name, |s| str::from_utf8(&s) also fails, with error Parsing slices has become really difficult :/ |
How about this?
Can you show what you are trying to parse? Maybe it's parsable without relying on eof, e.g. there might be a delimiter after the string or a length field before the string? |
My use case is to upgrade the The difficulty is that the text to parse comes from a binary parser, so using Thanks to your example, I wrote a version of the parsing functions that uses I'm not sure yet this is the best solution, but the tests now pass. |
I'm pretty sure I'm missing something, but would it be possible to change
NOTE: it does not incorporate the It seems to me that it's possible, but I know nothing about the ssh protocol. I did try the rewrite and the tests still pass, but it might break something. |
take_while! on &[u8] is unintuitive and creates breaking changes. Here's a more minimal use case:
Your documentation talks about &[u8] types everywhere, nor does anything really mention "CompleteByteSlice" in the basic guides. |
To me this was really annoying too. I had to use CompleteStr everywhere. Most cases where the parsers return Incomplete there is actually a partial result that could be used. Maybe it would be better to add a distinction between a partial results and actual incomplete input errors. In my opinion the user of the library should decide if the partial result is an error or not. |
fixed in nom 5 where |
Test case
Example test case:
The above test fails (regression from nom3):
The text was updated successfully, but these errors were encountered: