I am using Nom 5.0 to parse some text data. I am trying to use the streaming
functions in order to have the possibility of parsing big input data.
I am getting some troubles mixing the concept of optional field and optional line ending for the first line. Imagine something like this:
A,B,C
A,B
C,D
Is it possible to have two or three fields for each line, and the last line does not need a newline. When using the streaming
functions, I get an Err::Incomplete
when I reach D
because I am using something like opt(tuple((streaming::tag(','), field)))
to optionally get the third field.
I could use the complete version, but AFAIK I would get a parsing error if my buffer just ended in that position and my stream would contain more data.
I thought that nom::combinator::complete
could help me, but I am not able to make it work (it looks like it only works on the parsed being passed, not the inner sub-parsers. Am I wrong?).
Any hint?