summaryrefslogtreecommitdiffstats
path: root/stdlib
diff options
context:
space:
mode:
authorGabriel Scherer <gabriel.scherer@gmail.com>2014-05-12 15:37:45 +0000
committerGabriel Scherer <gabriel.scherer@gmail.com>2014-05-12 15:37:45 +0000
commitb56ea67724f1b7cd70ab308ba8965c3c7c7c5d7e (patch)
tree9510f092ffb4487d83e08528ae99d60be7645292 /stdlib
parentfb906370951e559dba66fd821bbe6a99c613ff33 (diff)
some benine meaningless formats were previously ignored
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14814 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'stdlib')
-rw-r--r--stdlib/camlinternalFormat.ml17
1 files changed, 14 insertions, 3 deletions
diff --git a/stdlib/camlinternalFormat.ml b/stdlib/camlinternalFormat.ml
index 60c82b603..b0873509d 100644
--- a/stdlib/camlinternalFormat.ml
+++ b/stdlib/camlinternalFormat.ml
@@ -1370,12 +1370,18 @@ let fmt_ebb_of_string str =
parse_after_padding pct_ind (str_ind + 1) end_ind plus sharp space ign
(Arg_padding padty)
| _ ->
- match padty with
- | Left -> invalid_format_without (str_ind - 1) '-' "padding"
- | Zeros -> invalid_format_without (str_ind - 1) '0' "padding"
+ if legacy_behavior then
+ parse_after_padding pct_ind str_ind end_ind plus sharp space ign
+ No_padding
+ else begin match padty with
+ | Left ->
+ invalid_format_without (str_ind - 1) '-' "padding"
+ | Zeros ->
+ invalid_format_without (str_ind - 1) '0' "padding"
| Right ->
parse_after_padding pct_ind str_ind end_ind plus sharp space ign
No_padding
+ end
(* Is precision defined? *)
and parse_after_padding : type x e f .
@@ -1405,6 +1411,11 @@ let fmt_ebb_of_string str =
parse_after_precision pct_ind (str_ind + 1) end_ind plus sharp space ign
pad Arg_precision
| _ ->
+ if legacy_behavior then
+ (* note that legacy implementation did not ignore '.' without
+ a number (as it does for padding indications), but
+ interprets it as '.0' *)
+ parse_after_precision pct_ind str_ind end_ind plus sharp space ign pad (Lit_precision 0) else
invalid_format_without (str_ind - 1) '.' "precision"
(* Try to read the conversion. *)