summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2019-03-19 12:08:06 -0600
committerKarl Williamson <khw@cpan.org>2019-03-19 12:50:49 -0600
commitccad88426c3827a98f048facac304bace92604e7 (patch)
tree0ea83deec575cc99ad4ae346bca2663955f0b5c1
parentbc508755449a899a1f962877248064475fb91770 (diff)
downloadperl-ccad88426c3827a98f048facac304bace92604e7.tar.gz
Change error wording for \o{}
An empty \o{} no longer says "Number with no digits" in favor of "Empty \o{}" which is more consistent with errors raised for things like \b{}, \P{}. There is a small risk of breakage with this change, as with any diagnostic wording change. However, this construct is relatively new and rarely used, and this is a fatal error, not a warning you might want to trap on. There are no empty \o{} instances in CPAN.
-rw-r--r--dquote.c2
-rw-r--r--pod/perldelta.pod5
-rw-r--r--pod/perldiag.pod7
-rw-r--r--t/lib/warnings/toke2
-rw-r--r--t/re/reg_mesg.t8
5 files changed, 14 insertions, 10 deletions
diff --git a/dquote.c b/dquote.c
index 10fb2b5df0..707024493e 100644
--- a/dquote.c
+++ b/dquote.c
@@ -126,7 +126,7 @@ Perl_grok_bslash_o(pTHX_ char **s, const char * const send, UV *uv,
numbers_len = e - *s;
if (numbers_len == 0) {
(*s)++; /* Move past the } */
- *error_msg = "Number with no digits";
+ *error_msg = "Empty \\o{}";
return FALSE;
}
diff --git a/pod/perldelta.pod b/pod/perldelta.pod
index ece46e6757..7a013afd64 100644
--- a/pod/perldelta.pod
+++ b/pod/perldelta.pod
@@ -306,7 +306,10 @@ XXX Changes (i.e. rewording) of diagnostic messages go here
=item *
-XXX Describe change here
+Specifying C<\o{}> without anything between the braces now yields the
+fatal error message "Empty \o{}". Previously it was "Number with no
+digits". This means the same wording is used for this kind of error as
+with similar constructs such as C<\p{}>.
=back
diff --git a/pod/perldiag.pod b/pod/perldiag.pod
index 4b618cf7ac..1ab19d4088 100644
--- a/pod/perldiag.pod
+++ b/pod/perldiag.pod
@@ -2159,11 +2159,12 @@ unlikely to be what you want.
=item Empty \%c in regex; marked by S<<-- HERE> in m/%s/
+=item Empty \%c{}
+
=item Empty \%c{} in regex; marked by S<<-- HERE> in m/%s/
-(F) C<\p> and C<\P> are used to introduce a named Unicode property, as
-described in L<perlunicode> and L<perlre>. You used C<\p> or C<\P> in
-a regular expression without specifying the property name.
+(F) You used something like C<\b{}>, C<\B{}>, C<\o{}>, C<\p>, C<\P>
+without specifying anything for it to operate on.
=item ${^ENCODING} is no longer supported
diff --git a/t/lib/warnings/toke b/t/lib/warnings/toke
index 1c85d7bc44..faaf5bc6b8 100644
--- a/t/lib/warnings/toke
+++ b/t/lib/warnings/toke
@@ -1372,7 +1372,7 @@ my $a = "\o{}";
EXPECT
Missing braces on \o{} at - line 3, within string
Missing right brace on \o{ at - line 4, within string
-Number with no digits at - line 5, within string
+Empty \o{} at - line 5, within string
BEGIN not safe after errors--compilation aborted at - line 6.
########
# toke.c
diff --git a/t/re/reg_mesg.t b/t/re/reg_mesg.t
index e7251a9571..872b388c3d 100644
--- a/t/re/reg_mesg.t
+++ b/t/re/reg_mesg.t
@@ -238,7 +238,7 @@ my @death =
'/(?[ \0004 ])/' => 'Need exactly 3 octal digits {#} m/(?[ \0004 {#}])/',
'/(?[ \05 ])/' => 'Need exactly 3 octal digits {#} m/(?[ \05 {#}])/',
'/(?[ \o{1038} ])/' => 'Non-octal character {#} m/(?[ \o{1038{#}} ])/',
- '/(?[ \o{} ])/' => 'Number with no digits {#} m/(?[ \o{}{#} ])/',
+ '/(?[ \o{} ])/' => 'Empty \o{} {#} m/(?[ \o{}{#} ])/',
'/(?[ \x{defg} ])/' => 'Non-hex character {#} m/(?[ \x{defg{#}} ])/',
'/(?[ \xabcdef ])/' => 'Use \\x{...} for more than two hex characters {#} m/(?[ \xabc{#}def ])/',
'/(?[ \x{} ])/' => 'Number with no digits {#} m/(?[ \x{}{#} ])/',
@@ -265,10 +265,10 @@ my @death =
'm/(?[ \p{Digit} & (?(?[ \p{Thai} | \p{Lao} ]))])/' => 'Unexpected character {#} m/(?[ \p{Digit} & (?{#}(?[ \p{Thai} | \p{Lao} ]))])/',
'm/\o{/' => 'Missing right brace on \o{ {#} m/\o{{#}/',
'm/\o/' => 'Missing braces on \o{} {#} m/\o{#}/',
- 'm/\o{}/' => 'Number with no digits {#} m/\o{}{#}/',
+ 'm/\o{}/' => 'Empty \o{} {#} m/\o{}{#}/',
'm/[\o{]/' => 'Missing right brace on \o{ {#} m/[\o{{#}]/',
'm/[\o]/' => 'Missing braces on \o{} {#} m/[\o{#}]/',
- 'm/[\o{}]/' => 'Number with no digits {#} m/[\o{}{#}]/',
+ 'm/[\o{}]/' => 'Empty \o{} {#} m/[\o{}{#}]/',
'm/(?^-i:foo)/' => 'Sequence (?^-...) not recognized {#} m/(?^-{#}i:foo)/',
'm/\87/' => 'Reference to nonexistent group {#} m/\87{#}/',
'm/a\87/' => 'Reference to nonexistent group {#} m/a\87{#}/',
@@ -477,7 +477,7 @@ my @death_utf8 = mark_as_utf8(
'/ネ(?[ \cK [ネ] ])ネ/' => 'Operand with no preceding operator {#} m/ネ(?[ \cK [ネ{#}] ])ネ/',
'/ネ(?[ \0004 ])ネ/' => 'Need exactly 3 octal digits {#} m/ネ(?[ \0004 {#}])ネ/',
'/(?[ \o{ネ} ])ネ/' => 'Non-octal character {#} m/(?[ \o{ネ{#}} ])ネ/',
- '/ネ(?[ \o{} ])ネ/' => 'Number with no digits {#} m/ネ(?[ \o{}{#} ])ネ/',
+ '/ネ(?[ \o{} ])ネ/' => 'Empty \o{} {#} m/ネ(?[ \o{}{#} ])ネ/',
'/(?[ \x{ネ} ])ネ/' => 'Non-hex character {#} m/(?[ \x{ネ{#}} ])ネ/',
'/(?[ \p{ネ} ])/' => 'Can\'t find Unicode property definition "ネ" {#} m/(?[ \p{ネ}{#} ])/',
'/(?[ \p{ ネ = bar } ])/' => 'Can\'t find Unicode property definition "ネ = bar" {#} m/(?[ \p{ ネ = bar }{#} ])/',