Transitions have made some parse rules get longer:
[any whitespace] ; being repurposed--seems like "pick one" not a loop construct
=>
[while whitespace] ; being repurposed to arity-2; arity-1 form is unsettling
=>
[opt some whitespace] ; null if rule doesn't match, a little ugly
=>
[maybe some whitespace] ; void if rule doesn't match, longer but prettier
I like MAYBE and I've explained the reasons why I like pulling the optionality out from the looping construct.
But this seems a bit overlong...especially considering that whitespace is such a long word.
It occurs to me that "whitespace" can be itself plural. Might we say that ANY-SPACE is a character set, and then whitespace: [some any-space]
?
This at least gets you down to [maybe whitespace]
or [opt whitespace]
...which seems pretty minimal for the intent (unless you're going to go with abbreviations like ws*
or similar).
I really don't know how many cases there are where you are willing to tolerate only a single unit of an arbitrary whitespace character. When does that come up? Usually if you're matching a single whitespace character you know which one you're reacting to...and the only time you'd ever bundle up a collection of them together is when you're willing to skip a lot of it.
I doubt there'd be many uses of ANY-SPACE in a rule, and that it would just be used to compound other character collections.