1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980open!BaseopenPpxlibmoduleDefinitions=struct(** Used to configure different instances of this ppx. May be used, for example, to add
preprocessing, or to interpolate a different string-like type. *)moduleConfig=structtypet={fully_qualified_runtime_module:Longident.t(** Where to find an implementation of [Ppx_string_runtime.S]. The implementation of
[[%string]] is at [Ldot (Lident "Ppx_string_runtime", "For_string")] *);conversion_function_name:string(** Conversion function implied by ["%{expr#Module}"], e.g. ["to_string"]. *);preprocess_before_parsing:(string->string)option(** Preprocessing to apply before parsing the string for interpolation. If [None],
source locations can be computed precisely based on the result of parsing. *)}endmodulePart=structmoduleInterpreted=structtypet={loc_start:position;value:expression;module_path:longident_locoption;pad_length:expressionoption;loc_end:position;interpreted_string:string(** [interpreted_string] is the string of the interpreted part. (e.g. in the
example %{foo#Foo}, the string is "foo#Foo") *)}endtypet=|Literalofstringloc|InterpretedofInterpreted.tendmoduleParse_result=structtypet={parts:Part.tlist;locations_are_precise:bool}endendmoduletypePpx_string=sigincludemoduletypeofstructincludeDefinitionsend(** Parse a string to find interpolated substrings. *)valparse:config:Config.t->string_loc:location->delimiter:stringoption->string->Parse_result.t(** Interpret an interpolated string as an expression, including %{conversions#String}
and %{padding#:8}. *)valinterpret:config:Config.t->Part.Interpreted.t->expression(** Combines [parse], [interpret], and concatenation to expand an interpolated string to
an expression implementing it. *)valexpand:config:Config.t->expr_loc:location->string_loc:location->string:string->delimiter:stringoption->expression(** Construct an [Extension.t] implementing the configured interpolation ppx. *)valextension:name:string->config:Config.t->Extension.t(** Configuration for [[%string]]: string type and conversion type are [string], length
type is [int], and no preprocessing. *)valconfig_for_string:Config.tend