[REBOL] Re: Strange parsing behavior
From: g:santilli:tiscalinet:it at: 3-Aug-2002 17:03
Hi Robert,
On Saturday, August 3, 2002, 1:04:43 PM, you wrote:
RMM> Ok, ok but I still find it a bit strange. In your example to "a" can be
RMM> deleted and the result won't change.
Exactly, but simply because my example did nothing useful at all.
:-)
RMM> I would expect the resulting string
RMM> to grow while parsing is done:
Instead, the COPY is applied *after* the next element of the rule
has been processed, and only if it succeeds. As Brett pointed out,
you can think of it as:
word: copy/part index-of-series-before-processing-next-element
index-of-series-after-processing-next-element
RMM> You have to solve the problem to trigger on " - " or 'newline whichever
RMM> comes first ;-). Robert
Is this a challenge? ;^)
>> Text: "this-is-a test of some parsing^/this-is-a - test of some parsing"
== {this-is-a test of some parsing
this-is-a - test of some parsing}
>> result: []
== []
>> rule: [some [copy string sentence (append result string) separator]]
== [some [copy string sentence (append result string) separator]]
>> sentence: [some [some sentence-chars [tmp: separator :tmp break | some #" " | end]]]
== [some [some sentence-chars [tmp: separator :tmp break | some #" " | end]]]
>> separator: [" - " | #"^/"]
== [" - " | #"^/"]
>> sentence-chars: complement charset " ^/"
== make bitset! #{
FFFBFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
}
>> parse/all text rule
== false
>> result
== ["this-is-a test of some parsing" "this-is-a" "test of some parsing"]
What's the prize? :-9
Regards,
Gabriele.
--
Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer
Amigan -- AGI L'Aquila -- REB: http://web.tiscali.it/rebol/index.r