So a while ago, I was thinking about the idea of a kind of GROUP! as a PARSE rule that would fail if it was NULL.
It's not a property you want for plain GROUP! in PARSE!!!
uparse "aaa" [some ["a" (if trace [print "Matched an A"])]]
You wouldn't want that IF not running to give a NULL that caused the rule to not match. That would mean you'd have to write:
uparse "aaa" [some ["a" opt (if trace [print "Matched an A"])]]
That's junky.
But let's imagine there were another kind of group that did fail when it was NULL. For the sake of argument let's call it /(group). Otherwise it's just like GROUP!...result discarded and everything.
When we had such a group on hand, I noticed we could do something like this:
gen: func [<static> n (0)] [
if n < 3 [return n: n + 1]
return null
]
>> uparse "a" ["a", collect [while keep /(gen)]]
== [1 2 3]
Since generators return NULL when they're done making values, you'd be able to use the natural looping ability of WHILE and then have it stop keeping things, and you'd get your values collected.
So I wrote a test for that...which broke when that behavior of the group class went away.
It's probably silly, since we'd be able to write something like (map :gen) and get the same effect. I'm just writing it down here because there was a comment about it, and I had sort of a "hmmm" about uses for a GROUP! form that considered itself a failed parse match if it was NULL.
Better here than in a comment.