12345678910111213141516171819202122232425262728293031typet=(*IF_NOT_AT_LEAST 504 Ocaml_common.Longident.t = *)|Lidentofstring|Ldotoft*string|Lapplyoft*tletrecflataccu=function|Lidents-> s::accu|Ldot(lid,s)->flat(s::accu)lid|Lapply(_,_)->Misc.fatal_error"Longident.flat"letflattenlid=flat[]lidletrecsplit_at_dotsspos=tryletdot=String.index_fromspos'.'inString.subspos (dot-pos)::split_at_dotss(dot+1)withNot_found->[String.subspos(String.lengths-pos)]letunflattenl=match lwith|[]->None|hd::tl->Some(List.fold_left(funps->Ldot(p,s))(Lidenthd)tl)letparses=matchunflatten (split_at_dots s0)with|None->Lident""(* should not happen, but don't put assert false
so as not to crash the toplevel (see Genprintval) *)|Somev->v