struct

  type optional_content_parsing = [
  | `wrong_optional of (string * char * string) list *
      [ `not_a_char of string
      | `not_a_float of string
      | `not_an_int of string
      | `unknown_type of char
      | `wrong_array of
          [ `not_a_char of string
          | `not_a_float of string
          | `not_an_int of string
          | `wrong_type of string
          | `unknown_type of char
          ]
      | `wrong_type of string
      ]
  ]
  with sexp

  type string_to_raw = [
  | `incomplete_input of Pos.t * string list * string option
  | `invalid_header_tag of Pos.t * string
  | `invalid_tag_value_list of Pos.t * string list
  | `not_an_int of Pos.t * string * string
  | `wrong_alignment of Pos.t * string
  | `wrong_optional_field of Pos.t * string
  ]
  with sexp

  type raw_to_item = [
  | `comment_after_end_of_header of int * string
  | `duplicate_in_reference_sequence_dictionary of reference_sequence array
  | `header_after_end_of_header of int * (string * (string * string) list)
  | `header_line_not_first of int
  | `header_line_without_version of (string * string) list
  | `header_line_wrong_sorting of string
  | `missing_ref_sequence_length of (string * string) list
  | `missing_ref_sequence_name of (string * string) list
  | `wrong_cigar_text of string
  | `wrong_flag of raw_alignment
  | `wrong_mapq of raw_alignment
  | `wrong_phred_scores of raw_alignment
  | `wrong_pnext of raw_alignment
  | `wrong_pos of raw_alignment
  | `wrong_qname of raw_alignment
  | `wrong_ref_sequence_length of (string * string) list
  | `wrong_tlen of raw_alignment
  | optional_content_parsing
  ]
  with sexp

  type item_to_raw = [
    `wrong_phred_scores of alignment
  ]
  with sexp

  
  (** Errors possible during parsing. *)

  type parse = [
  | string_to_raw
  | raw_to_item
  ]
  with sexp

  type t = parse with sexp

end