Hi,
I am playing with PetitParser (which looks super-cool!).
Following Lukas' blogpost [1], I defined my identifier as:
<snip>
identifier := #letter asParser , #word asParser star.
</snip>
then, I am using it to find the matches in a given string:
<snip>
identifier matchesIn: 'foo 123 bar12'.
</snip>
which returns:
<snip>
an OrderedCollection(
#($f #($o $o))
#($o #($o))
#($o #())
#($b #($a $r $1 $2))
#($a #($r $1 $2))
#($r #($1 $2))
)
</snip>
Even though the result is correct and makes much sense, would it
be possible to simply have the longest matches?
In that case I would expect something like:
<snip>
an OrderedCollection(
#($f #($o $o))
#($b #($a $r $1 $2))
)
</snip>
Thank you!
Cheers,
Alberto
[1]
http://www.lukas-renggli.ch/blog/petitparser-1