Closed chrisdotcode closed 5 years ago
I am ultimately trying to create a parser that can parse number ranges surrounded by brackets in the form of:
{1-999}
{-999}
{1-}
{-}
But every time I try to create a more complex parser to parse any of the above, everytime I use .collect()
, the {
and }
symbols keep also returning themselves in the result, no matter if I use *
or -
, or even .discard()
.
This is not a bug, * and - discard the output values, while collect applies to input symbols. You may write
sym(b'{') * one_of(b"0123456789").repeat(1..).collect() - sym(b'}')
I see. Thank you! (Merry Christmas 🎄)
Hello,
In the following code:
I get the output:
As you can see, in the output, the leading
{
(ordinal 123) and the trailing}
(ordinal 125) are being returned as well, even though I am using the*
and-
combinators to try and ignore them.Is this a bug in the library, or am I just using it incorrectly?
Thank you for creating pom.
pom version 3.0.0 rust stable, 1.31.0 mac os