On 03-11-2009 at 17:56:02 Tobias Herp <bruno-the-questiona...@gmx.net> wrote:

Kornel Lesiński wrote:
I could change it to:

${x} → value
$${x} → ${x}
$$${x} → $value
$$$${x} → $${x}
$$$$${x} → $$value
$$$$$${x} → $$${x}
etc.

Yes, please!

This is logical, and it is the behaviour defined by the TALES standard (http://wiki.zope.org/ZPT/TALESSpecification13#required_type_prefixes).
The current behaviour is a *bug* and should be fixed.

OK. That's a good point.

• Pre-filters may need to deal with this to (un)escape text properly.
With simpler rules you can just replace ${ with $${ to escape text.
It's not so easy when you need to observe even/odd number of $s.

Well, you can consume the text sequentially and change every $$ into $, and treat every ${ or $\w as the beginning of a variable. Doesn't look very complicated to me.

Using regular expressions, you could look for $(.); if \1 is another $, you have a literal $, etc. Anything else but [${\w] should yield an error, of course!

How do you halve/double number of $'s with regular expression?

--
regards, Kornel

_______________________________________________
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal

Reply via email to