summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2020-01-16 14:42:35 -0700
committerKarl Williamson <khw@cpan.org>2020-01-23 15:46:56 -0700
commitfcc04d73946f50bda2ffb344bea778338ce39003 (patch)
treea42d5f54c020a4d661f82b32a2a69cd1769bf502 /toke.c
parent4adf113af1ee3b1c6283f36c81ffefc1adf400ff (diff)
downloadperl-fcc04d73946f50bda2ffb344bea778338ce39003.tar.gz
(toke|regcomp).c: Use common fcn to handle \0 problems
This changes warning messages for too short \0 octal constants to use the function introduced in the previous commit. This function assures a consistent and clear warning message, which is slightly different than the one this commit replaces. I know of no CPAN code which depends on this warning's wording.
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/toke.c b/toke.c
index d54e79e4f9..d4072682c8 100644
--- a/toke.c
+++ b/toke.c
@@ -3534,15 +3534,18 @@ S_scan_const(pTHX_ char *start)
case '0': case '1': case '2': case '3':
case '4': case '5': case '6': case '7':
{
- I32 flags = PERL_SCAN_SILENT_ILLDIGIT;
+ I32 flags = PERL_SCAN_SILENT_ILLDIGIT
+ | PERL_SCAN_NOTIFY_ILLDIGIT;
STRLEN len = 3;
- uv = grok_oct(s, &len, &flags, NULL);
- s += len;
- if (len < 3 && s < send && isDIGIT(*s)
+ uv = grok_oct(s, &len, &flags, NULL);
+ s += len;
+ if ( (flags & PERL_SCAN_NOTIFY_ILLDIGIT)
+ && s < send
+ && isDIGIT(*s) /* like \08, \178 */
&& ckWARN(WARN_MISC))
{
- Perl_warner(aTHX_ packWARN(WARN_MISC),
- "%s", form_short_octal_warning(s, len));
+ Perl_warner(aTHX_ packWARN(WARN_MISC), "%s",
+ form_alien_digit_msg(8, len, s, send, UTF, FALSE));
}
}
goto NUM_ESCAPE_INSERT;