Document the behaviour of filetest operators regarding parentheses.
[p5sagit/p5-mst-13.2.git] / toke.c
diff --git a/toke.c b/toke.c
index aa20096..0b934c1 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++);
            }
@@ -2877,8 +2875,8 @@ Perl_yylex(pTHX)
                /* Assume it was a minus followed by a one-letter named
                 * subroutine call (or a -bareword), then. */
                DEBUG_T( { PerlIO_printf(Perl_debug_log,
-                       "### %c looked like a file test but was not\n",
-                       (int)ftst);
+                       "### '-%c' looked like a file test but was not\n",
+                       tmp);
                } );
                s -= 2;
            }
@@ -3038,10 +3036,12 @@ Perl_yylex(pTHX)
                        CvMETHOD_on(PL_compcv);
                    else if (!PL_in_my && len == 9 && strnEQ(s, "assertion", len))
                        CvASSERTION_on(PL_compcv);
-#ifdef USE_ITHREADS
                    else if (PL_in_my == KEY_our && len == 6 &&
                             strnEQ(s, "unique", len))
+#ifdef USE_ITHREADS
                        GvUNIQUE_on(cGVOPx_gv(yylval.opval));
+#else
+                       ; /* skip that case to avoid loading attributes.pm */
 #endif
                    /* After we've set the flags, it could be argued that
                       we don't need to do the attributes.pm-based setting