From 18b095192e336ba31465f4d3dab1ecc90871c3a9 Mon Sep 17 00:00:00 2001 From: Gurusamy Sarathy Date: Sun, 6 Feb 2000 17:00:49 +0000 Subject: [PATCH] fix parse error on C<{ use strict }> and other constructs that make the parser reenter while LEX_KNOWNEXT is active p4raw-id: //depot/perl@5004 --- t/comp/use.t | 4 +--- toke.c | 9 +++++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/t/comp/use.t b/t/comp/use.t index 1099547..2594f0a 100755 --- a/t/comp/use.t +++ b/t/comp/use.t @@ -44,9 +44,7 @@ unless ($@) { print "ok ",$i++,"\n"; - -use lib; # I know that this module will be there. - +{ use lib } # check that subparse saves pending tokens local $lib::VERSION = 1.0; diff --git a/toke.c b/toke.c index e1eb817..b9a12c4 100644 --- a/toke.c +++ b/toke.c @@ -376,6 +376,15 @@ Perl_lex_start(pTHX_ SV *line) SAVEI32(PL_lex_state); SAVEVPTR(PL_lex_inpat); SAVEI32(PL_lex_inwhat); + if (PL_lex_state == LEX_KNOWNEXT) { + I32 toke = PL_nexttoke; + while (--toke >= 0) { + SAVEI32(PL_nexttype[toke]); + SAVEVPTR(PL_nextval[toke]); + } + SAVEI32(PL_nexttoke); + PL_nexttoke = 0; + } SAVECOPLINE(PL_curcop); SAVEPPTR(PL_bufptr); SAVEPPTR(PL_bufend); -- 2.7.4