Howdy,


when using mark: (...) :mark

it only makes sense if you are changing 'mark in the paren section
otherwise the :mark can be ommited and the effect will be the same.


your any [to "button" ... to "text" ...]

is doing what you asked , not what you want
to "button" is skipping to the first button doing its thing  OK
then to "text"

skipping over the secong button because the rule is asking it to skip till
it finds "text" which it slso does OK  then it is back too the top of the
'any and since there ate no more "button" after the "text" it is done.

my guess is you want to wrap the to "button" ... rule  in its own 'any

but be careful as nested anys are awfully easy to please (infinite loops)


something like this will work as long as all your widget types are
clustered together

rule: [
        any[
        to "button" mark:
        (insert :mark reduce [btn button_count: button_count + 1":"{ }]
         mark: skip mark 16):mark
        ]
        any[
        to "text" mark:
        (insert :mark reduce [txt txt_count: txt_count + 1":"{ }]
         mark: skip mark 14) :mark
        ]
]

HTH


On Sun, 15 Feb 2004, iNetW3 wrote:

> Hey (smaller&smaller)List,
>
> x: {button "one" button "two"  text "browser"}
>
> x marked strings are changed when
> there found like this; {button one text "browser" button two}
>
> but not when found like this;
> {button one button two text "browser" }
>
> notice the repeat "button" strings one
> after another.
> {button one button two}
>
>
> code: -------------------------------------------
> x: {button "one" button "two"  text "browser"}
> {then try this:   button "one" text "browser" button "two"}
>
> button_count: 0
> txt_count: 0
>
> btn: to-string reduce [ to-set-word 'id ": " to-set-word 'btn]
> txt: to-string reduce [ to-set-word 'id ": " to-set-word 'txt]
>
> parse x [any [
> to "button" mark:(
> remove/part mark 6  insert mark reduce [btn button_count: button_count + 1
> ":"{ }"button"])
> :mark
>
> to "text" mark:(
> remove/part mark 4  insert mark reduce [txt txt_count: txt_count + 1
> ":"{ }"text"])
> :mark
>
> ]skip
> ]
> Does not *any and *skip find all occurrences of the marked string?
> Or do I have to use a while loop?
>
>
>
>
>
> --
> To unsubscribe from this list, just send an email to
> [EMAIL PROTECTED] with unsubscribe as the subject.
>
-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.

Reply via email to