Hello [EMAIL PROTECTED]!

On 06-Gen-00, you wrote:

[...]
 o> How about this:

 o>>> a: [skip a | "ing"]    
 o> == [skip a | "ing"]
 o>>> parse "ringin" a   
 o> == false
 o>>> parse "ringing" a
 o> == true

 o> It should do the job. So actually backtracking in Parse can be
 o> achieved by use of the "|" operator in Parse blocks.

 o>> But if you want to search for a pattern in text, such as {a
 o>> word begining with "t" and ending with "gh"},

 o>>> a: ["t" b]
 o> == ["t" b]
 o>>> b: [skip b | "gh"]
 o> == [skip b | "gh"]
 o>>> parse "tough" a
 o> == true
 o>>> parse "tougher" a
 o> == false

 o> Or have I misunderstood you?

I hope you'll not mind if I jump in here. You are correct, but the
current implementation of PARSE is very weak about recursion. Your
solution will fail as soon as the string is longer than something
like 300 characters (IIRC). Indeed, you may have noticed that I
always tried to avoid recursive rules in my previous posts ---
they're simple and concise, but they're not reliable with the
current implementation of PARSE.

Regards,
    Gabriele.
-- 
o--------------------) .-^-. (----------------------------------o
| Gabriele Santilli / /_/_\_\ \ Amiga Group Italia --- L'Aquila |
| GIESSE on IRC     \ \-\_/-/ /  http://www.amyresource.it/AGI/ |
o--------------------) `-v-' (----------------------------------o

Reply via email to