[Petal] Petal 0.5

Jean-Michel Hiver jhiver@mkdoc.com
Tue, 6 Aug 2002 10:57:30 +0100


> There's a discussion on the ZPT list about the path: and string: 
> expression types that might be of interest to you.  We're talking about 
> making them more tightly interrelated, but I'm not sure how it would 
> affect your interpolation logic.  To be specific, here's what the 
> expression grammars could become (very informally):

Where can I subscribe to this mailing list?
Or at least browse the archives?

>     PathExpr      ::= path [ '|' path ]* [ '|' Expression ]
>     path          ::= StringExpr
>     StringExpr    ::= ( plain_string | interpolation )*
>     interpolation ::= ( '$' identifier ) | ( '${' path '}' )
>     plain_string  ::= ( '$$' | non_dollar )*
>     non_dollar    ::= any character except '$'
> 
> ...where a 'path' has semantic restrictions applied to its expansion 
> that a 'StringExpr' does not, such as starting with an identifier.
> 
> This would allow indirections such as the following:
> 
>  string:${request/${v1}} + ${request/${v2}}
>  path:${$x}

That is interesting. Except that given the fact that I can already pass
arguments to methods, if I implement nesting on top of that I'm going to
reinvent LISP :-)

I'll have to have a look I guess... I guess if I were to implement it
I'd have to use something like Parse::RecDescent rather than simple
regexes.

What I like is that currently the string: modifier parser is just this:

  our $VARIABLE_RE_SIMPLE   = qq |\\\$[A-Za-z][A-Za-z0-9_\\.:\/]+|;
  our $VARIABLE_RE_BRACKETS = qq |\\\$(?<!\\\\)\\{.*?(?<!\\\\)\\}|;
  our $TOKEN_RE             = "(?:$VARIABLE_RE_SIMPLE|$VARIABLE_RE_BRACKETS)";

Which is easy enough.

One thing in these specs which I'll probably never follow from your
specs is doubling special characters. I think backslashing them is an
awful lot better, you can always backslash any character if you're in
doubt.

Another thing I've been wondering about is the 'structure' keyword. I
cannot figure out if it's in the TAL or the TALES specification. It
looks to me like a bit of a hack... Can you tell me more about it?

Cheers,
-- 
IT'S TIME FOR A DIFFERENT KIND OF WEB
================================================================
  Jean-Michel Hiver - Software Director
  jhiver@mkdoc.com
  +44 (0)114 255 8097
================================================================
                                      VISIT HTTP://WWW.MKDOC.COM