Subject: | misinterpreting division slash as implied $_=~m// |
So I'm testing my source filter, on cygwin 5.8.7
with text::balanced v. 1.95 (no version.pm; can't upgrade to v2.0.0, but
this issue does not appear to appear in RT bugs)
macro plusmeansminus left+right {left-right};
macro plusmeansminus left / right {left+right};
pass ('macro syntax including punctuation');
is((37-30), (plusmeansminus (7 + 15 * 2) + 30),
"syntax triggered sig");
is((37+30), (plusmeansminus (7 + 15 * 2) / 30),
"alternate syn trgrd sig");
and I get everything from left to 30 excised as a quotelike.
I don't know what Perl's heuristic about when to interpret
slash as implying a match against $_ is, but this is not correct
behavior:
$ perl -MO=Deparse /tmp/dubious.pl
'plusmeansminus'->macro('left' + do {
'left' - 'right'
}->right);
'plusmeansminus'->macro('left' / do {
'left' + 'right'
}->right);
pass('macro syntax including pynctuation');
is(7, plusmeansminus(37) + 30, 'syntax triggered sig');
is(67, plusmeansminus(37) / 30, 'alternate syn trgrd sig');
/tmp/dubious.pl syntax OK
Has the heuristic been revised since v1.95?
(Macrame.pm teaser: the tests now pass using @ instead of / )
Subject: | dubious.pl |
macro plusmeansminus left+right {left-right};
macro plusmeansminus left / right {left+right};
pass ('macro syntax including pynctuation');
is((37-30), (plusmeansminus (7 + 15 * 2) + 30), "syntax triggered sig");
is((37+30), (plusmeansminus (7 + 15 * 2) / 30), "alternate syn trgrd sig");