This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re: [PATCH] valgrind and /#/x
[perl5.git] / toke.c
diff --git a/toke.c b/toke.c
index 9d1fed2..aef667e 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -1324,7 +1324,7 @@ S_scan_const(pTHX_ char *start)
           except for the last char, which will be done separately. */
        else if (*s == '(' && PL_lex_inpat && s[1] == '?') {
            if (s[2] == '#') {
-               while (s < send && *s != ')')
+               while (s+1 < send && *s != ')')
                    *d++ = NATIVE_TO_NEED(has_utf8,*s++);
            }
            else if (s[2] == '{' /* This should match regcomp.c */
@@ -1343,10 +1343,8 @@ S_scan_const(pTHX_ char *start)
                        count--;
                    regparse++;
                }
-               if (*regparse != ')') {
+               if (*regparse != ')')
                    regparse--;         /* Leave one char for continuation. */
-                   yyerror("Sequence (?{...}) not terminated or not {}-balanced");
-               }
                while (s < regparse)
                    *d++ = NATIVE_TO_NEED(has_utf8,*s++);
            }
@@ -3559,9 +3557,7 @@ Perl_yylex(pTHX)
                    }
                }
                else {
-                   GV *gv = gv_fetchpv(tmpbuf, FALSE, SVt_PVCV);
-                   if (gv && GvCVu(gv))
-                       PL_expect = XTERM;      /* e.g. print $fh subr() */
+                   PL_expect = XTERM;          /* e.g. print $fh subr() */
                }
            }
            else if (isDIGIT(*s))
@@ -6998,7 +6994,7 @@ S_scan_str(pTHX_ char *start, int keep_quoted, int keep_delims)
                    goto read_more_line;
                else {
                    /* handle quoted delimiters */
-                   if (*(svlast-1) == '\\') {
+                   if (SvCUR(sv) > 1 && *(svlast-1) == '\\') {
                        char *t;
                        for (t = svlast-2; t >= SvPVX(sv) && *t == '\\';)
                            t--;