This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
mktables: Assume a leading zero means hex format
authorKarl Williamson <public@khwilliamson.com>
Sat, 21 Jan 2012 20:19:15 +0000 (13:19 -0700)
committerKarl Williamson <public@khwilliamson.com>
Sat, 4 Feb 2012 23:29:28 +0000 (16:29 -0700)
When calculating the format of a table, assume that there are no leading
zeros if it is a decimal number, but that means hex.

lib/unicore/mktables

index 2ee3cb8..ab2d3a0 100644 (file)
@@ -6348,8 +6348,13 @@ END
                                 if $format eq $FLOAT_FORMAT
                                     && $map !~ / ^ -? [0-9]+ \. [0-9]* $ /x;
                             $format = $HEX_FORMAT
-                            if $format eq $RATIONAL_FORMAT
-                                && $map !~ / ^ -? [0-9]+ ( \/ [0-9]+ )? $ /x;
+                                if ($format eq $RATIONAL_FORMAT
+                                       && $map !~
+                                           m/ ^ -? [0-9]+ ( \/ [0-9]+ )? $ /x)
+                                        # Assume a leading zero means hex,
+                                        # even if all digits are 0-9
+                                    || ($format eq $INTEGER_FORMAT
+                                        && $map =~ /^0/);
                             $format = $STRING_FORMAT if $format eq $HEX_FORMAT
                                                        && $map =~ /[^0-9A-F]/;
                         }