This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perldiag: Clean up ‘Sequence (...’ messages
authorFather Chrysostomos <sprout@cpan.org>
Sun, 17 Nov 2013 13:32:45 +0000 (05:32 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Sun, 17 Nov 2013 21:08:46 +0000 (13:08 -0800)
Make sure they are all documented.  Sprinkle diag_listed_as where
appropriate.

pod/perldiag.pod
regcomp.c
t/porting/diag.t

index 2870e50..cdee81d 100644 (file)
@@ -3956,7 +3956,7 @@ then discovered it wasn't a subroutine or eval context.
 
 (P) scan_num() got called on something that wasn't a number.
 
-=item panic: Sequence (?{...}): no code block found
+=item panic: Sequence (?{...}): no code block found in regex m/%s/
 
 (P) while compiling a pattern that has embedded (?{}) or (??{}) code
 blocks, perl couldn't locate the code block that should have already been
@@ -4729,7 +4729,7 @@ before now.  Check your control flow.
 <-- HERE shows whereabouts in the regular expression the problem was
 discovered.  See L<perlre>.
 
-=item Sequence (?%s...) not implemented in regex; marked by <-- HERE in m/%s/
+=item Sequence (?%c...) not implemented in regex; marked by <-- HERE in m/%s/
 
 (F) A proposed regular expression extension has the character reserved
 but has not yet been written.  The <-- HERE shows whereabouts in the
@@ -4750,6 +4750,21 @@ causes, see L<perlre>.
 parenthesis.  Embedded parentheses aren't allowed.  See
 L<perlre>.
 
+=item Sequence (?%c... not terminated in regex; marked by <-- HERE
+in m/%s/
+
+(F) A named group of the form C<(?'...')> or C<< (?<...>) >> was missing the final
+closing quote or angle bracket.  The <-- HERE shows whereabouts in the
+regular expression the problem was discovered.
+
+=item Sequence (?(%c... not terminated in regex; marked by <-- HERE
+in m/%s/
+
+(F) A named reference of the form C<(?('...')...)> or C<< (?(<...>)...) >> was
+missing the final closing quote or angle bracket after the name.  The
+<-- HERE shows whereabouts in the regular expression the problem was
+discovered.
+
 =item Sequence \%s... not terminated in regex; marked by <-- HERE in m/%s/
 
 (F) The regular expression expects a mandatory argument following the escape
@@ -4760,6 +4775,17 @@ sequence and this has been omitted or incorrectly written.
 (F) The end of the perl code contained within the {...} must be
 followed immediately by a ')'.
 
+=item Sequence ?P=... not terminated in regex; marked by <-- HERE in m/%s/
+
+(F) A named reference of the form C<(?P=...)> was missing the final
+closing parenthesis after the name.  The <-- HERE shows whereabouts
+in the regular expression the problem was discovered.
+
+=item Sequence (?R) not terminated in regex m/%s/
+
+(F) An C<(?R)> or C<(?0)> sequence in a regular expression was missing the
+final parenthesis.
+
 =item Server error (a.k.a. "500 Server error")
 
 (A) This is the error message generally seen in a browser window
index d9e8e7e..1b3c04d 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -8968,6 +8968,7 @@ S_parse_lparen_question_flags(pTHX_ RExC_state_t *pRExC_state)
             default:
             fail_modifiers:
                 RExC_parse += UTF ? UTF8SKIP(RExC_parse) : 1;
+               /* diag_listed_as: Sequence (?%s...) not recognized in regex; marked by <-- HERE in m/%s/ */
                 vFAIL2utf8f("Sequence (%"UTF8f"...) not recognized",
                       UTF8fARG(UTF, RExC_parse-seqstart, seqstart));
                 /*NOTREACHED*/
@@ -9175,6 +9176,7 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I32 paren, I32 *flagp,U32 depth)
                     SV *sv_dat = reg_scan_name(pRExC_state,
                         SIZE_ONLY ? REG_RSN_RETURN_NULL : REG_RSN_RETURN_DATA);
                     if (RExC_parse == name_start || *RExC_parse != ')')
+                        /* diag_listed_as: Sequence ?P=... not terminated in regex; marked by <-- HERE in m/%s/ */
                         vFAIL2("Sequence %.3s... not terminated",parse_start);
 
                     if (!SIZE_ONLY) {
@@ -9203,6 +9205,7 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I32 paren, I32 *flagp,U32 depth)
                     return ret;
                 }
                 RExC_parse++;
+                /* diag_listed_as: Sequence (?%s...) not recognized in regex; marked by <-- HERE in m/%s/ */
                vFAIL3("Sequence (%.*s...) not recognized", RExC_parse-seqstart, seqstart);
                /*NOTREACHED*/
             case '<':           /* (?<...) */
@@ -9222,6 +9225,7 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I32 paren, I32 *flagp,U32 depth)
                        REG_RSN_RETURN_NULL);
                    if (RExC_parse == name_start) {
                        RExC_parse++;
+                       /* diag_listed_as: Sequence (?%s...) not recognized in regex; marked by <-- HERE in m/%s/ */
                        vFAIL3("Sequence (%.*s...) not recognized", RExC_parse-seqstart, seqstart);
                        /*NOTREACHED*/
                     }
@@ -9423,6 +9427,7 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I32 paren, I32 *flagp,U32 depth)
                is_logical = 1;
                if (*RExC_parse != '{') {
                    RExC_parse++;
+                    /* diag_listed_as: Sequence (?%s...) not recognized in regex; marked by <-- HERE in m/%s/ */
                     vFAIL2utf8f(
                         "Sequence (%"UTF8f"...) not recognized",
                         UTF8fARG(UTF, RExC_parse-seqstart, seqstart));
@@ -11001,6 +11006,7 @@ tryagain:
             char ch= RExC_parse[1];        
            if (ch != '<' && ch != '\'' && ch != '{') {
                RExC_parse++;
+               /* diag_listed_as: Sequence \%s... not terminated in regex; marked by <-- HERE in m/%s/ */
                vFAIL2("Sequence %.2s... not terminated",parse_start);
            } else {
                /* this pretty much dupes the code for (?P=...) in reg(), if
@@ -11011,6 +11017,7 @@ tryagain:
                     SIZE_ONLY ? REG_RSN_RETURN_NULL : REG_RSN_RETURN_DATA);
                 ch= (ch == '<') ? '>' : (ch == '{') ? '}' : '\'';
                 if (RExC_parse == name_start || *RExC_parse != ch)
+                    /* diag_listed_as: Sequence \%s... not terminated in regex; marked by <-- HERE in m/%s/ */
                     vFAIL2("Sequence %.3s... not terminated",parse_start);
 
                 if (!SIZE_ONLY) {
index 4f44c29..6925872 100644 (file)
@@ -576,12 +576,6 @@ Reversed %c= operator
 %s: Can't parse EXE/DLL name: '%s'
 %s(%f) failed
 %sCompilation failed in require
-Sequence (?%c...) not implemented in regex; marked by <-- HERE in m/%s/
-Sequence (%s...) not recognized in regex; marked by <-- HERE in m/%s/
-Sequence %s... not terminated in regex; marked by <-- HERE in m/%s/
-Sequence (?%c... not terminated in regex; marked by <-- HERE in m/%s/
-Sequence (?(%c... not terminated in regex; marked by <-- HERE in m/%s/
-Sequence (?R) not terminated in regex m/%s/
 %s: Error stripping dirs from EXE/DLL/INSTALLDIR name
 set %s %p %p %p
 %s free() ignored (RMAGIC, PERL_CORE)