This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
fix line renumbering bug in C<eval qq[#line 10 "X"\nwarn]>
authorGurusamy Sarathy <gsar@cpan.org>
Fri, 28 Apr 2000 18:17:07 +0000 (18:17 +0000)
committerGurusamy Sarathy <gsar@cpan.org>
Fri, 28 Apr 2000 18:17:07 +0000 (18:17 +0000)
p4raw-id: //depot/perl@5999

t/pragma/warn/toke
toke.c

index f001ff7..8db8027 100644 (file)
@@ -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 5c1b945..737c9ae 100644 (file)
--- 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++;