1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465openStdunetypet=Aofstring[@@unboxed]letto_dyn(As)=letopenDyn.Encoderinconstr"A"[strings]letequal(Aa)(Ab)=String.equalabletis_valid_dune=letrecloopsilen=i=len||matchString.unsafe_getsiwith|'%'->after_percents(i+1)len|'"'|'('|')'|';'|'\000'..'\032'|'\127'..'\255'->false|_->loops(i+1)lenandafter_percentsilen=i=len||matchString.unsafe_getsiwith|'%'->after_percents(i+1)len|'"'|'('|')'|';'|'\000'..'\032'|'\127'..'\255'|'{'->false|_->loops(i+1)leninfuns->letlen=String.lengthsinlen>0&&loops0lenletis_valid_jbuildstr=letlen=String.lengthstrinlen>0&&letrecloopix=matchstr.[ix]with|'"'|'('|')'|';'->true|'|'->ix>0&&letnext=ix-1instr.[next]='#'||loopnext|'#'->ix>0&&letnext=ix-1instr.[next]='|'||loopnext|' '|'\t'|'\n'|'\012'|'\r'->true|_->ix>0&&loop(ix-1)innot(loop(len-1))letof_strings=Asletto_string(As)=sletis_valid(At)=function|File_syntax.Jbuild->is_valid_jbuildt|Dune->is_valid_dunetletprint((Aatom)ast)syntax=ifis_validtsyntaxthenatomelsematchsyntaxwith|Jbuild->Code_error.raise"atom cannot be printed in jbuild syntax"["atom",Stringatom]|Dune->Code_error.raise"atom cannot be printed in dune syntax"["atom",Stringatom]letof_inti=of_string(string_of_inti)letof_floatx=of_string(string_of_floatx)letof_boolx=of_string(string_of_boolx)letof_digestd=of_string(Digest.to_stringd)letof_int64i=of_string(Int64.to_stringi)