diff options
author | TAKAI Kousuke <62541129+t-a-k@users.noreply.github.com> | 2020-10-22 23:56:58 +0900 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2020-12-07 21:52:14 -0700 |
commit | 8ea1bb76772cbd78b5a9256d3b8507848e7bb2ec (patch) | |
tree | b4f5ced806442cb8273e89c81ef8f73ef4b17827 /toke.c | |
parent | b728918b483f9049ab74984ee11e359e8a769b08 (diff) | |
download | perl-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.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -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: |