utf8_string/2 and ascii_string/2 should support min: 0
tmbb opened this issue · comments
tmbb commented
Motivation: say I want to parse a line which might be empty.
Currently, I have to do this:
line = choice([utf8_string([not: ?\n], min: 1), string("")]) |> ignore(string("\n"))
I'd like to be able to write:
line = utf8_string([not: ?\n], min: 0) |> ignore(string("\n"))
I propose defining utf8(chars, min: 0)
as equivalent to choice([utf8_string([not: ?\n], min: 1), string("")])
. Although implemented in a more efficient way if possible.