Six years later we can now do this with LET.
LET is a UPARSE "keyword" (where UPARSE is the parser-combinator based variant of the PARSE dialect). It was able to be implemented due to a new model of binding which is based on compounding environments, instead of depending on "waves" of mutable binding.
There are some shuffles you have to do (when not using the PARSE2 emulation set of parser combinators)... anyway, here's the equivalent:
function-rule: [
subparse group! [
let code: word!
optional some [integer! | function-rule]
(probe code)
]
]
>> parse x: copy/deep [(-hi-there- 1 2 3 (hello 2 3 4))] function-rule
hello
-hi-there-
== -hi-there-
Adjustments are:
-
INTO (arity 1, rule inside) => SUBPARSE (arity 2, rule to match then rule inside)
-
Rules generate products, SET-WORD! for assignments (vs. SET)
-
ANY has a new meaning for meaning "any of the rules in the following block", so use OPTIONAL SOME (equivalent to OPT SOME) instead when you mean "any number including zero"
-
GROUP! is the name for the PAREN! type in Ren-C
I think it's not insignificant that old problems become solvable with new methods--it's worth pointing out. Also I've added this case to the PARSE LET tests.