summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorTAKAI Kousuke <62541129+t-a-k@users.noreply.github.com>2020-10-22 23:56:58 +0900
committerKarl Williamson <khw@cpan.org>2020-12-07 21:52:14 -0700
commit8ea1bb76772cbd78b5a9256d3b8507848e7bb2ec (patch)
treeb4f5ced806442cb8273e89c81ef8f73ef4b17827 /toke.c
parentb728918b483f9049ab74984ee11e359e8a769b08 (diff)
downloadperl-8ea1bb76772cbd78b5a9256d3b8507848e7bb2ec.tar.gz
toke.c: Preserve "0o" prefix on warnings and strings passed to overload hook.
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/toke.c b/toke.c
index fd6e9a62a8..37dcbbc939 100644
--- a/toke.c
+++ b/toke.c
@@ -11422,6 +11422,7 @@ Perl_scan_num(pTHX_ const char *start, YYSTYPE* lvalp)
NV hexfp_mult = 1.0;
UV high_non_zero = 0; /* highest digit */
int non_zero_integer_digits = 0;
+ bool new_octal = FALSE; /* octal with "0o" prefix */
PERL_ARGS_ASSERT_SCAN_NUM;
@@ -11481,6 +11482,7 @@ Perl_scan_num(pTHX_ const char *start, YYSTYPE* lvalp)
if (isALPHA_FOLD_EQ(*s, 'o')) {
s++;
just_zero = FALSE;
+ new_octal = TRUE;
}
}
@@ -11491,7 +11493,7 @@ Perl_scan_num(pTHX_ const char *start, YYSTYPE* lvalp)
base = bases[shift];
Base = Bases[shift];
- max = maxima[shift];
+ max = new_octal ? "0o37777777777" : maxima[shift];
/* read the rest of the number */
for (;;) {
@@ -11818,6 +11820,11 @@ Perl_scan_num(pTHX_ const char *start, YYSTYPE* lvalp)
s = start + 2;
break;
case 3:
+ if (new_octal) {
+ *d++ = 'o';
+ s = start + 2;
+ break;
+ }
s = start + 1;
break;
case 1: