[REBOL] Re: Strange parsing behavior
From: g:santilli:tiscalinet:it at: 3-Aug-2002 11:01
Hi Robert,
On Saturday, August 3, 2002, 8:39:15 AM, you wrote:
RMM> Well, this dependes how you expect parse to work. The rule
RMM> [to " - " (?? string1) | to newline] is a choice and Rebol parse uses a
Well, that is a sub-rule. The fact that it contains "choices" is
just incidental. What do you expect from:
>> parse "this is a test" [copy word [to "a" to end]]
== true
>> word
== "this is a test"
RMM> The question is what is the trigger for the copy: You say it's the end
RMM> of the rule block (lat trigger) and I would expect as soon as copying
It's the end of the sub-rule, since COPY copies what is matched by
the next element in the rule, that is the sub-rule in this case.
Place COPY *inside* the sub-rule if you want to get the result you
were expecting.
Regards,
Gabriele.
--
Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer
Amigan -- AGI L'Aquila -- REB: http://web.tiscali.it/rebol/index.r