Change 17900 by rgs@rgs-home on 2002/09/12 19:33:06 Fix a syntax incompatibility introduced by the // operator. (Note that C<print $fh //> is still a syntax error, it wasn't with perl 5.8.0.)
Affected files ... .... //depot/perl/t/op/dor.t#3 edit .... //depot/perl/toke.c#442 edit Differences ... ==== //depot/perl/t/op/dor.t#3 (text) ==== Index: perl/t/op/dor.t --- perl/t/op/dor.t#2~17777~ Sun Aug 25 11:42:46 2002 +++ perl/t/op/dor.t Thu Sep 12 12:33:06 2002 @@ -10,7 +10,7 @@ package main; require './test.pl'; -plan( tests => 25 ); +plan( tests => 30 ); my($x); @@ -59,3 +59,16 @@ eval "sub { $_ // 0 }"; is($@, '', "$_ // ... compiles"); } + +# Test for some ambiguous syntaxes + +eval q# sub f ($) { } f $x / 2; #; +is( $@, '' ); +eval q# sub f ($):lvalue { $y } f $x /= 2; #; +is( $@, '' ); +eval q# sub f ($) { } f $x /2; #; +like( $@, qr/^Search pattern not terminated/ ); +eval q# sub { print $fh / 2 } #; +is( $@, '' ); +eval q# sub { print $fh /2 } #; +like( $@, qr/^Search pattern not terminated/ ); ==== //depot/perl/toke.c#442 (text) ==== Index: perl/toke.c --- perl/toke.c#441~17777~ Sun Aug 25 11:42:46 2002 +++ perl/toke.c Thu Sep 12 12:33:06 2002 @@ -3554,14 +3554,9 @@ PL_expect = XTERM; /* e.g. print $fh .3 */ else if (strchr("?-+", *s) && !isSPACE(s[1]) && s[1] != '=') PL_expect = XTERM; /* e.g. print $fh -1 */ - else if (*s == '/') { - if(s[1] == '/') { - PL_expect=XOPERATOR; - } - else { - PL_expect=XTERM; - } - } + else if (*s == '/' && !isSPACE(s[1]) && s[1] != '=' && s[1] != '/') + PL_expect = XTERM; /* e.g. print $fh /.../ + XXX except DORDOR operator */ else if (*s == '<' && s[1] == '<' && !isSPACE(s[2]) && s[2] != '=') PL_expect = XTERM; /* print $fh <<"EOF" */ } End of Patch.