From: Rafael Garcia-Suarez Date: Wed, 15 Oct 2003 11:12:31 +0000 (+0000) Subject: Fix bug [perl #24212] : improper error recovery in the X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3cf7b4c446ec2eb4fa0902195a9812fc4f83df28;p=p5sagit%2Fp5-mst-13.2.git Fix bug [perl #24212] : improper error recovery in the tokenizer after an unknown filetest operator. p4raw-id: //depot/perl@21452 --- diff --git a/t/comp/parser.t b/t/comp/parser.t index 899f867..ca191c2 100644 --- a/t/comp/parser.t +++ b/t/comp/parser.t @@ -9,7 +9,7 @@ BEGIN { } require "./test.pl"; -plan( tests => 39 ); +plan( tests => 41 ); eval '%@x=0;'; like( $@, qr/^Can't modify hash dereference in repeat \(x\)/, '%@x=0' ); @@ -123,3 +123,15 @@ EOF ok($@ eq '', "eval $eval"); is(ref $result, $expect ? 'HASH' : '', $eval); } + +# Bug #24212 +{ + local $SIG{__WARN__} = sub { }; # silence mandatory warning + eval q{ my $x = -F 1; }; + like( $@, qr/syntax error .* near "F 1"/, "unknown filetest operators" ); + is( + eval q{ sub F { 42 } -F 1 }, + '-42', + '-F calls the F function' + ); +} diff --git a/toke.c b/toke.c index 0b934c1..b6b81d2 100644 --- a/toke.c +++ b/toke.c @@ -2878,7 +2878,7 @@ Perl_yylex(pTHX) "### '-%c' looked like a file test but was not\n", tmp); } ); - s -= 2; + s = --PL_bufptr; } } tmp = *s++;