let cut_by_locations annot_string =
  let rec iter acc pos =
    match
      try Some (Str.search_forward location_re annot_string pos)
      with Not_found -> None
    with
      None -> List.rev acc
    | Some start ->
        let stop = Str.match_end () in
        let left = int_of_string (Str.matched_group 5 annot_string) in
        let right = int_of_string (Str.matched_group 10 annot_string) in
        iter ((start, stop, left, right) :: acc) stop
  in
  iter [] 0