for these parsers: alpha, digit, hex_digit, oct_digit, alphanumeric,
space and multispace:
- handle end of file correctly
- introduce *0 and *1 versions of these parsers. The basic one maps to
the *1 version (input must return at least one char
this is a breaking change in their behaviour:
- if they receive an empty input, they will return incomplete (if not at
eof)
- if they reach the end of input without the child parser returning an
error, they will return Incomplete
while this may break some parsers, this behaviour is more logical with
the rest of nom and much stricter
if we reached the end of input, test with at_eof, to see if we should
return the whole input slice or not.
This will potentially break some existing parsers that rely on many0
trying to consume everything, but this behaviour is more correct and
aligned with the rest of nom
- the combinators that do not expect a terminator (take_while, take_till) will return the whole input if input.at_eof() is true
- the combinators with the 1 suffix will return an error instead of an empty slice, even if we found the terminating tag
- combinators that expect a terminating tag but do not find it will return an error if input.at_eof() is true, incomplete if it is false
the irevous solution was wrong because we only required that the input
type implement From<u32> and forced a conversion in every combinator.
But if you reused a parser that already provides the custom input type,
there was no possible conversion.
It is now made possible with a more generic conversion and removing
forced conversions. Now only the most basic parsers will force an error
type, and combinators that have their own error code will use the
unify_types trick to make sure they provide the same error code as the
underlying parsers.
It might still cause some type inference issues, but the code of
reported issues (#534, #561, #617) seems to work. We'll see during the
testing period if more of those appear.