Howdy,

I've been having trouble with strange results in the parser. Rebol seems to
cache the parse rules, which seems like a good idea, but I've found
something unexpected.

If you copy the code below and paste it (Win or call script in Linux) into
your Rebol session you can see how the three calls to parse will change
results even though it is the same rule and data.

If in the same session you repeat the process  you will get the same results
again - that is, the first line is right again!

Have I done something wrong?

BTW, Wouldn't it be nice if there was a parse /explain that would show the
"plan" or description of the state machine that will be used for parsing, or
whatever is used. I'm always getting confused on the parse syntax. Having
this would make it easier for me anyway!

Appears in
   REBOL/View 0.9.9.3.1 1-Jun-2000
   REBOL/Core 2.3.0.3.1
   on Windows NT 4 SP 4

Brett Handley

    ; Here starts the code

    only-string: func[ s [any-string! none!] ][ either s [s][{}]]

    quoted-data-rule: [
       (cell-data: {} Print "Setting the cell-data value") ; This seems to
get ignored on subsequent calls of parse.
       {"} copy data to {"} {"} (append cell-data only-string data)
       any [
           {"} copy data to {"} {"} (append cell-data rejoin [{"}
only-string data])
       ]
    ]
    parse/all {"""."} quoted-data-rule  ; This looks ok.
    print cell-data                         ;

    parse/all {"""Hrmm."} quoted-data-rule  ; This is not right.
    print cell-data                         ;

    parse/all {"""oi!"} quoted-data-rule  ; Bugger.
    print cell-data                         ;


Reply via email to