Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file checks.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174openActions_argumentsmoduleUnknown_attributes=structmoduleSSet=Set.Make(String)letall_actions=List.map(fun(moduleA:Actions_arguments.S)->A.on)Actions_arguments.all_actions|>SSet.of_listletall_special=Special_attrs.all_attrs|>SSet.of_listletall_attributes=["accept";"accept-charset";"accesskey";"action";"align";"allow";"alpha";"alt";"as";"async";"autocapitalize";"autocomplete";"autoplay";"background";"bgcolor";"border";"capture";"charset";"checked";"cite";"class";"color";"colorspace";"cols";"colspan";"content";"contenteditable";"controls";"coords";"crossorigin";"csp";"data";"datetime";"decoding";"default";"defer";"dir";"dirname";"disabled";"download";"draggable";"enctype";"enterkeyhint";"elementtiming";"fetchpriority";"for";"form";"formaction";"formenctype";"formmethod";"formnovalidate";"formtarget";"headers";"height";"hidden";"high";"href";"hreflang";"http-equiv";"id";"integrity";"inputmode";"ismap";"itemprop";"kind";"label";"lang";"language";"loading";"list";"loop";"low";"max";"maxlength";"minlength";"media";"method";"min";"multiple";"muted";"name";"novalidate";"open";"optimum";"pattern";"ping";"placeholder";"playsinline";"poster";"preload";"readonly";"referrerpolicy";"rel";"required";"reversed";"role";"rows";"rowspan";"sandbox";"scope";"selected";"shape";"size";"sizes";"slot";"span";"spellcheck";"src";"srcdoc";"srclang";"srcset";"start";"step";"style";"summary";"tabindex";"target";"title";"translate";"type";"usemap";"value";"width";"wrap"]|>SSet.of_list[@@ocamlformat"disable"]letcheck_attributekeyloc=ifSSet.memkeyall_actionsthen()elseifSSet.memkeyall_specialthen()elseifSSet.memkeyall_attributesthen()elseifString.starts_with~prefix:"data-"keythen()elseifString.starts_with~prefix:"children:"keythen()elseDiagnosis.add(UnknownAttribute{attr=key;loc})letno_unknown_attributes(attrs,_)=letkv=Cmarkit.Attributes.kv_attributesattrsinList.iter(fun((key,meta),_value)->check_attributekey(Cmarkit.Meta.textlocmeta))kvendmoduleIs=structletnot(f,e)=((funx->not(fx)),"not "^e)let(|||)(f1,e1)(f2,e2)=((funx->f1x||f2x),e1^" or "^e2)letslip(bol:Ast.Bol.t)=matchbolwith`Block(Ast.S_block(Slip_))->true|_->falseletslip=(slip,"slip")letslide(bol:Ast.Bol.t)=matchbolwith`Block(Ast.S_block(Slide_))->true|_->falseletslide=(slide,"slide")letcarousel(bol:Ast.Bol.t)=matchbolwith`Block(Ast.S_block(Carousel_))->true|_->falseletcarousel=(carousel,"carousel")letpdf(bol:Ast.Bol.t)=matchbolwith`Inline(Ast.S_inline(Pdf_))->true|_->falseletpdf=(pdf,"pdf")letvideo(bol:Ast.Bol.t)=matchbolwith`Inline(Ast.S_inline(Video_))->true|_->falseletvideo=(video,"video")letaudio(bol:Ast.Bol.t)=matchbolwith`Inline(Ast.S_inline(Audio_))->true|_->falseletaudio=(audio,"audio")letplayable_media=video|||audioletslip_script(bol:Ast.Bol.t)=matchbolwith`Block(Ast.S_block(SlipScript_))->true|_->falseletslip_script=(slip_script,"slip-script")letdraw(bol:Ast.Bol.t)=matchbolwith`Inline(Ast.S_inline(Hand_drawn_))->true|_->falseletdraw=(draw,"drawing")letany=((fun_->true),"anything")endletget_id(id_map:Id_map.t)val_loc(id,loc)=letloc=Diagnosis.loc_of_plocval_loclocinmatchId_map.SMap.find_optidid_mapwith|None->Diagnosis.add@@MissingID{id;loc};(id_map,None)|Someentry->let{Id_map.elem=bol;_}=Id_map.Unionable_set.getentry.definitioninletid_map=Id_map.SMap.addid{entrywithusage=loc::entry.usage}id_mapin(id_map,Some(bol,Someloc))lettargets(is,expected_type)id_map~args~val_locbol=lettargets,id_map=matchargswith|`Self->([((bol:Ast.Bol.t:>[Ast.Bol.t|`External]),None)],id_map)|`Idsids->List.fold_left(fun(targets,id_map)target->matchget_idid_mapval_loctargetwith|id_map,None->(targets,id_map)|id_map,Sometarget->(target::targets,id_map))([],id_map)idsinlettargets=List.revtargetsinList.iter(fun(bol,id_loc)->matchbolwith|#Ast.Bol.tasbol->ifnot(isbol)thenletloc_block=Ast.Bol.text_locbolinletloc_reason=Option.valueid_loc~default:(Ast.Bol.text_locbol)inDiagnosis.add@@WrongType{loc_reason;loc_block;expected_type}|`External->())targets;id_maplettargetisid_map~args~val_locbol=letargs=matchargswith`Self->`Self|`Idid->`Ids[id]intargetsisid_map~args~val_locbolletwith_targetextract_target=funisid_map~args~val_locbol->letargs=extract_targetargsintargetisid_map~args~val_locbolletwith_targetsextract_targets=funisid_map~args~val_locbol->letargs=extract_targetsargsintargetsisid_map~args~val_locbolletno_constraintid_map~args:_~val_loc:__bol=id_mapletbol_target=targetIs.(notslip_script)letbol_targets=targetsIs.(notslip_script)letwith_bol_targetextract=with_targetextractIs.(notslip_script)letwith_bol_targetsextract=with_targetsextractIs.(notslip_script)(* The action checks *)letexec=targetsIs.slip_scriptletenter=with_target(funargs->args.Enter.target)Is.(slip|||slide)letmove=with_bol_targetletup=move(funargs->args.Up.target)letdown=move(funargs->args.Down.target)letcenter=move(funargs->args.Center.target)letscroll=move(funargs->args.Scroll.target)letfocus=with_bol_targets(funargs->args.Focus.target)letunfocus=no_constraintletset_class=bol_targetsletunstatic=set_classletstatic=set_classletreveal=set_classletunreveal=set_classletemph=set_classletunemph=set_classletspeaker_note=bol_targetletplay_media=targetsIs.playable_medialetchange_pageid_map~args~val_locbol=List.fold_left(funid_map(arg:Actions_arguments.Change_page.arg)->targetIs.(carousel|||pdf)id_map~args:arg.target~val_locbol)id_mapargsletdraw=targetsIs.drawletclear=targetsIs.drawletpause=targetsIs.anyletstep=no_constraint