diff -Naur Template-Toolkit-2.08/parser/Grammar.pm.skel Template-Toolk +it-2.08-bitop/parser/Grammar.pm.skel --- Template-Toolkit-2.08/parser/Grammar.pm.skel Fri Jun 7 19: +29:08 2002 +++ Template-Toolkit-2.08-bitop/parser/Grammar.pm.skel Wed Nov 27 21: +36:36 2002 @@ -106,10 +106,11 @@ my @cmpop = keys %CMPOP; # my @binop = qw( + - * % ); # '/' above, in @tokens my @binop = qw( - * % ); # '+' and '/' above, in @t +okens + my @bitop = qw( & ^ ); # fill lexer table, slice by slice, with reserved words and opera +tors - @$LEXTABLE{ @RESERVED, @cmpop, @binop, @tokens } - = ( @RESERVED, ('CMPOP') x @cmpop, ('BINOP') x @binop, @tokens + ); + @$LEXTABLE{ @RESERVED, @cmpop, @binop, @bitop, @tokens } + = ( @RESERVED, ('CMPOP') x @cmpop, ('BINOP') x @binop, ('BITOP +') x @bitop, @tokens ); }

diff -Naur Template-Toolkit-2.08/parser/Parser.yp Template-Toolkit-2.0 +8-bitop/parser/Parser.yp --- Template-Toolkit-2.08/parser/Parser.yp Fri Jul 19 23:22:57 20 +02 +++ Template-Toolkit-2.08-bitop/parser/Parser.yp Wed Nov 27 21: +34:19 2002 @@ -50,6 +50,7 @@ %left DOT %left CMPOP %left BINOP +%left BITOP %left '+' %left '/' %left DIV @@ -358,6 +359,7 @@ ; expr: expr BINOP expr { "$_[1] $_[2] $_[3]" + } + | expr BITOP expr { "$_[1] $_[2] $_[3]" + } | expr '/' expr { "$_[1] $_[2] $_[3]" + } | expr '+' expr { "$_[1] $_[2] $_[3]" + } | expr DIV expr { "int($_[1] / $_[3])" + }

In reply to Bitwise Operations for Template Toolkit by rob_au

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.