let parse_optional_field s = match String.lsplit2 s ~on:':' with | None -> error "missing TAG in optional field" s sexp_of_string | Some (tag,s) -> parse_optional_field_value s >>= fun value -> optional_field tag value