Thank you for the reply.
I tested to see using the following template.
<h2>6 / 5 * 4</h2>
CET: [% 6 / 5 * 4 %]<br>
Perl: [% PERL %]print 6 / 5 * 4 [% END %]<br>
<h2>2 ** 3 ** 4</h2>
CET: [% 2 ** 3 ** 4 %]<br>
Perl: [% PERL %]print 2 ** 3 ** 4[% END %]<br>
CET: [% a = 5; b = 2 %][% a---b %]<br>
Perl: [% PERL %]$a = 5; $b = 2; print $a---$b[% END %]<br>
CET: [% a = 5; b = 2 %][% a--- -b %]<br>
Perl: [% PERL %]$a = 5; $b = 2; print $a--- -$b[% END %]<br>
CET: [% a = 5; b = 2 %][% a--- --b %]<br>
Perl: [% PERL %]$a = 5; $b = 2; print $a--- --$b[% END %]<br>
It printed out:
6 / 5 * 4
2 ** 3 ** 4
So - it looks like I need to fix my right vs left vs non-associative. I'll add that to the table and change the parser (it is always doing right right now - it used to always do left - it will be trivial and won't even cause a speed hit to allow it to do both). Thank you - I knew about precedence and precedence makes complete sense - associativity rules seem like they are a little more arbitrary and it seems to cry foul to the user that it isn't consistent (such is legacy). In the perl6 operators table they don't even mention if the operator group is right or left (though it probably does elsewhere in the doc).
So - the infix type will go away in CGI::Ex::Template and will be replaced by left right and non. It needs to match perl.
I'll get that out hopefully soon. Thanks again.
Oh - also to note - the a----b and a-----b examples are both parse errors because the longest term rule makes them try and find a prefix -- immediately after the postfix --. Adding a space after the first three - disabiguates both cases.
my @a=qw(random brilliant braindead); print $a[rand(@a)];
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:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||