12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970(********************************************************************************)(* crs - A tool for managing inline review comments embedded in source code *)(* Copyright (C) 2024-2026 Mathieu Barbin <mathieu.barbin@gmail.com> *)(* *)(* This file is part of crs. *)(* *)(* crs is free software; you can redistribute it and/or modify it under the *)(* terms of the GNU Lesser General Public License as published by the Free *)(* Software Foundation either version 3 of the License, or any later version, *)(* with the LGPL-3.0 Linking Exception. *)(* *)(* crs is distributed in the hope that it will be useful, but WITHOUT ANY *)(* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS *)(* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License and *)(* the file `NOTICE.md` at the root of this repository for more details. *)(* *)(* You should have received a copy of the GNU Lesser General Public License *)(* and the LGPL-3.0 Linking Exception along with this library. If not, see *)(* <http://www.gnu.org/licenses/> and <https://spdx.org>, respectively. *)(********************************************************************************)includeDynletinline_recordconsfields=Dyn.variantcons[Dyn.recordfields]moduletypeStringable_S=sigtypetvalto_string:t->stringendletstringable(typea)(moduleM:Stringable_Swithtypet=a)(a:a)=Dyn.string(M.to_stringa);;letto_sexp=letmoduleSexp=Sexplib0.SexpinletmoduleS=Sexplib0.Sexp_convinletrecaux(dyn:Dyn.t):Sexp.t=match[@coverageoff]dynwith|Opaque->Atom"<opaque>"|Unit->List[]|Inti->S.sexp_of_inti|Int32i->S.sexp_of_int32i|Recordfields->List(List.map(fun(field,t)->Sexp.List[Atomfield;auxt])fields)|Variant(v,args)->(* Special pretty print of variants holding records. *)(matchargswith|[]->Atomv|[Recordfields]->List(Atomv::List.map(fun(field,t)->Sexp.List[Atomfield;auxt])fields)|_->List(Atomv::List.mapauxargs))|Boolb->S.sexp_of_boolb|Stringa->S.sexp_of_stringa|Bytesa->S.sexp_of_bytesa|Int64i->S.sexp_of_int64i|Nativeinti->S.sexp_of_nativeinti|Charc->S.sexp_of_charc|Floatf->S.sexp_of_floatf|Optiono->S.sexp_of_optionauxo|Listl->S.sexp_of_listauxl|Arraya->S.sexp_of_arrayauxa|Tuplet->List(List.mapauxt)|Mapm->List(List.map(fun(k,v)->Sexp.List[auxk;auxv])m)|Sets->List(List.mapauxs)inaux;;