let optional_field_value_B elt_type elts =
let valid_args =
match elt_type with
| 'c' | 'C' | 's' | 'S' | 'i' | 'I' ->
List.for_all elts ~f:(Re.execp opt_field_int_re)
| 'f' ->
List.for_all elts ~f:(Re.execp opt_field_float_re)
| _ -> false
in
if valid_args then Ok (`B (elt_type, elts))
else error "invalid value" ("B", elt_type, elts) <:sexp_of< string * char * string list >>