On 12/23/05, Subbu Meiyappan <[EMAIL PROTECTED]> wrote:
> How can I get the operators like '**' (power), '<<' (left shift) etc to work
> in tt?
>    [% x = 10;
>       y = 2 ** x;
>     %]
>  gives me an error.

Since they're not in the standard TT language, you'd need to modify
the grammar. It's not as difficult as it sounds -- I wrote a whole
section on it in the Badger Book.   For math operators like **, you
could find the sections of Parser.yp and Grammar.pm.skel (which are
both in the parser subdirectory[0] of the distribution) that deal with
the other math operators, like * and +, and duplicate them.  Don't
forget to rebuild the grammar.

--
(darren)

[0] See, for example,
http://search.cpan.org/src/ABW/Template-Toolkit-2.14/parser/

_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to