let ident_info_of_string s =
  try
    try
      let re = Str.regexp int_ref_re in
      ignore(Str.search_forward re s 0);
      let start = int_of_string (Str.matched_group 6 s) in
      let stop = int_of_string (Str.matched_group 11 s) in
      let name = Str.matched_group 1 s in
      Int_ref (name, (start, stop))
    with
      Not_found ->
        try
          let re = Str.regexp ext_ref_re in
          ignore (Str.search_forward re s 0);
          Ext_ref (Str.matched_group 1 s)
        with
          Not_found ->
            try
              let re = Str.regexp def_re in
              ignore (Str.search_forward re s 0);
              Def (Str.matched_group 1 s)
            with Not_found -> Def ""
  with
  e -> Def (Printexc.to_string e)