|
| 1 | +include CamlinternalFormatBasics |
| 2 | + |
| 3 | +type neutral_concat = |
| 4 | + { f: |
| 5 | + 'a 'b 'c 'd 'e 'f. [`String of string | `Char of char ] -> |
| 6 | + ('a,'b,'c,'d,'e,'f) fmt -> ('a,'b,'c,'d,'e,'f) fmt |
| 7 | + } |
| 8 | + |
| 9 | +let rec string_concat_map: type a b c d e f. |
| 10 | + neutral_concat -> (a,b,c,d,e,f) fmt -> (a,b,c,d,e,f) fmt = |
| 11 | + fun f -> function |
| 12 | + | String (pad, rest) -> String (pad, string_concat_map f rest) |
| 13 | + | Caml_string (pad, rest) -> Caml_string (pad, string_concat_map f rest) |
| 14 | + |
| 15 | + | Int (iconv, pad, prec, rest) -> |
| 16 | + Int (iconv, pad, prec, string_concat_map f rest) |
| 17 | + | Int32 (iconv, pad, prec, rest) -> |
| 18 | + Int32 (iconv, pad, prec, string_concat_map f rest) |
| 19 | + | Nativeint (iconv, pad, prec, rest) -> |
| 20 | + Nativeint (iconv, pad, prec, string_concat_map f rest) |
| 21 | + | Int64 (iconv, pad, prec, rest) -> |
| 22 | + Int64 (iconv, pad, prec, string_concat_map f rest) |
| 23 | + | Float (fconv, pad, prec, rest) -> |
| 24 | + Float (fconv, pad, prec, string_concat_map f rest) |
| 25 | + |
| 26 | + | Char (rest) -> Char (string_concat_map f rest) |
| 27 | + | Caml_char rest -> |
| 28 | + Caml_char ( string_concat_map f rest) |
| 29 | + | Bool (pad, rest) -> Bool (pad, string_concat_map f rest) |
| 30 | + | Alpha rest -> Alpha (string_concat_map f rest) |
| 31 | + | Theta rest -> Theta (string_concat_map f rest) |
| 32 | + | Custom (arity, fc, rest) -> |
| 33 | + Custom (arity, fc, string_concat_map f rest) |
| 34 | + | Reader rest -> Reader (string_concat_map f rest) |
| 35 | + | Flush rest -> Flush (string_concat_map f rest) |
| 36 | + |
| 37 | + | String_literal (str, rest) -> f.f (`String str) (string_concat_map f rest) |
| 38 | + | Char_literal (chr, rest) -> |
| 39 | + f.f (`Char chr) (string_concat_map f rest) |
| 40 | + | Format_arg (pad, fmtty, rest) -> |
| 41 | + Format_arg (pad, fmtty, string_concat_map f rest) |
| 42 | + | Format_subst (pad, fmtty, rest) -> |
| 43 | + Format_subst (pad, fmtty, string_concat_map f rest) |
| 44 | + |
| 45 | + | Scan_char_set (width_opt, char_set, rest) -> |
| 46 | + Scan_char_set (width_opt, char_set, string_concat_map f rest) |
| 47 | + | Scan_get_counter (counter, rest) -> |
| 48 | + Scan_get_counter (counter,string_concat_map f rest) |
| 49 | + | Scan_next_char (rest) -> |
| 50 | + Scan_next_char (string_concat_map f rest) |
| 51 | + | Ignored_param (ign, rest) -> |
| 52 | + Ignored_param (ign, string_concat_map f rest) |
| 53 | + |
| 54 | + | Formatting_lit (fmting_lit, rest) -> |
| 55 | + Formatting_lit (fmting_lit, string_concat_map f rest) |
| 56 | + | Formatting_gen (fmting_gen, rest) -> |
| 57 | + Formatting_gen (fmting_gen, string_concat_map f rest) |
| 58 | + |
| 59 | + | End_of_format -> End_of_format |
0 commit comments