Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: Re(2): 'parse trick and 'unset

From: chaz:innocent at: 17-Dec-2000 15:32

At 03:34 AM 12/17/00 +1100, you wrote:
>Change 'id, so that the full code is: > >line1: "Ju<li>e<><><<1234>" >line2: "Jules<1234>ffg<5678>" >digits: charset "0123456789" >id: ["<" 3 4 digits ">"] >rule: [a: some [id | [skip b:]] (print copy/part a b)] >parse line1 rule >parse line2 rule > >Why? Because in 'line2 we instantly found 2 id's and >got to the end in two steps. That's because id >began with [thru ">" ...], which means "jump through >all input until after the first ">". >This happens twice and we're finished already. >Remove the 'thru, and 'id is defined more precisely.
Your new code makes it possible to capture what is being parsed! Thanks. block: copy [] line2: "Jules<1234>ffg<5678>" digits: charset "0123456789" id: ["<" 3 4 digits ">"] rule: [a: some [c: id d: (append block copy/part c d)| [skip b:]] (print copy/part a b)] parse line2 rule print block