Hi,
I've recently built a small parser in Parslet, and for me the issue of
whitespace handling was a serious hurdle to getting it working exactly
as I wanted. So, I think Parslet should add some sort of feature here.
pyPEG offers a skipws option, which seems like a reasonable
compromise.
Parslet parsers are impacted negatively by whitespace in various ways.
Reading over the Parslet examples and the Capuchin parser, you can see
"space?" and "sp?" littered throughout the code. The number of places
where whitespace is not allowed are fairly rare, so the majority of
rules contain some mention of it. Even the JSON parser example has
frequent mentions of optional space, which you don't see in other
grammar formats.
I don't have a specific proposal. Perhaps optional skipping whitespace
like pyPEG does is best. However, it does seem like two operators
"join with any space" (maybe +?) and "join without space" (currently
>>) would make things easier, provided that str('a')+str('b').maybe
did not eat the whitespace if 'b' didn't match.
Thoughts?
-Greg