Re: [Templates] Problems with reserved words as hash keys
[prev]
[thread]
[next]
[Date index for 2004/12/16]
Jason Gottshall wrote:
> Template Toolkit chokes when it encounters reserved words (in uppercase)
> used as hash keys or method names.
Yep, annoying isn't it?
> It could be that I'll
> just have to muddle through until TT3 (this is fixed in TT3, right
> Andy?)
Yep, fixed in TT3. :-)
It can't be fixed in TT2 because the parser is too dumb. It scans for
tokens up front and figures out which tokens are reserved keywords
regardless of position or context. That was the one of the main
reasons for switching to a recursive descent parser in TT3.
Incidentally, we're not far off being able to use the TT3 parser to
compile templates for TT2. I'm planning on a drop-in replacement to
allow people to start using the new parser under the old framework.
> Incidentally, can anyone tell me why STEP and TO are reserved words? Is
> this a holdover from TT1? I can't find any reference to them in the
> docs...
'TO' is an alias for '..', e.g.
[% FOREACH a IN [10 TO 20] %]
'STEP' is... uhm... dunno. If it was ever used, then it was used for this:
[% FOREACH a IN [10 TO 20 STEP 2] %]
That's not supported now, so it's most probably legacy cruft as you suggest.
A
_______________________________________________
templates mailing list
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates
 |
 |
Re: [Templates] Problems with reserved words as hash keys
Andy Wardley 09:29 on 16 Dec 2004
|