summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2000-04-28 18:17:07 +0000
committerGurusamy Sarathy <gsar@cpan.org>2000-04-28 18:17:07 +0000
commitdf0deb90068dea6e06bd6632928a2926975901ce (patch)
treed843359b2d5a6d0af22ce1f6f61d0ea3f16688d4
parentd5a71f3055c3a1145f32dafabd5c3bba8ef27f4d (diff)
downloadperl-df0deb90068dea6e06bd6632928a2926975901ce.tar.gz
fix line renumbering bug in C<eval qq[#line 10 "X"\nwarn]>
p4raw-id: //depot/perl@5999
-rw-r--r--t/pragma/warn/toke5
-rw-r--r--toke.c5
2 files changed, 8 insertions, 2 deletions
diff --git a/t/pragma/warn/toke b/t/pragma/warn/toke
index f001ff7654..8db8027767 100644
--- a/t/pragma/warn/toke
+++ b/t/pragma/warn/toke
@@ -437,13 +437,14 @@ Ambiguous call resolved as CORE::time(), qualify as such or use & at - line 4.
# toke.c
use warnings ;
eval <<'EOE';
+# line 30 "foo"
+warn "yelp";
{
-#line 30 "foo"
$_ = " \x{123} " ;
}
EOE
EXPECT
-
+yelp at foo line 30.
########
# toke.c
my $a = rand + 4 ;
diff --git a/toke.c b/toke.c
index 5c1b945cba..737c9aef89 100644
--- a/toke.c
+++ b/toke.c
@@ -2656,6 +2656,11 @@ Perl_yylex(pTHX)
case '#':
case '\n':
if (PL_lex_state != LEX_NORMAL || (PL_in_eval && !PL_rsfp)) {
+ if (*s == '#' && s == PL_linestart && PL_in_eval && !PL_rsfp) {
+ /* handle eval qq[#line 1 "foo"\n ...] */
+ CopLINE_dec(PL_curcop);
+ incline(s);
+ }
d = PL_bufend;
while (s < d && *s != '\n')
s++;