parcon icon indicating copy to clipboard operation
parcon copied to clipboard

Introduce NonConsumingExact which doesn't consume whitespace at the beginning of the string

Open dsalisbury opened this issue 10 years ago • 0 comments

parcon.Exact doesn't play nicely out-of-the-box when trying to match whitespace at the start of a string. I've added some tests for the existing behaviour, including using thing.parse_string(s, whitespace=parcon.Invalid()), but I also wanted something which didn't require explicitly passing in the whitespace argument, hence creating parcon.NonConsumingExact. The only difference is that it doesn't bother to do space.consume(...) (which parcon.Exact.parse does do).

Also, naming things is hard; I don't really like this name, but it's 11pm and I couldn't come up with anything better.

dsalisbury avatar Oct 20 '15 22:10 dsalisbury