Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file ppx_shared.ml
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768openBaseopenPpxlibtypeli=longidentletstring_expr~locs=Ast_helper.Exp.constant@@Pconst_string(s,loc,None)letpat2stringpat=letreclident=functionLidents|Ldot(_,s)->s|Lapply(_,i)->lidentiinletreclooppat=matchpat.ppat_descwith|Ppat_open(_,pat)|Ppat_lazypat|Ppat_constraint(pat,_)->looppat|Ppat_alias(_,ident)->ident.txt|Ppat_varident->ident.txt|Ppat_any->"_"|Ppat_variant(s,_)|Ppat_constant(Pconst_string(s,_,_))|Ppat_constant(Pconst_integer(s,_))|Ppat_constant(Pconst_float(s,_))->s|Ppat_constant(Pconst_charc)->Char.to_stringc|Ppat_tuplepats->"("^String.concat~sep:", "(List.map~f:looppats)^")"|Ppat_arraypats->"[|"^String.concat~sep:", "(List.map~f:looppats)^"|]"|Ppat_construct(c,_)->lidentc.txt|Ppat_interval(_,_)|Ppat_record(_,_)|Ppat_or(_,_)|Ppat_type_|Ppat_unpack_|Ppat_exception_|Ppat_extension_->""instring_expr~loc:pat.ppat_loc@@looppatletopt_pat2string~loc=functionNone->[%exprNone]|Somepat->[%exprSome[%epat2stringpat]]letopt_pat2string_list~loc=functionNone->[%expr[]]|Somepat->[%expr[[%epat2stringpat]]]letopt_expr~loc=functionNone->[%exprNone]|Someexpr->[%exprSome[%eexpr]]letrecpat2exprpat=letmoduleAst=Ast_builder.Defaultinletloc=pat.ppat_locinmatchpat.ppat_descwith|Ppat_constraint(pat',typ)->Ast.pexp_constraint~loc(pat2exprpat')typ|Ppat_alias(_,ident)|Ppat_varident->Ast.pexp_ident~loc{identwithtxt=Lidentident.txt}|Ppat_variant(ident,e_opt)->Ast.pexp_variant~locident@@Option.mape_opt~f:pat2expr|Ppat_constantc->Ast.pexp_constant~locc|Ppat_construct(c,None)->Ast.pexp_construct~loccNone|Ppat_construct(c,Some([],args))->Ast.pexp_construct~locc@@Some(pat2exprargs)|Ppat_record(fields,Asttypes.Closed)->Ast.pexp_record~loc(List.mapfields~f:(fun(label,field)->(label,pat2exprfield)))None|Ppat_tuplepats->Ast.pexp_tuple~loc@@List.mappats~f:pat2expr|Ppat_arraypats->Ast.pexp_array~loc@@List.mappats~f:pat2expr|_->Ast.pexp_extension~loc@@Location.error_extensionf~loc"ppx_ocannl does not recognize/support the pattern; maybe try using an `as` alias."letalphanum_regexp=Str.regexp"^[^a-zA-Z0-9]+$"letis_operatorident=Str.string_matchalphanum_regexpident0letis_assignmentident=String.lengthident>1&&Char.equalident.[0]'='&&(not@@List.mem["==";"===";"=>";"==>";"=>>"]ident~equal:String.equal)letlet_opt~locvbsexpr=ifMap.is_emptyvbsthenexprelseAst_helper.Exp.let_~locNonrecursive(Map.datavbs)exprletno_vbs=Map.empty(moduleString)letreduce_vbss=List.reduce_exn~f:(Map.merge_skewed~combine:(fun~key:__v1v2->v2))