. "'";
}
else {
- $^H{charnames_name_aliases}{$name} = $value;
-
- if (warnings::enabled('deprecated')) {
if ($name =~ / ( .* \s ) ( \s* ) $ /x) {
- carp "Trailing white-space in a charnames alias definition is deprecated; marked by <-- HERE in '$1 <-- HERE " . $2 . "'";
+ push @errors, "charnames alias definitions may not contain "
+ . "trailing white-space; marked by <-- HERE in "
+ . "'$1 <-- HERE " . $2 . "'";
+ next;
}
# Use '+' instead of '*' in this regex, because any trailing
- # blanks have already been warned about.
+ # blanks have already been found
if ($name =~ / ( .*? \s{2} ) ( .+ ) /x) {
- carp "A sequence of multiple spaces in a charnames alias definition is deprecated; marked by <-- HERE in '$1 <-- HERE " . $2 . "'";
+ push @errors, "charnames alias definitions may not contain a "
+ . "sequence of multiple spaces; marked by <-- HERE "
+ . "in '$1 <-- HERE " . $2 . "'";
+ next;
}
- }
+
+ $^H{charnames_name_aliases}{$name} = $value;
}
}
}
(D deprecated) Really old Perl let you omit the @ on array names in some
spots. This is now heavily deprecated.
-=item A sequence of multiple spaces in a charnames alias definition is deprecated
+=item charnames alias definitions may not contain a sequence of multiple spaces
-(D deprecated) You defined a character name which had multiple space
+(F) You defined a character name which had multiple space
characters in a row. Change them to single spaces. Usually these
names are defined in the C<:alias> import argument to C<use charnames>, but
they could be defined by a translator installed into C<$^H{charnames}>.
See L<charnames/CUSTOM ALIASES>.
+=item charnames alias definitions may not contain trailing white-space
+
+(F) You defined a character name which ended in a space
+character. Remove the trailing space(s). Usually these names are
+defined in the C<:alias> import argument to C<use charnames>, but they
+could be defined by a translator installed into C<$^H{charnames}>.
+See L<charnames/CUSTOM ALIASES>.
+
=item assertion botched: %s
(X) The malloc package that comes with Perl had an internal failure.
(F) The regular expression ends with an unbackslashed backslash.
Backslash it. See L<perlre>.
-=item Trailing white-space in a charnames alias definition is deprecated
-
-(D deprecated) You defined a character name which ended in a space
-character. Remove the trailing space(s). Usually these names are
-defined in the C<:alias> import argument to C<use charnames>, but they
-could be defined by a translator installed into C<$^H{charnames}>.
-See L<charnames/CUSTOM ALIASES>.
-
=item Transliteration pattern not terminated
(F) The lexer couldn't find the interior delimiter of a tr/// or tr[][]
use open qw( :utf8 :std );
use charnames ":full", ":alias" => { "自転車・に乗る人" => "BICYCLIST",
"٤転車に乗る人" => "BICYCLIST",
+ "TOO MANY SPACES" => "NO ENTRY SIGN",
+ "TRAILING SPACE " => "FACE WITH NO GOOD GESTURE"
};
+print "ok\n" if "\N{TOO MANY SPACES}" eq "\x{1F6AB}";
+print "ok\n" if "\N{TRAILING SPACE }" eq "\x{1F645}";
print "ok\n" if "\N{自転車・に乗る人}" eq "\x{1F6B4}";
print "ok\n" if "\N{٤転車に乗る人}" eq "\x{1F6B4}";
EXPECT
-OPTIONS regex
+OPTIONS regex fatal
+charnames alias definitions may not contain a sequence of multiple spaces; marked by <-- HERE in 'TOO <-- HERE MANY SPACES'
+charnames alias definitions may not contain trailing white-space; marked by <-- HERE in 'TRAILING SPACE <-- HERE '
Invalid character in charnames alias definition; marked by <-- HERE in '٤<-- HERE 転車に乗る人'
Invalid character in charnames alias definition; marked by <-- HERE in '自転車・<-- HERE に乗る人' at - line \d+
-########
-# NAME trailing and sequences of multiple spaces in :alias names are deprectated
-use charnames ":alias" => { "TOO MANY SPACES" => "NO ENTRY SIGN",
- "TRAILING SPACE " => "FACE WITH NO GOOD GESTURE"
- };
-print "ok\n" if "\N{TOO MANY SPACES}" eq "\x{1F6AB}";
-print "ok\n" if "\N{TRAILING SPACE }" eq "\x{1F645}";
-no warnings 'deprecated';
-print "ok\n" if "\N{TOO MANY SPACES}" eq "\x{1F6AB}";
-print "ok\n" if "\N{TRAILING SPACE }" eq "\x{1F645}";
-EXPECT
-OPTIONS regex
-A sequence of multiple spaces in a charnames alias definition is deprecated; marked by <-- HERE in 'TOO <-- HERE MANY SPACES' at - line \d+.
-Trailing white-space in a charnames alias definition is deprecated; marked by <-- HERE in 'TRAILING SPACE <-- HERE ' at - line \d+.
-ok
-ok
-ok
-ok
ok $@ && $@ =~ /Zero length \\N\{}/;
undef $w;
- eval q [is("\N{TOO MANY SPACES}", "TOO MANY SPACES", "Multiple spaces in character name works")];
- like ($w, qr/A sequence of multiple spaces in a charnames alias definition is deprecated/, "... but returns a deprecation warning");
- undef $w;
- eval q [use utf8; is("\N{TOO MANY SPACES}", "TOO MANY SPACES", "Same under 'use utf8': they work")];
- like ($w, qr/A sequence of multiple spaces in a charnames alias definition is deprecated/, "... but return a deprecation warning");
- {
- # disable lexical warnings
- BEGIN { ${^WARNING_BITS} = undef; $^W = 0 }
- undef $w;
- () = eval q ["\N{TOO MANY SPACES}"];
- like ($w, qr/A sequence of multiple spaces in a charnames alias definition is deprecated/, "... and returns a deprecation warning outside of lexical warnings");
- undef $w;
- eval q [use utf8; () = "\N{TOO MANY SPACES}"];
- like ($w, qr/A sequence of multiple spaces in a charnames alias definition is deprecated/, "... same under utf8");
- }
- {
- no warnings 'deprecated';
- undef $w;
- eval q ["\N{TOO MANY SPACES}"];
- ok (! defined $w, "... and no warning if warnings are off");
- eval q [use utf8; "\N{TOO MANY SPACES}"];
- ok (! defined $w, "... same under 'use utf8'");
- }
{
- use warnings FATAL=> 'deprecated';
() = eval q ["\N{TOO MANY SPACES}"];
- like ($@, qr/A sequence of multiple spaces in a charnames alias definition is deprecated/, "... the deprecation warning can be fatal");
+ like ($@, qr/charnames alias definitions may not contain a sequence of multiple spaces/, "Multiple spaces in a row in a charnames alias is fatal");
eval q [use utf8; () = "\N{TOO MANY SPACES}"];
- like ($@, qr/A sequence of multiple spaces in a charnames alias definition is deprecated/, "... same under utf8");
+ like ($@, qr/charnames alias definitions may not contain a sequence of multiple spaces/, "... same under utf8");
}
undef $w;
- eval q [is("\N{TRAILING SPACE }", "TRAILING SPACE ", "Trailing space in character name works")];
- like ($w, qr/Trailing white-space in a charnames alias definition is deprecated/, "... but returns a deprecation warning");
- undef $w;
- eval q [use utf8; is("\N{TRAILING SPACE }", "TRAILING SPACE ", "Same under 'use utf8': they work")];
- like ($w, qr/Trailing white-space in a charnames alias definition is deprecated/, "... but returns a deprecation warning");
{
- # disable lexical warnings
- BEGIN { ${^WARNING_BITS} = undef; $^W = 0 }
- undef $w;
() = eval q ["\N{TRAILING SPACE }"];
- like ($w, qr/Trailing white-space in a charnames alias definition is deprecated/, "... and returns a deprecation warning outside of lexical warnings");
- undef $w;
+ like ($@, qr/charnames alias definitions may not contain trailing white-space/, "Trailing white-space in a charnames alias is fatal");
eval q [use utf8; () = "\N{TRAILING SPACE }"];
- like ($w, qr/Trailing white-space in a charnames alias definition is deprecated/, "... same under utf8");
- }
- {
- no warnings 'deprecated';
- undef $w;
- eval q ["\N{TRAILING SPACE }"];
- ok (! defined $w, "... and no warning if warnings are off");
- eval q [use utf8; "\N{TRAILING SPACE }"];
- ok (! defined $w, "... same under 'use utf8'");
- }
- {
- use warnings FATAL=>'deprecated';
- () = eval q ["\N{TRAILING SPACE }"];
- like ($@, qr/Trailing white-space in a charnames alias definition is deprecated/, "... the warning can be fatal");
- eval q [use utf8; () = "\N{TRAILING SPACE }"];
- like ($@, qr/Trailing white-space in a charnames alias definition is deprecated/, "... same under utf8");
+ like ($@, qr/charnames alias definitions may not contain trailing white-space/, "... same under utf8");
}
+ undef $w;
{
BEGIN { no strict; *CnameTest:: = *{"_charnames\0A::" } }
package CnameTest { sub translator { pop } }
BEGIN { $^H{charnames} = \&CnameTest::translator }
undef $w;
() = eval q ["\N{TOO MANY SPACES}"];
- like ($w, qr/A sequence of multiple spaces/,
+ like ($@, qr/charnames alias definitions may not contain a sequence of multiple spaces/,
'translators in _charnames\0* packages get validated');
}
if (! isCHARNAME_CONT(*s)) {
goto bad_charname;
}
- if (*s == ' ' && *(s-1) == ' ' && ckWARN_d(WARN_DEPRECATED)) {
- Perl_warner(aTHX_ packWARN(WARN_DEPRECATED),
- "A sequence of multiple spaces in a charnames "
- "alias definition is deprecated");
+ if (*s == ' ' && *(s-1) == ' ') {
+ goto multi_spaces;
}
s++;
}
- if (*(s-1) == ' ' && ckWARN_d(WARN_DEPRECATED)) {
- Perl_warner(aTHX_ packWARN(WARN_DEPRECATED),
- "Trailing white-space in a charnames alias "
- "definition is deprecated");
- }
}
else {
/* Similarly for utf8. For invariants can check directly; for other
if (! isCHARNAME_CONT(*s)) {
goto bad_charname;
}
- if (*s == ' ' && *(s-1) == ' '
- && ckWARN_d(WARN_DEPRECATED)) {
- Perl_warner(aTHX_ packWARN(WARN_DEPRECATED),
- "A sequence of multiple spaces in a charnam"
- "es alias definition is deprecated");
+ if (*s == ' ' && *(s-1) == ' ') {
+ goto multi_spaces;
}
s++;
}
s += UTF8SKIP(s);
}
}
- if (*(s-1) == ' ' && ckWARN_d(WARN_DEPRECATED)) {
- Perl_warner(aTHX_ packWARN(WARN_DEPRECATED),
- "Trailing white-space in a charnames alias "
- "definition is deprecated");
- }
+ }
+ if (*(s-1) == ' ') {
+ yyerror_pv(
+ Perl_form(aTHX_
+ "charnames alias definitions may not contain trailing "
+ "white-space; marked by <-- HERE in %.*s<-- HERE %.*s",
+ (int)(s - backslash_ptr + 1), backslash_ptr,
+ (int)(e - s + 1), s + 1
+ ),
+ UTF ? SVf_UTF8 : 0);
+ return NULL;
}
if (SvUTF8(res)) { /* Don't accept malformed input */
return res;
bad_charname: {
- int bad_char_size = ((UTF) ? UTF8SKIP(s) : 1);
/* The final %.*s makes sure that should the trailing NUL be missing
* that this print won't run off the end of the string */
yyerror_pv(
Perl_form(aTHX_
"Invalid character in \\N{...}; marked by <-- HERE in %.*s<-- HERE %.*s",
- (int)(s - backslash_ptr + bad_char_size), backslash_ptr,
- (int)(e - s + bad_char_size), s + bad_char_size
+ (int)(s - backslash_ptr + 1), backslash_ptr,
+ (int)(e - s + 1), s + 1
),
UTF ? SVf_UTF8 : 0);
return NULL;
}
+
+ multi_spaces:
+ yyerror_pv(
+ Perl_form(aTHX_
+ "charnames alias definitions may not contain a sequence of "
+ "multiple spaces; marked by <-- HERE in %.*s<-- HERE %.*s",
+ (int)(s - backslash_ptr + 1), backslash_ptr,
+ (int)(e - s + 1), s + 1
+ ),
+ UTF ? SVf_UTF8 : 0);
+ return NULL;
}
/*