summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2003-10-15 11:12:31 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2003-10-15 11:12:31 +0000
commit3cf7b4c446ec2eb4fa0902195a9812fc4f83df28 (patch)
tree8b05014144619ca2aca2412986c5a06399902cb4
parent8be5f608f6696ee966fa295d23ecd0c1c2220447 (diff)
downloadperl-3cf7b4c446ec2eb4fa0902195a9812fc4f83df28.tar.gz
Fix bug [perl #24212] : improper error recovery in the
tokenizer after an unknown filetest operator. p4raw-id: //depot/perl@21452
-rw-r--r--t/comp/parser.t14
-rw-r--r--toke.c2
2 files changed, 14 insertions, 2 deletions
diff --git a/t/comp/parser.t b/t/comp/parser.t
index 899f8674ee..ca191c2de0 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 0b934c1a79..b6b81d244b 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++;