[Date Index][Thread Index]
[Date Prev][Date Next][Thread Prev][Thread Next]

Re: conflict between passes

Hello Zhao Yue, in a previous mail you wrote:

> I am beginner of wml. I met such a problem: since
> pass 2 is processed first than pass 3, the following
> example can't reach its desired result:
> <define-tag mytag>
> <:{
>     printf "some words";
> }:>
> </define-tag>
> <define-tag anothertag>
> <:{
>   printf "<mytag>";
> }:>
> </define-tag>
> <anothertag>
> In fact, this will lead to a parsing error of perl.

Correct, because ePerl currently doesn't support nested Perl blocks.  As you
might expect this restriction is not because I just wanted ePerl to support
it. It is because it is very difficult to do it in a really useful and
backward-compatible manner. I'll start a discussion in a different posting
because it bites us a lot of times and I really want to implement the
nesting-support now. But we need to make sure we decided the correct approach
which is 100% backward-compat, so existing scripts don't get broken.

> Any suggestion for recorvering this problem?

Until we have an ePerl with nesting-support, you have to use a few tricks to
avoid this problem. First, to let all understand the problem: What WML
created after running pass 1 and 2 is basically the following:

     <:{ printf "<:{ printf "some words"; }:>"; }:>

i.e. a nested structure which is not supported by the current ePerl.  So, our
goal is to avoid this structure while still having the same functionality and
result. I currently know only one work-arounds which wml::des::navbar and
other include files use:

   | <define-tag mytag>
   | <:{ printf "some words"; }:>
   | </define-tag>
   | <define-tag anothertag>
   | <:{ printf "<<div_mytag>>"; }:>
   | ..div_mytag>><mytag><<..
   | </define-tag>
   | <anothertag>

Here Pass 5 (Divert) is used to avoid the conflict.  Sorry for this heavy
restriction, but it cannot be eliminated easily.

                                       Ralf S. Engelschall
Website META Language (WML)                www.engelschall.com/sw/wml/
Official Support Mailing List                   sw-wml@engelschall.com
Automated List Manager                       majordomo@engelschall.com