12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273openYojson.SafemoduleResult=Ppx_deriving_yojson_runtime.Result(* JSON-query has the following form:
select: ...
type: ...
target: ...
find: ...
structure: ...
constraint: ... *)typeselectable=|Name_sel[@name"name"]|Location_sel[@name"location"][@to_yojsonfunx->`Stringx]|Type_sel[@name"type"][@to_yojsonfunx->`Stringx]|ID_sel[@name"id"][@to_yojsonfunx->`Stringx][@@derivingyojson]typeselect=selectablelist[@@derivingyojson]typekind=|Var_k[@name"var"]|Fun_k[@name"fun"]|Datatype_k[@name"datatype"][@@derivingyojson]typetarget=|Name_tofstring[@name"name"]|ID_tofint[@name"id"]|All_t[@name"all"]|AllGlobVar_t[@name"all_glob_var"]|Or_tofstringlist[@name"or"]|And_tofstringlist[@name"and"][@@derivingyojson]typefind=|Uses_f[@name"uses"]|Decl_f[@name"decl"]|Defs_f[@name"defs"]|UsesWithVar_fofstring[@name"uses_with_var"]|Returns_f[@name"returns"][@@derivingyojson]typestructure=|Fun_sofstring[@name"fun_name"]|Cond_s[@name"cond"]|NonCond_s[@name"non-cond"]|None_s[@name"none"][@@derivingyojson]typeconstr=Constraint_cofstring[@name"constr"]|None_c[@name"none"][@@derivingyojson](* Type-definition of a query for mapping use *)typequery={sel:select;[@key"select"]k:kind;[@key"type"]tar:target;[@key"target"]f:find;[@key"find"]str:(structure[@defaultNone_s]);[@key"structure"]lim:(constr[@defaultNone_c]);[@key"constraint"]}[@@derivingyojson](* toString-function for query *)letto_string_qquery=Yojson.Safe.to_string(query_to_yojsonquery)exceptionErrorofstringletparse_json_filefilename=letjsonTree=from_filefilenameinletderived=query_of_yojsonjsonTreeinmatchderivedwithResult.Oky->y|Result.Errorx->raise(Errorx)