This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
dist/Safe/t/safeutf8.t: Generalize to non-ASCII platform
[perl5.git] / toke.c
diff --git a/toke.c b/toke.c
index 33ae20f..0eeafd4 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -2381,6 +2381,7 @@ S_sublex_push(pTHX)
        popping.  We must not have a PL_lex_stuff value left dangling, as
        that breaks assumptions elsewhere.  See bug #123617.  */
     SAVEGENERICSV(PL_lex_stuff);
+    SAVEGENERICSV(PL_sublex_info.repl);
 
     PL_bufend = PL_bufptr = PL_oldbufptr = PL_oldoldbufptr = PL_linestart
        = SvPVX(PL_linestr);
@@ -4552,17 +4553,17 @@ Perl_yylex(pTHX)
            Perl_croak(aTHX_ "panic: INTERPCONCAT, lex_brackets=%ld",
                       (long) PL_lex_brackets);
 #endif
-       if (PL_bufptr == PL_bufend)
-           return REPORT(sublex_done());
-
-       /* Treat state as LEX_NORMAL if SvIVX is not valid on PL_linestr.
+       /* Treat state as LEX_NORMAL when not in an inner lexing scope.
           XXX This hack can be removed if we stop setting PL_lex_state to
           LEX_KNOWNEXT.  */
-       if (SvTYPE(PL_linestr) == SVt_PV) {
+       if (UNLIKELY(!PL_lex_inwhat)) {
            PL_lex_state = LEX_NORMAL;
            break;
        }
 
+       if (PL_bufptr == PL_bufend)
+           return REPORT(sublex_done());
+
        /* m'foo' still needs to be parsed for possible (?{...}) */
        if (SvIVX(PL_linestr) == '\'' && !PL_lex_inpat) {
            SV *sv = newSVsv(PL_linestr);