123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110(** Standard library for ppx rewriters *)(** [ppxlib] is meant to be opened globally in your PPX source files.
Opening it comes with two advantages. First, it will shadow the
[compiler-libs] modules. The [compiler-libs] modules are unstable and aren't
meant to be used, so shadowing them is a good protection mechanism. In case
you don't want to open [Ppxlib], you can open [Ocaml_shadow] to get the same
protection. Second, it will bring several modules in scope, that are useful
to have when writing a rewriter:
- The main [ppxlib] modules, such as modules to help manipulate the AST
({!Ast_builder}, {!Ast_pattern}), and a few functions.
- Modules from other libraries, such as {!Ast_helper} or {!Pprintast},
- The whole AST types (by [including] the {!Ast} module).
{1 The core [ppxlib] entries} *)(** {2 Manipulating the AST} *)moduleAst_builder=Ast_buildermoduleAst_pattern=Ast_patternmoduleAst_traverse=Ast_traverse(** {2 Context-free rewriting} *)moduleContext_free=Context_freemoduleDeriving=DerivingmoduleExtension=ExtensionmoduleExpansion_context=Expansion_contextmoduleCode_path=Code_path(** {2 Other helpers} *)moduleExpansion_helpers=Expansion_helpersmoduleMerlin_helpers=Merlin_helpersmoduleSpellcheck=SpellcheckmoduleKeyword=Keyword(** {2 Driver-related modules} *)moduleDriver=DrivermoduleCaller_id=Caller_idmoduleAst_io=Utils.Ast_io.Read_bin(** {2 Checks} *)moduleAttribute=AttributemoduleReserved_namespaces=Name.Reserved_namespaces(** {2 Common helper functions} *)includeCommon(** {1 Modules from other libraries}
Expose some modules from {!Ppxlib_ast}. *)moduleAst=Ppxlib_ast.AstmoduleAst_helper=Ppxlib_ast.Ast_helpermoduleAsttypes=Ppxlib_ast.AsttypesmoduleParse=Ppxlib_ast.ParsemoduleParsetree=Ppxlib_ast.ParsetreemodulePprintast=Ppxlib_ast.PprintastmoduleSelected_ast=Ppxlib_ast.Selected_astmoduleLocation=LocationmoduleLongident=LongidentmoduleLoc=Loc(** {1 The whole AST types} *)includeAst(** Include all the Ast definitions since we need them in every single ppx
@closed *)(** Make sure code using Ppxlib doesn't refer to compiler-libs without being
explicit about it:
@closed *)includestruct[@@@warning"-3"]openOcaml_shadowinclude(Ocaml_shadow:moduletypeofstructincludeOcaml_shadowendwithmoduleAst_helper:=Ast_helperwithmoduleAsttypes:=AsttypeswithmoduleDocstrings:=DocstringswithmoduleIdentifiable:=IdentifiablewithmoduleLexer:=LexerwithmoduleLocation:=LocationwithmoduleLongident:=LongidentwithmoduleParse:=ParsewithmoduleParsetree:=ParsetreewithmodulePprintast:=PprintastwithmoduleSyntaxerr:=Syntaxerr)end(**/**)(* For tests and Ppx_core compatibility layer *)modulePpxlib_private=structmoduleCommon=CommonmoduleName=Nameend