[REBOL] Re: Problem with parsing ISO-8859-1 encoded text
From: rotenca::telvia::it at: 30-Sep-2003 23:38
Changing the string while it is parsed is not an easy programming style.
It is better to copy it in another location, it is almost always more fast.
But if one wants to do it, he must keep in mind these rules:
1) get the next location and pass it back to parse
2) use opt for paren expressions
Example:
parse "12" [h: "12" opt (h: change/part h "3" 2) :h] ;==true
instead, without opt:
parse "12" [h: "12" (h: change/part h "3" 2) :h] ;==false
There is at least one thread on this mailing list about this "feature".
The point is that also paren are matched against the string only to see if the
string is already at end, if the string is shorted by the paren rule, parse
has nothing to match with and the paren rule makes parse to fail.
---
Ciao
Romano