[REBOL] Re: Coffee break problem anyone?
From: greggirwin:mindspring at: 6-Nov-2003 6:44
Hi Gabriele,
>>>> parse [1 2 3][1 1 1 1 1 2 1 1 3]
...
GS> Yes, but actually I never had to do something like that, so I
GS> think it's not a big problem. Ladislav has proposed adding a
GS> LITERAL keyword to PARSE to handle such a situation.
Some kind of escape in parse rules might be nice. I haven't needed it
either but, if you're dealing with a small set of special numbers in a
particular situation, we can at least work around it. e.g.
make-int-rule: func [val][append copy [1 1] val]
make-int-rules: func [values [block!]][
foreach val values [
set to word! join '` val make-int-rule val
]
]
make-int-rules [2 27 94]
; I chose ` so it looks sort of like a lit-number! format. :)
print parse [2 27 94] [`2 `27 `94]
-- Gregg