Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file ast_helpers.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195(*****************************************************************************)(* Open Source License *)(* Copyright (c) 2021 Valentin Chaboche *)(* Copyright (c) 2021 Nomadic Labs, <contact@nomadic-labs.com> *)(* *)(* Permission is hereby granted, free of charge, to any person obtaining a *)(* copy of this software and associated documentation files (the "Software"),*)(* to deal in the Software without restriction, including without limitation *)(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)(* and/or sell copies of the Software, and to permit persons to whom the *)(* Software is furnished to do so, subject to the following conditions: *)(* *)(* The above copyright notice and this permission notice shall be included *)(* in all copies or substantial portions of the Software. *)(* *)(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)(* DEALINGS IN THE SOFTWARE. *)(* *)(*****************************************************************************)openPpxlib(* Module providing default values in order to build Ppxlib.Ast *)moduleDefault=structletloc_stack=functionSomex->x|None->[]letattributes=functionSomex->x|None->[]letloc=functionSomex->x|None->Location.noneletdefault_pat={ppat_desc=Ppat_any;ppat_loc=locNone;ppat_loc_stack=loc_stackNone;ppat_attributes=attributesNone;}letpat=functionSomex->x|None->default_patletflag=functionSomex->x|None->Nonrecursiveletbindings=functionSomex->x|None->[]endmoduleExpression=structletexpression?loc?loc_stack?attributesdesc=letloc_stack=Default.loc_stackloc_stackinletattributes=Default.attributesattributesinletloc=Default.loclocin{pexp_desc=desc;pexp_loc=loc;pexp_loc_stack=loc_stack;pexp_attributes=attributes;}letunit?loc()=letloc=Default.loclocin[%expr()]letpexp_let?loc?loc_stack?attributes?flag?bindingsexp=letflag=Default.flagflaginletbindings=Default.bindingsbindingsinexpression?loc?loc_stack?attributes@@Pexp_let(flag,bindings,exp)letpexp_string?loc?loc_stack?attributesstr=letdefault_loc=Default.loclocinexpression?loc?loc_stack?attributes(Pexp_constant(Pconst_string(str,default_loc,None)))letpexp_list?locxs=letloc=Default.loclocinletrecauxloc=function|[]->[%expr[]]|x::xs->[%expr[%ex]::[%eauxlocxs]]inauxlocxsletpexp_apply?loc?loc_stack?attributes~f~args()=expression?loc?loc_stack?attributes@@Pexp_apply(f,args)letpexp_tuple?loc?loc_stack?attributes=function|[x]->x|xs->expression?loc?loc_stack?attributes@@Pexp_tuplexsletpexp_construct?loc?loc_stack?attributes~kname~kargs()=expression?loc?loc_stack?attributes@@Pexp_construct(kname,kargs)letpexp_ident?loc?loc_stack?attributesx=expression?loc?loc_stack?attributes@@Pexp_identxletpexp_lident?loc?loc_stack?attributesx=letloc'=Default.loclocinexpression?loc?loc_stack?attributes@@Pexp_ident{txt=Lidentx;loc=loc'}letpexp_record?loc?loc_stack?attributes~fieldsx=expression?loc?loc_stack?attributes@@Pexp_record(fields,x)letpexp_variant?loc?loc_stack?attributes~labelx=expression?loc?loc_stack?attributes@@Pexp_variant(label,x)letpexp_constraint?loc?loc_stack?attributesect=expression?loc?loc_stack?attributes@@Pexp_constraint(e,ct)endmoduleType=structletcore_type?loc?loc_stack?attributesdesc=letloc_stack=Default.loc_stackloc_stackinletattributes=Default.attributesattributesinletloc=Default.loclocin{ptyp_desc=desc;ptyp_loc=loc;ptyp_loc_stack=loc_stack;ptyp_attributes=attributes;}letconstr_one?loc?loc_stack?attributesxy=letloc'=Default.loclocinletx_lgloc={loc=loc';txt=x}inlety_lgloc={loc=loc';txt=y}inlety=core_type?loc?loc_stack?attributes@@Ptyp_constr(y_lgloc,[])incore_type?loc?loc_stack?attributes@@Ptyp_constr(x_lgloc,[y])endmodulePattern=structletpattern?loc?loc_stack?attributesdesc=letloc_stack=Default.loc_stackloc_stackinletattributes=Default.attributesattributesinletloc=Default.loclocin{ppat_desc=desc;ppat_loc=loc;ppat_loc_stack=loc_stack;ppat_attributes=attributes;}letppat_var?loc?loc_stack?attributess=letdefault_loc=Default.loclocinpattern?loc?loc_stack?attributes@@Ppat_var{txt=s;loc=default_loc}letppat_any?loc()=pattern?loc@@Ppat_anyletextract_pat_name_optpat=matchpat.ppat_descwithPpat_var{txt=s;_}->Somes|_->Noneletextract_pat_name_exn~locpat=matchextract_pat_name_optpatwith|Somes->s|None->Error.case_unsupported~loc~case:"Could not extract pattern name"()endmoduleStructure=structletvalue_binding?loc?pat?attributesexpr=letpat=Default.patpatinletattributes=Default.attributesattributesinletloc=Default.loclocin{pvb_pat=pat;pvb_expr=expr;pvb_attributes=attributes;pvb_loc=loc;}letstructure_item?locx=letloc=Default.loclocin{pstr_desc=x;pstr_loc=loc}letstr_include?locxs=letloc'=Default.loclocinletinclude_infosx={pincl_mod=x;pincl_loc=loc';pincl_attributes=[]}inletx={pmod_desc=Pmod_structurexs;pmod_loc=loc';pmod_attributes=[]}instructure_item?loc@@Pstr_include(include_infosx)end