summaryrefslogtreecommitdiff
path: root/perl.h
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2020-01-19 20:08:42 -0700
committerKarl Williamson <khw@cpan.org>2020-01-23 15:46:55 -0700
commit99a25d6386ee5787dcd921ea183f9358709026ce (patch)
treebc384ed8e453e235d52f521657101b2ef6113df2 /perl.h
parent74a32ed2df4038377b621310e10e2cf3d7f9dcf5 (diff)
downloadperl-99a25d6386ee5787dcd921ea183f9358709026ce.tar.gz
Add two more flags to grok_bin_oct_hex
These add enough functionality so that other code that rolled its own version of this can call it instead and get the desired functionality. One flag silences warnings about overflow. It would be more consistent to use the existing flag that gets set when overflow is detected to silence the warnings if set on input. But that would be a change in (undocumented) behavior, and I thought it better to not chance breaking something. The other flag forbids an initial underscore when medial underscores are allowed. I wasn't aware until I examined the code and documentation carefully that the flag that I thought allowed single underscores between digits, actually also allows for an initial underscore. I can't imagine why that was the case, but \N{U+...} never allowed initial underscores, and adding a flag to grok_hex to allow just medial underscores allows \N{} in a future commit to change to use grok_hex() without changing behavior. Neither flag is currently exposed outside of the core or extensions
Diffstat (limited to 'perl.h')
-rw-r--r--perl.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/perl.h b/perl.h
index 7fbbd59a38..c374da7399 100644
--- a/perl.h
+++ b/perl.h
@@ -7150,6 +7150,12 @@ A synonym for L</grok_numeric_radix>
/* If this is set on input, and no illegal digit is found, it will be cleared
* on output; otherwise unchanged */
# define PERL_SCAN_NOTIFY_ILLDIGIT 0x40
+
+/* Don't warn on overflow; output flag still set */
+# define PERL_SCAN_SILENT_OVERFLOW 0x80
+
+/* Forbid a leading underscore, which the other one doesn't */
+# define PERL_SCAN_ALLOW_MEDIAL_UNDERSCORES (0x100|PERL_SCAN_ALLOW_UNDERSCORES)
#endif