Implicit Capture In PARSE - How To Get It?

ISO-8601 dates are very close to Rebol dates, but just different enough to make it a pain.

; ISO-8601
2021-09-15T12:20:53-04:00

; Rebol
15-Sep-2021/12:20:53-04:00

Are Rebol dates more readable? Yes. Are they so much better as to make it worthwhile to buck the standard? :man_shrugging: Are they in conflict with generalized PATH! representation? :man_shrugging:

Nevermind, This Post Is About Something Else

Let's say I just want to capture the YEAR, the MONTH, and the DAY out of an ISO-8601 date.

uparse isodate [
    year: between <here> "-"
    month: between <here> "-"
    day: between <here> "T"
    ...
 ]

Despite having BETWEEN, it's laborious. (Historical Rebol needs copy to "-" followed by a SKIP, even more convoluted).

It needs a shorthand. We have TAG! at our disposal, still:

uparse isodate [year: <*> "-" month: <*> "-" day: <*> "T" ...]

And it could be plain *:

uparse isodate [year: *, "-", month: *, "-", day: *, "T", ...]

But I kind of find myself wishing for another lexical type that means "capture". I'd thought about this as being the meaning of @xxx before the current interpretation.

I'm nearly certain we'll have $word, $[bl o ck], $(gr o up) and friends. Maybe that?

uparse isodate [$year "-" $month "-" $day "T" ...]

Though since the general meaning would be "get-environment-variable" this would raise questions about dialects bending the meaning of things so severely.

It Feels Weak To Not Have An Answer For This

Other parsing systems will always seem like they have an edge if there isn't a shorthand for this "capture until the next rule".

2 Likes