[REBOL] Re: Parse and and recursion local variables?
From: lmecir:mbox:vol:cz at: 17-Mar-2007 19:12
Petr Krenzelok napsal(a):
> OK Ladislav, here we go. I bet I am doing something incorrectly. Simply
> put, once rsp-section recursion is applied for mark-u section, once it
> returns back to one level up, rsp-tag-name remains to be set to mark-u,
> whereas what I would like to achieve is - parser keeping that variable
> local for certain iteration, so once it would return from mark-u section
> back to finish parent mark-w section, having it set to mark-w. I tried
> to enclose the example in the function and define rsp-tag-name as local
> variable as you can see, but to no luck ... but maybe my aproach is
> incorrent conceptually anyway :-)
>
> Thanks,
> Petr
>
you are not too far away, I guess. Instead of using one PARSE, you could
define your own PARSE-TAG function etc.
But, I take this as an opportunity to promote my way ;-). If you take a
look at http://www.fm.vslib.cz/~ladislav/rebol/parseen.r and try:
rsp-section: [
do-block [
use [rsp-tag-name] [
rsp-begin: [...]
rsp-end: [...]
[rsp-begin any [rsp-end (print ["finished section" rsp-tag-name]) break | rsp-section
| rsp-html]]
]
]
]
you may find out, that it works
-L