From: Larry Wall Date: Wed, 6 Oct 1999 09:55:57 +0000 (-0700) Subject: add suggested patch =~ s/NOTOP/OP_NOT/ with tests X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2d2e263d835bab7638308fed2b56967f4815cad6;p=p5sagit%2Fp5-mst-13.2.git add suggested patch =~ s/NOTOP/OP_NOT/ with tests Message-Id: <199910061655.JAA11333@kiev.wall.org> Subject: Re: [ID 19991001.004] apparent parsing error with not(arg) p4raw-id: //depot/perl@4312 --- diff --git a/opcode.h b/opcode.h index ae4011f..e0bf4ff 100644 --- a/opcode.h +++ b/opcode.h @@ -1567,7 +1567,7 @@ EXT U32 PL_opargs[] = { 0x0022281c, /* vec */ 0x0122291c, /* index */ 0x0122291c, /* rindex */ - 0x0004290f, /* sprintf */ + 0x0004280f, /* sprintf */ 0x00042805, /* formline */ 0x0001379e, /* ord */ 0x0001378e, /* chr */ diff --git a/t/comp/bproto.t b/t/comp/bproto.t index 699ea57..01efb84 100755 --- a/t/comp/bproto.t +++ b/t/comp/bproto.t @@ -8,7 +8,7 @@ BEGIN { unshift @INC, '../lib'; } -print "1..7\n"; +print "1..10\n"; my $i = 1; @@ -38,4 +38,7 @@ q[ scalar(&foo,$bar); defined &foo, &foo, &foo; undef &foo, $bar; uc $bar,$bar; + grep(not($bar), $bar); + grep(not($bar, $bar), $bar); + grep((not $bar, $bar, $bar), $bar); ]; diff --git a/toke.c b/toke.c index a6d3641..58b82df 100644 --- a/toke.c +++ b/toke.c @@ -120,7 +120,7 @@ int* yychar_pointer = NULL; * LOOPX : loop exiting command (goto, last, dump, etc) * FTST : file test operator * FUN0 : zero-argument function - * FUN1 : not used + * FUN1 : not used, except for not, which isn't a UNIOP * BOop : bitwise or or xor * BAop : bitwise and * SHop : shift operator @@ -4227,7 +4227,10 @@ Perl_yylex(pTHX) OPERATOR(USE); case KEY_not: - OPERATOR(NOTOP); + if (*s == '(' || (s = skipspace(s), *s == '(')) + FUN1(OP_NOT); + else + OPERATOR(NOTOP); case KEY_open: s = skipspace(s);