1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123# 1 "vendor/parser-extended/parsetree.mli"(**************************************************************************)(* *)(* OCaml *)(* *)(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)(* *)(* Copyright 1996 Institut National de Recherche en Informatique et *)(* en Automatique. *)(* *)(* All rights reserved. This file is distributed under the terms of *)(* the GNU Lesser General Public License version 2.1, with the *)(* special exception on linking described in the file LICENSE. *)(* *)(**************************************************************************)(** Abstract syntax tree produced by parsing
{b Warning:} this module is unstable and part of
{{!Compiler_libs}compiler-libs}.
*)openAsttypestypeconstant_desc=|Pconst_integerofstring*charoption(** Integer constants such as [3] [3l] [3L] [3n].
Suffixes [[g-z][G-Z]] are accepted by the parser.
Suffixes except ['l'], ['L'] and ['n'] are rejected by the typechecker
*)|Pconst_charofchar*string(** [Pconst_char (c, s)] describes a character [c] and its literal string representation [s].
e.g. the character ['\n'] is represented by the literal string ["\\n"]. *)|Pconst_stringofstring*Location.t*stringoption(** Constant string such as ["constant"] or
[{delim|other constant|delim}].
The location span the content of the string, without the delimiters.
*)|Pconst_floatofstring*charoption(** Float constant such as [3.4], [2e5] or [1.4e-4].
Suffixes [g-z][G-Z] are accepted by the parser.
Suffixes are rejected by the typechecker.
*)typeconstant={pconst_desc:constant_desc;pconst_loc:Location.t;}typelocation_stack=Location.tlist(** {1 Extension points} *)typeattribute={attr_name:stringloc;attr_payload:payload;attr_loc:Location.t;}(** Attributes such as [[\@id ARG]] and [[\@\@id ARG]].
Metadata containers passed around within the AST.
The compiler ignores unknown attributes.
*)andextension=stringloc*payload(** Extension points such as [[%id ARG] and [%%id ARG]].
Sub-language placeholder -- rejected by the typechecker.
*)andattributes=attributelistandpayload=|PStrofstructure|PSigofsignature(** [: SIG] in an attribute or an extension point *)|PTypofcore_type(** [: T] in an attribute or an extension point *)|PPatofpattern*expressionoption(** [? P] or [? P when E], in an attribute or an extension point *)(** {1 Core language} *)(** {2 Type expressions} *)andcore_type={ptyp_desc:core_type_desc;ptyp_loc:Location.t;ptyp_loc_stack:location_stack;ptyp_attributes:attributes;(** [... [\@id1] [\@id2]] *)}andarrow_param={pap_label:arg_label;pap_loc:Location.t;(** Location also including the codomain. *)pap_type:core_type;}andcore_type_desc=|Ptyp_any(** [_] *)|Ptyp_varofstring(** A type variable such as ['a] *)|Ptyp_arrowofarrow_paramlist*core_type(** [Ptyp_arrow(lbl, T1, T2)] represents:
- [T1 -> T2] when [lbl] is
{{!Asttypes.arg_label.Nolabel}[Nolabel]},
- [~l:T1 -> T2] when [lbl] is
{{!Asttypes.arg_label.Labelled}[Labelled]},
- [?l:T1 -> T2] when [lbl] is
{{!Asttypes.arg_label.Optional}[Optional]}.
*)|Ptyp_tupleofcore_typelist(** [Ptyp_tuple([T1 ; ... ; Tn])]
represents a product type [T1 * ... * Tn].
Invariant: [n >= 2].
*)|Ptyp_constrofLongident.tloc*core_typelist(** [Ptyp_constr(lident, l)] represents:
- [tconstr] when [l=[]],
- [T tconstr] when [l=[T]],
- [(T1, ..., Tn) tconstr] when [l=[T1 ; ... ; Tn]].
*)|Ptyp_objectofobject_fieldlist*obj_closed_flag(** [Ptyp_object([ l1:T1; ...; ln:Tn ], flag)] represents:
- [< l1:T1; ...; ln:Tn >] when [flag] is
{{!Asttypes.closed_flag.Closed}[Closed]},
- [< l1:T1; ...; ln:Tn; .. >] when [flag] is
{{!Asttypes.closed_flag.Open}[Open]}.
*)|Ptyp_classofLongident.tloc*core_typelist(** [Ptyp_class(tconstr, l)] represents:
- [#tconstr] when [l=[]],
- [T #tconstr] when [l=[T]],
- [(T1, ..., Tn) #tconstr] when [l=[T1 ; ... ; Tn]].
*)|Ptyp_aliasofcore_type*stringloc(** [T as 'a]. *)|Ptyp_variantofrow_fieldlist*closed_flag*variant_varlistoption(** [Ptyp_variant([`A;`B], flag, labels)] represents:
- [[ `A|`B ]]
when [flag] is {{!Asttypes.closed_flag.Closed}[Closed]},
and [labels] is [None],
- [[> `A|`B ]]
when [flag] is {{!Asttypes.closed_flag.Open}[Open]},
and [labels] is [None],
- [[< `A|`B ]]
when [flag] is {{!Asttypes.closed_flag.Closed}[Closed]},
and [labels] is [Some []],
- [[< `A|`B > `X `Y ]]
when [flag] is {{!Asttypes.closed_flag.Closed}[Closed]},
and [labels] is [Some ["X";"Y"]].
*)|Ptyp_polyofstringloclist*core_type(** ['a1 ... 'an. T]
Can only appear in the following context:
- As the {!core_type} of a
{{!pattern_desc.Ppat_constraint}[Ppat_constraint]} node corresponding
to a constraint on a let-binding:
{[let x : 'a1 ... 'an. T = e ...]}
- Under {{!class_field_kind.Cfk_virtual}[Cfk_virtual]} for methods
(not values).
- As the {!core_type} of a
{{!class_type_field_desc.Pctf_method}[Pctf_method]} node.
- As the {!core_type} of a {{!expression_desc.Pexp_poly}[Pexp_poly]}
node.
- As the {{!label_declaration.pld_type}[pld_type]} field of a
{!label_declaration}.
- As a {!core_type} of a {{!core_type_desc.Ptyp_object}[Ptyp_object]}
node.
- As the {{!value_description.pval_type}[pval_type]} field of a
{!value_description}.
*)|Ptyp_packageofpackage_type(** [(module S)]. *)|Ptyp_extensionofextension(** [[%id]]. *)andpackage_type=Longident.tloc*(Longident.tloc*core_type)list(** As {!package_type} typed values:
- [(S, [])] represents [(module S)],
- [(S, [(t1, T1) ; ... ; (tn, Tn)])]
represents [(module S with type t1 = T1 and ... and tn = Tn)].
*)androw_field={prf_desc:row_field_desc;prf_loc:Location.t;prf_attributes:attributes;}androw_field_desc=|Rtagofvariant_var*bool*core_typelist(** [Rtag(`A, b, l)] represents:
- [`A] when [b] is [true] and [l] is [[]],
- [`A of T] when [b] is [false] and [l] is [[T]],
- [`A of T1 & .. & Tn] when [b] is [false] and [l] is [[T1;...Tn]],
- [`A of & T1 & .. & Tn] when [b] is [true] and [l] is [[T1;...Tn]].
- The [bool] field is true if the tag contains a
constant (empty) constructor.
- [&] occurs when several types are used for the same constructor
(see 4.2 in the manual)
*)|Rinheritofcore_type(** [[ | t ]] *)andobject_field={pof_desc:object_field_desc;pof_loc:Location.t;pof_attributes:attributes;}andobject_field_desc=|Otagoflabelloc*core_type|Oinheritofcore_type(** {2 Patterns} *)andpattern={ppat_desc:pattern_desc;ppat_loc:Location.t;ppat_loc_stack:location_stack;ppat_attributes:attributes;(** [... [\@id1] [\@id2]] *)}andpattern_desc=|Ppat_any(** The pattern [_]. *)|Ppat_varofstringloc(** A variable pattern such as [x] *)|Ppat_aliasofpattern*stringloc(** An alias pattern such as [P as 'a] *)|Ppat_constantofconstant(** Patterns such as [1], ['a'], ["true"], [1.0], [1l], [1L], [1n] *)|Ppat_intervalofconstant*constant(** Patterns such as ['a'..'z'].
Other forms of interval are recognized by the parser
but rejected by the type-checker. *)|Ppat_tupleofpatternlist(** Patterns [(P1, ..., Pn)].
Invariant: [n >= 2]
*)|Ppat_constructofLongident.tloc*(stringloclist*pattern)option(** [Ppat_construct(C, args)] represents:
- [C] when [args] is [None],
- [C P] when [args] is [Some ([], P)]
- [C (P1, ..., Pn)] when [args] is
[Some ([], Ppat_tuple [P1; ...; Pn])]
- [C (type a b) P] when [args] is [Some ([a; b], P)]
*)|Ppat_variantofvariant_var*patternoption(** [Ppat_variant(`A, pat)] represents:
- [`A] when [pat] is [None],
- [`A P] when [pat] is [Some P]
*)|Ppat_recordof(Longident.tloc*core_typeoption*patternoption)list*obj_closed_flag(** [Ppat_record([(l1, P1) ; ... ; (ln, Pn)], flag)] represents:
- [{ l1=P1; ...; ln=Pn }]
when [flag] is {{!Asttypes.closed_flag.Closed}[Closed]}
- [{ l1=P1; ...; ln=Pn; _}]
when [flag] is {{!Asttypes.closed_flag.Open}[Open]}
Invariant: [n > 0]
*)|Ppat_arrayofpatternlist(** Pattern [[| P1; ...; Pn |]] *)|Ppat_listofpatternlist(** Pattern [[ P1; ...; Pn ]] *)|Ppat_orofpatternlist(** Pattern [P1 | ... | Pn] *)|Ppat_constraintofpattern*core_type(** Pattern [(P : T)] *)|Ppat_typeofLongident.tloc(** Pattern [#tconst] *)|Ppat_lazyofpattern(** Pattern [lazy P] *)|Ppat_unpackofstringoptionloc*package_typeoption(** [Ppat_unpack(p, s)] represents:
- [(module P)] when [p] is [Some "P"] and [s] is [None]
- [(module _)] when [p] is [None] and [s] is [None]
- [(module P : S)] when [p] is [Some "P"] and [s] is [Some "S"]
- [(module _ : S)] when [p] is [None] and [s] is [Some "S"]
*)|Ppat_exceptionofpattern(** Pattern [exception P] *)|Ppat_extensionofextension(** Pattern [[%id]] *)|Ppat_openofLongident.tloc*pattern(** Pattern [M.(P)] *)|Ppat_consofpatternlist(** Pattern [P1 :: ... :: Pn] *)(** {2 Value expressions} *)andexpression={pexp_desc:expression_desc;pexp_loc:Location.t;pexp_loc_stack:location_stack;pexp_attributes:attributes;(** [... [\@id1] [\@id2]] *)}andexpression_desc=|Pexp_identofLongident.tloc(** Identifiers such as [x] and [M.x]
*)|Pexp_constantofconstant(** Expressions constant such as [1], ['a'], ["true"], [1.0], [1l],
[1L], [1n] *)|Pexp_letoflet_bindings*expression(** [Pexp_let(flag, [(P1,E1) ; ... ; (Pn,En)], E)] represents:
- [let P1 = E1 and ... and Pn = EN in E]
when [flag] is {{!Asttypes.rec_flag.Nonrecursive}[Nonrecursive]},
- [let rec P1 = E1 and ... and Pn = EN in E]
when [flag] is {{!Asttypes.rec_flag.Recursive}[Recursive]}.
*)|Pexp_functionofcaselist(** [function P1 -> E1 | ... | Pn -> En] *)|Pexp_funofarg_label*expressionoption*pattern*expression(** [Pexp_fun(lbl, exp0, P, E1)] represents:
- [fun P -> E1]
when [lbl] is {{!Asttypes.arg_label.Nolabel}[Nolabel]}
and [exp0] is [None]
- [fun ~l:P -> E1]
when [lbl] is {{!Asttypes.arg_label.Labelled}[Labelled l]}
and [exp0] is [None]
- [fun ?l:P -> E1]
when [lbl] is {{!Asttypes.arg_label.Optional}[Optional l]}
and [exp0] is [None]
- [fun ?l:(P = E0) -> E1]
when [lbl] is {{!Asttypes.arg_label.Optional}[Optional l]}
and [exp0] is [Some E0]
Notes:
- If [E0] is provided, only
{{!Asttypes.arg_label.Optional}[Optional]} is allowed.
- [fun P1 P2 .. Pn -> E1] is represented as nested
{{!expression_desc.Pexp_fun}[Pexp_fun]}.
- [let f P = E] is represented using
{{!expression_desc.Pexp_fun}[Pexp_fun]}.
*)|Pexp_applyofexpression*(arg_label*expression)list(** [Pexp_apply(E0, [(l1, E1) ; ... ; (ln, En)])]
represents [E0 ~l1:E1 ... ~ln:En]
[li] can be
{{!Asttypes.arg_label.Nolabel}[Nolabel]} (non labeled argument),
{{!Asttypes.arg_label.Labelled}[Labelled]} (labelled arguments) or
{{!Asttypes.arg_label.Optional}[Optional]} (optional argument).
Invariant: [n > 0]
*)|Pexp_matchofexpression*caselist(** [match E0 with P1 -> E1 | ... | Pn -> En] *)|Pexp_tryofexpression*caselist(** [try E0 with P1 -> E1 | ... | Pn -> En] *)|Pexp_tupleofexpressionlist(** Expressions [(E1, ..., En)]
Invariant: [n >= 2]
*)|Pexp_constructofLongident.tloc*expressionoption(** [Pexp_construct(C, exp)] represents:
- [C] when [exp] is [None],
- [C E] when [exp] is [Some E],
- [C (E1, ..., En)] when [exp] is [Some (Pexp_tuple[E1;...;En])]
*)|Pexp_variantofvariant_var*expressionoption(** [Pexp_variant(`A, exp)] represents
- [`A] when [exp] is [None]
- [`A E] when [exp] is [Some E]
*)|Pexp_recordof(Longident.tloc*(core_typeoption*core_typeoption)*expressionoption)list*expressionoption(** [Pexp_record([(l1,P1) ; ... ; (ln,Pn)], exp0)] represents
- [{ l1=P1; ...; ln=Pn }] when [exp0] is [None]
- [{ E0 with l1=P1; ...; ln=Pn }] when [exp0] is [Some E0]
Invariant: [n > 0]
*)|Pexp_fieldofexpression*Longident.tloc(** [E.l] *)|Pexp_setfieldofexpression*Longident.tloc*expression(** [E1.l <- E2] *)|Pexp_arrayofexpressionlist(** [[| E1; ...; En |]] *)|Pexp_listofexpressionlist(** [[ E1; ...; En ]] *)|Pexp_ifthenelseofif_branchlist*expressionoption(** [if E1 then E2 else E3] *)|Pexp_sequenceofexpression*expression(** [E1; E2] *)|Pexp_whileofexpression*expression(** [while E1 do E2 done] *)|Pexp_forofpattern*expression*expression*direction_flag*expression(** [Pexp_for(i, E1, E2, direction, E3)] represents:
- [for i = E1 to E2 do E3 done]
when [direction] is {{!Asttypes.direction_flag.Upto}[Upto]}
- [for i = E1 downto E2 do E3 done]
when [direction] is {{!Asttypes.direction_flag.Downto}[Downto]}
*)|Pexp_constraintofexpression*core_type(** [(E : T)] *)|Pexp_coerceofexpression*core_typeoption*core_type(** [Pexp_coerce(E, from, T)] represents
- [(E :> T)] when [from] is [None],
- [(E : T0 :> T)] when [from] is [Some T0].
*)|Pexp_sendofexpression*labelloc(** [E # m] *)|Pexp_newofLongident.tloc(** [new M.c] *)|Pexp_setinstvaroflabelloc*expression(** [x <- 2] *)|Pexp_overrideof(labelloc*expression)list(** [{< x1 = E1; ...; xn = En >}] *)|Pexp_letmoduleofstringoptionloc*functor_parameterloclist*module_expr*expression(** [let module M = ME in E] *)|Pexp_letexceptionofextension_constructor*expression(** [let exception C in E] *)|Pexp_assertofexpression(** [assert E].
Note: [assert false] is treated in a special way by the
type-checker. *)|Pexp_lazyofexpression(** [lazy E] *)|Pexp_polyofexpression*core_typeoption(** Used for method bodies.
Can only be used as the expression under
{{!class_field_kind.Cfk_concrete}[Cfk_concrete]} for methods (not
values). *)|Pexp_objectofclass_structure(** [object ... end] *)|Pexp_newtypeofstringloc*expression(** [fun (type t) -> E] *)|Pexp_packofmodule_expr*package_typeoption(** - [(module M)] is represented as [Pexp_pack(M, None)]
- [(module M : S)] is represented as [Pexp_pack(M, Some S)] *)|Pexp_openofLongident.tloc*expression(** [M.(E)] *)|Pexp_letopenofopen_declaration*expression(** - [let open M in E]
- [let open! M in E] *)|Pexp_letopofletop(** - [let* P = E0 in E1]
- [let* P0 = E00 and* P1 = E01 in E1] *)|Pexp_extensionofextension(** [[%id]] *)|Pexp_unreachable(** [.] *)|Pexp_hole(** [_] *)|Pexp_beginendofexpression(** [begin E end] *)|Pexp_parensofexpression(** [(E)] *)|Pexp_consofexpressionlist(** [E1 :: ... :: En] *)|Pexp_indexop_accessofindexop_access|Pexp_prefixofstringloc*expression(** [op E] *)|Pexp_infixofstringloc*expression*expression(** [E1 op E2] *)andindexop_access={pia_lhs:expression;pia_kind:indexop_access_kind;pia_paren:paren_kind;pia_rhs:expressionoption;}andindexop_access_kind=|Builtinofexpression(** [arr.(i)]
[arr.(i) <- e]
[str.[i]]
[str.[i] <- c]
[bar.{i1; i2; ..}]
[bar.{i1; i2; ..} <- e] *)|DotopofLongident.tlocoption*string*expressionlist(** [foo.Path.%{i1, i2, ..} <- e] *)andif_branch={if_cond:expression;if_body:expression;if_attrs:attributes;(** [... [\@id1] [\@id2]] *)}andcase={pc_lhs:pattern;pc_guard:expressionoption;pc_rhs:expression;}(** Values of type {!case} represents [(P -> E)] or [(P when E0 -> E)] *)andletop={let_:binding_op;ands:binding_oplist;body:expression;}andbinding_op={pbop_op:stringloc;pbop_pat:pattern;pbop_exp:expression;pbop_loc:Location.t;}(** {2 Value descriptions} *)andvalue_description={pval_name:stringloc;pval_type:core_type;pval_prim:stringloclist;pval_attributes:attributes;(** [... [\@\@id1] [\@\@id2]] *)pval_loc:Location.t;}(** Values of type {!value_description} represents:
- [val x: T],
when {{!value_description.pval_prim}[pval_prim]} is [[]]
- [external x: T = "s1" ... "sn"]
when {{!value_description.pval_prim}[pval_prim]} is [["s1";..."sn"]]
*)(** {2 Type declarations} *)andtype_declaration={ptype_name:stringloc;ptype_params:(core_type*variance_and_injectivity)list;(** [('a1,...'an) t] *)ptype_cstrs:(core_type*core_type*Location.t)list;(** [... constraint T1=T1' ... constraint Tn=Tn'] *)ptype_kind:type_kind;ptype_private:private_flag;(** for [= private ...] *)ptype_manifest:core_typeoption;(** represents [= T] *)ptype_attributes:attributes;(** [... [\@\@id1] [\@\@id2]] *)ptype_loc:Location.t;}(**
Here are type declarations and their representation,
for various {{!type_declaration.ptype_kind}[ptype_kind]}
and {{!type_declaration.ptype_manifest}[ptype_manifest]} values:
- [type t] when [type_kind] is {{!type_kind.Ptype_abstract}[Ptype_abstract]},
and [manifest] is [None],
- [type t = T0]
when [type_kind] is {{!type_kind.Ptype_abstract}[Ptype_abstract]},
and [manifest] is [Some T0],
- [type t = C of T | ...]
when [type_kind] is {{!type_kind.Ptype_variant}[Ptype_variant]},
and [manifest] is [None],
- [type t = T0 = C of T | ...]
when [type_kind] is {{!type_kind.Ptype_variant}[Ptype_variant]},
and [manifest] is [Some T0],
- [type t = {l: T; ...}]
when [type_kind] is {{!type_kind.Ptype_record}[Ptype_record]},
and [manifest] is [None],
- [type t = T0 = {l : T; ...}]
when [type_kind] is {{!type_kind.Ptype_record}[Ptype_record]},
and [manifest] is [Some T0],
- [type t = ..]
when [type_kind] is {{!type_kind.Ptype_open}[Ptype_open]},
and [manifest] is [None].
*)andtype_kind=|Ptype_abstract|Ptype_variantofconstructor_declarationlist|Ptype_recordoflabel_declarationlist(** Invariant: non-empty list *)|Ptype_openandlabel_declaration={pld_name:stringloc;pld_mutable:mutable_flag;pld_type:core_type;pld_loc:Location.t;pld_attributes:attributes;(** [l : T [\@id1] [\@id2]] *)}(**
- [{ ...; l: T; ... }]
when {{!label_declaration.pld_mutable}[pld_mutable]}
is {{!Asttypes.mutable_flag.Immutable}[Immutable]},
- [{ ...; mutable l: T; ... }]
when {{!label_declaration.pld_mutable}[pld_mutable]}
is {{!Asttypes.mutable_flag.Mutable}[Mutable]}.
Note: [T] can be a {{!core_type_desc.Ptyp_poly}[Ptyp_poly]}.
*)andconstructor_declaration={pcd_name:stringloc;pcd_vars:stringloclist;pcd_args:constructor_arguments;pcd_res:core_typeoption;pcd_loc:Location.t;pcd_attributes:attributes;(** [C of ... [\@id1] [\@id2]] *)}andconstructor_arguments=|Pcstr_tupleofcore_typelist|Pcstr_recordofLocation.t*label_declarationlist(** Values of type {!constructor_declaration}
represents the constructor arguments of:
- [C of T1 * ... * Tn] when [res = None],
and [args = Pcstr_tuple [T1; ... ; Tn]],
- [C: T0] when [res = Some T0],
and [args = Pcstr_tuple []],
- [C: T1 * ... * Tn -> T0] when [res = Some T0],
and [args = Pcstr_tuple [T1; ... ; Tn]],
- [C of {...}] when [res = None],
and [args = Pcstr_record [...]],
- [C: {...} -> T0] when [res = Some T0],
and [args = Pcstr_record [...]].
*)andtype_extension={ptyext_path:Longident.tloc;ptyext_params:(core_type*variance_and_injectivity)list;ptyext_constructors:extension_constructorlist;ptyext_private:private_flag;ptyext_loc:Location.t;ptyext_attributes:attributes;(** ... [\@\@id1] [\@\@id2] *)}(**
Definition of new extensions constructors for the extensive sum type [t]
([type t += ...]).
*)andextension_constructor={pext_name:stringloc;pext_kind:extension_constructor_kind;pext_loc:Location.t;pext_attributes:attributes;(** [C of ... [\@id1] [\@id2]] *)}andtype_exception={ptyexn_constructor:extension_constructor;ptyexn_loc:Location.t;ptyexn_attributes:attributes;(** [... [\@\@id1] [\@\@id2]] *)}(** Definition of a new exception ([exception E]). *)andextension_constructor_kind=|Pext_declofstringloclist*constructor_arguments*core_typeoption(** [Pext_decl(existentials, c_args, t_opt)]
describes a new extension constructor. It can be:
- [C of T1 * ... * Tn] when:
{ul {- [existentials] is [[]],}
{- [c_args] is [[T1; ...; Tn]],}
{- [t_opt] is [None]}.}
- [C: T0] when
{ul {- [existentials] is [[]],}
{- [c_args] is [[]],}
{- [t_opt] is [Some T0].}}
- [C: T1 * ... * Tn -> T0] when
{ul {- [existentials] is [[]],}
{- [c_args] is [[T1; ...; Tn]],}
{- [t_opt] is [Some T0].}}
- [C: 'a... . T1 * ... * Tn -> T0] when
{ul {- [existentials] is [['a;...]],}
{- [c_args] is [[T1; ... ; Tn]],}
{- [t_opt] is [Some T0].}}
*)|Pext_rebindofLongident.tloc(** [Pext_rebind(D)] re-export the constructor [D] with the new name [C] *)(** {1 Class language} *)(** {2 Type expressions for the class language} *)andclass_type={pcty_desc:class_type_desc;pcty_loc:Location.t;pcty_attributes:attributes;(** [... [\@id1] [\@id2]] *)}andclass_type_desc=|Pcty_constrofLongident.tloc*core_typelist(** - [c]
- [['a1, ..., 'an] c] *)|Pcty_signatureofclass_signature(** [object ... end] *)|Pcty_arrowofarrow_paramlist*class_type(** [Pcty_arrow(lbl, T, CT)] represents:
- [T -> CT]
when [lbl] is {{!Asttypes.arg_label.Nolabel}[Nolabel]},
- [~l:T -> CT]
when [lbl] is {{!Asttypes.arg_label.Labelled}[Labelled l]},
- [?l:T -> CT]
when [lbl] is {{!Asttypes.arg_label.Optional}[Optional l]}.
*)|Pcty_extensionofextension(** [%id] *)|Pcty_openofopen_description*class_type(** [let open M in CT] *)andclass_signature={pcsig_self:core_typeoption;pcsig_fields:class_type_fieldlist;}(** Values of type [class_signature] represents:
- [object('selfpat) ... end]
- [object ... end] when {{!class_signature.pcsig_self}[pcsig_self]} is [None]
*)andclass_type_field={pctf_desc:class_type_field_desc;pctf_loc:Location.t;pctf_attributes:attributes;(** [... [\@\@id1] [\@\@id2]] *)}andclass_type_field_desc=|Pctf_inheritofclass_type(** [inherit CT] *)|Pctf_valof(labelloc*mutable_virtual*core_type)(** [val x: T] *)|Pctf_methodof(labelloc*private_virtual*core_type)(** [method x: T]
Note: [T] can be a {{!core_type_desc.Ptyp_poly}[Ptyp_poly]}.
*)|Pctf_constraintof(core_type*core_type)(** [constraint T1 = T2] *)|Pctf_attributeofattribute(** [[\@\@\@id]] *)|Pctf_extensionofextension(** [[%%id]] *)and'aclass_infos={pci_virt:virtual_flag;pci_params:(core_type*variance_and_injectivity)list;pci_name:stringloc;pci_expr:'a;pci_loc:Location.t;pci_attributes:attributes;(** [... [\@\@id1] [\@\@id2]] *)}(** Values of type [class_expr class_infos] represents:
- [class c = ...]
- [class ['a1,...,'an] c = ...]
- [class virtual c = ...]
They are also used for "class type" declaration.
*)andclass_description=class_typeclass_infosandclass_type_declaration=class_typeclass_infos(** {2 Value expressions for the class language} *)andclass_expr={pcl_desc:class_expr_desc;pcl_loc:Location.t;pcl_attributes:attributes;(** [... [\@id1] [\@id2]] *)}andclass_expr_desc=|Pcl_constrofLongident.tloc*core_typelist(** [c] and [['a1, ..., 'an] c] *)|Pcl_structureofclass_structure(** [object ... end] *)|Pcl_funofarg_label*expressionoption*pattern*class_expr(** [Pcl_fun(lbl, exp0, P, CE)] represents:
- [fun P -> CE]
when [lbl] is {{!Asttypes.arg_label.Nolabel}[Nolabel]}
and [exp0] is [None],
- [fun ~l:P -> CE]
when [lbl] is {{!Asttypes.arg_label.Labelled}[Labelled l]}
and [exp0] is [None],
- [fun ?l:P -> CE]
when [lbl] is {{!Asttypes.arg_label.Optional}[Optional l]}
and [exp0] is [None],
- [fun ?l:(P = E0) -> CE]
when [lbl] is {{!Asttypes.arg_label.Optional}[Optional l]}
and [exp0] is [Some E0].
*)|Pcl_applyofclass_expr*(arg_label*expression)list(** [Pcl_apply(CE, [(l1,E1) ; ... ; (ln,En)])]
represents [CE ~l1:E1 ... ~ln:En].
[li] can be empty (non labeled argument) or start with [?]
(optional argument).
Invariant: [n > 0]
*)|Pcl_letoflet_bindings*class_expr(** [Pcl_let(rec, [(P1, E1); ... ; (Pn, En)], CE)] represents:
- [let P1 = E1 and ... and Pn = EN in CE]
when [rec] is {{!Asttypes.rec_flag.Nonrecursive}[Nonrecursive]},
- [let rec P1 = E1 and ... and Pn = EN in CE]
when [rec] is {{!Asttypes.rec_flag.Recursive}[Recursive]}.
*)|Pcl_constraintofclass_expr*class_type(** [(CE : CT)] *)|Pcl_extensionofextension(** [[%id]] *)|Pcl_openofopen_description*class_expr(** [let open M in CE] *)andclass_structure={pcstr_self:patternoption;pcstr_fields:class_fieldlist;}(** Values of type {!class_structure} represents:
- [object(selfpat) ... end]
- [object ... end] when {{!class_structure.pcstr_self}[pcstr_self]} is [None]
*)andclass_field={pcf_desc:class_field_desc;pcf_loc:Location.t;pcf_attributes:attributes;(** [... [\@\@id1] [\@\@id2]] *)}andclass_field_desc=|Pcf_inheritofoverride_flag*class_expr*stringlocoption(** [Pcf_inherit(flag, CE, s)] represents:
- [inherit CE]
when [flag] is {{!Asttypes.override_flag.Fresh}[Fresh]}
and [s] is [None],
- [inherit CE as x]
when [flag] is {{!Asttypes.override_flag.Fresh}[Fresh]}
and [s] is [Some x],
- [inherit! CE]
when [flag] is {{!Asttypes.override_flag.Override}[Override]}
and [s] is [None],
- [inherit! CE as x]
when [flag] is {{!Asttypes.override_flag.Override}[Override]}
and [s] is [Some x]
*)|Pcf_valof(labelloc*mutable_virtual*class_field_kind)(** [Pcf_val(x,flag, kind)] represents:
- [val x = E]
when [flag] is {{!Asttypes.mutable_flag.Immutable}[Immutable]}
and [kind] is {{!class_field_kind.Cfk_concrete}[Cfk_concrete(Fresh, E)]}
- [val virtual x: T]
when [flag] is {{!Asttypes.mutable_flag.Immutable}[Immutable]}
and [kind] is {{!class_field_kind.Cfk_virtual}[Cfk_virtual(T)]}
- [val mutable x = E]
when [flag] is {{!Asttypes.mutable_flag.Mutable}[Mutable]}
and [kind] is {{!class_field_kind.Cfk_concrete}[Cfk_concrete(Fresh, E)]}
- [val mutable virtual x: T]
when [flag] is {{!Asttypes.mutable_flag.Mutable}[Mutable]}
and [kind] is {{!class_field_kind.Cfk_virtual}[Cfk_virtual(T)]}
*)|Pcf_methodof(labelloc*private_virtual*class_field_kind)(** - [method x = E]
([E] can be a {{!expression_desc.Pexp_poly}[Pexp_poly]})
- [method virtual x: T]
([T] can be a {{!core_type_desc.Ptyp_poly}[Ptyp_poly]})
*)|Pcf_constraintof(core_type*core_type)(** [constraint T1 = T2] *)|Pcf_initializerofexpression(** [initializer E] *)|Pcf_attributeofattribute(** [[\@\@\@id]] *)|Pcf_extensionofextension(** [[%%id]] *)andclass_field_kind=|Cfk_virtualofcore_type|Cfk_concreteofoverride_flag*expressionandclass_declaration=class_exprclass_infos(** {1 Module language} *)(** {2 Type expressions for the module language} *)andmodule_type={pmty_desc:module_type_desc;pmty_loc:Location.t;pmty_attributes:attributes;(** [... [\@id1] [\@id2]] *)}andmodule_type_desc=|Pmty_identofLongident.tloc(** [Pmty_ident(S)] represents [S] *)|Pmty_signatureofsignature(** [sig ... end] *)|Pmty_functoroffunctor_parameterloclist*module_type(** [functor (X1 : MT1) ... (Xn : MTn) -> MT] *)|Pmty_genofLocation.t*module_type(** [() -> MT] *)|Pmty_withofmodule_type*with_constraintlist(** [MT with ...] *)|Pmty_typeofofmodule_expr(** [module type of ME] *)|Pmty_extensionofextension(** [[%id]] *)|Pmty_aliasofLongident.tloc(** [(module M)] *)andfunctor_parameter=|Unit(** [()] *)|Namedofstringoptionloc*module_type(** [Named(name, MT)] represents:
- [(X : MT)] when [name] is [Some X],
- [(_ : MT)] when [name] is [None] *)andsignature=signature_itemlistandsignature_item={psig_desc:signature_item_desc;psig_loc:Location.t;}andsignature_item_desc=|Psig_valueofvalue_description(** - [val x: T]
- [external x: T = "s1" ... "sn"] *)|Psig_typeofrec_flag*type_declarationlist(** [type t1 = ... and ... and tn = ...] *)|Psig_typesubstoftype_declarationlist(** [type t1 := ... and ... and tn := ...] *)|Psig_typextoftype_extension(** [type t1 += ...] *)|Psig_exceptionoftype_exception(** [exception C of T] *)|Psig_moduleofmodule_declaration(** [module X = M] and [module X : MT] *)|Psig_modsubstofmodule_substitution(** [module X := M] *)|Psig_recmoduleofmodule_declarationlist(** [module rec X1 : MT1 and ... and Xn : MTn] *)|Psig_modtypeofmodule_type_declaration(** [module type S = MT] and [module type S] *)|Psig_modtypesubstofmodule_type_declaration(** [module type S := ...] *)|Psig_openofopen_description(** [open X] *)|Psig_includeofinclude_description(** [include MT] *)|Psig_classofclass_descriptionlist(** [class c1 : ... and ... and cn : ...] *)|Psig_class_typeofclass_type_declarationlist(** [class type ct1 = ... and ... and ctn = ...] *)|Psig_attributeofattribute(** [[\@\@\@id]] *)|Psig_extensionofextension*attributes(** [[%%id]] *)andmodule_declaration={pmd_name:stringoptionloc;pmd_args:functor_parameterloclist;pmd_type:module_type;pmd_attributes:attributes;(** [... [\@\@id1] [\@\@id2]] *)pmd_loc:Location.t;}(** Values of type [module_declaration] represents [S : MT] *)andmodule_substitution={pms_name:stringloc;pms_manifest:Longident.tloc;pms_attributes:attributes;(** [... [\@\@id1] [\@\@id2]] *)pms_loc:Location.t;}(** Values of type [module_substitution] represents [S := M] *)andmodule_type_declaration={pmtd_name:stringloc;pmtd_type:module_typeoption;pmtd_attributes:attributes;(** [... [\@\@id1] [\@\@id2]] *)pmtd_loc:Location.t;}(** Values of type [module_type_declaration] represents:
- [S = MT],
- [S] for abstract module type declaration,
when {{!module_type_declaration.pmtd_type}[pmtd_type]} is [None].
*)and'aopen_infos={popen_expr:'a;popen_override:override_flag;popen_loc:Location.t;popen_attributes:attributes;}(** Values of type ['a open_infos] represents:
- [open! X] when {{!open_infos.popen_override}[popen_override]}
is {{!Asttypes.override_flag.Override}[Override]}
(silences the "used identifier shadowing" warning)
- [open X] when {{!open_infos.popen_override}[popen_override]}
is {{!Asttypes.override_flag.Fresh}[Fresh]}
*)andopen_description=Longident.tlocopen_infos(** Values of type [open_description] represents:
- [open M.N]
- [open M(N).O] *)andopen_declaration=module_expropen_infos(** Values of type [open_declaration] represents:
- [open M.N]
- [open M(N).O]
- [open struct ... end] *)and'ainclude_infos={pincl_mod:'a;pincl_loc:Location.t;pincl_attributes:attributes;}andinclude_description=module_typeinclude_infos(** Values of type [include_description] represents [include MT] *)andinclude_declaration=module_exprinclude_infos(** Values of type [include_declaration] represents [include ME] *)andwith_constraint=|Pwith_typeofLongident.tloc*type_declaration(** [with type X.t = ...]
Note: the last component of the longident must match
the name of the type_declaration. *)|Pwith_moduleofLongident.tloc*Longident.tloc(** [with module X.Y = Z] *)|Pwith_modtypeofLongident.tloc*module_type(** [with module type X.Y = Z] *)|Pwith_modtypesubstofLongident.tloc*module_type(** [with module type X.Y := sig end] *)|Pwith_typesubstofLongident.tloc*type_declaration(** [with type X.t := ..., same format as [Pwith_type]] *)|Pwith_modsubstofLongident.tloc*Longident.tloc(** [with module X.Y := Z] *)(** {2 Value expressions for the module language} *)andmodule_expr={pmod_desc:module_expr_desc;pmod_loc:Location.t;pmod_attributes:attributes;(** [... [\@id1] [\@id2]] *)}andmodule_expr_desc=|Pmod_identofLongident.tloc(** [X] *)|Pmod_structureofstructure(** [struct ... end] *)|Pmod_functoroffunctor_parameterloclist*module_expr(** [functor (X1 : MT1) ... (Xn : MTn) -> ME] *)|Pmod_applyofmodule_expr*module_expr(** [ME1(ME2)] *)|Pmod_constraintofmodule_expr*module_type(** [(ME : MT)] *)|Pmod_unpackofexpression*package_typeoption*package_typeoption(** [(val E : M1 :> M2)] *)|Pmod_gen_applyofmodule_expr*Location.t(** [ME()] *)|Pmod_extensionofextension(** [[%id]] *)|Pmod_hole(** [_] *)andstructure=structure_itemlistandstructure_item={pstr_desc:structure_item_desc;pstr_loc:Location.t;}andstructure_item_desc=|Pstr_evalofexpression*attributes(** [E] *)|Pstr_valueoflet_bindings(** [Pstr_value(rec, [(P1, E1 ; ... ; (Pn, En))])] represents:
- [let P1 = E1 and ... and Pn = EN]
when [rec] is {{!Asttypes.rec_flag.Nonrecursive}[Nonrecursive]},
- [let rec P1 = E1 and ... and Pn = EN ]
when [rec] is {{!Asttypes.rec_flag.Recursive}[Recursive]}.
*)|Pstr_primitiveofvalue_description(** - [val x: T]
- [external x: T = "s1" ... "sn"] *)|Pstr_typeofrec_flag*type_declarationlist(** [type t1 = ... and ... and tn = ...] *)|Pstr_typextoftype_extension(** [type t1 += ...] *)|Pstr_exceptionoftype_exception(** - [exception C of T]
- [exception C = M.X] *)|Pstr_moduleofmodule_binding(** [module X = ME] *)|Pstr_recmoduleofmodule_bindinglist(** [module rec X1 = ME1 and ... and Xn = MEn] *)|Pstr_modtypeofmodule_type_declaration(** [module type S = MT] *)|Pstr_openofopen_declaration(** [open X] *)|Pstr_classofclass_declarationlist(** [class c1 = ... and ... and cn = ...] *)|Pstr_class_typeofclass_type_declarationlist(** [class type ct1 = ... and ... and ctn = ...] *)|Pstr_includeofinclude_declaration(** [include ME] *)|Pstr_attributeofattribute(** [[\@\@\@id]] *)|Pstr_extensionofextension*attributes(** [[%%id]] *)andlet_binding={lb_pattern:pattern;lb_expression:expression;lb_is_pun:bool;lb_attributes:attributes;lb_loc:Location.t;}andlet_bindings={lbs_bindings:let_bindinglist;lbs_rec:rec_flag;lbs_extension:stringlocoption}andmodule_binding={pmb_name:stringoptionloc;pmb_args:functor_parameterloclist;pmb_expr:module_expr;pmb_attributes:attributes;pmb_loc:Location.t;}(** Values of type [module_binding] represents [module X = ME] *)(** {1 Toplevel} *)(** {2 Toplevel phrases} *)typetoplevel_phrase=|Ptop_defofstructure|Ptop_diroftoplevel_directive(** [#use], [#load] ... *)andtoplevel_directive={pdir_name:stringloc;pdir_arg:directive_argumentoption;pdir_loc:Location.t;}anddirective_argument={pdira_desc:directive_argument_desc;pdira_loc:Location.t;}anddirective_argument_desc=|Pdir_stringofstring|Pdir_intofstring*charoption|Pdir_identofLongident.t|Pdir_boolofbooltyperepl_phrase={prepl_phrase:toplevel_phrase;prepl_output:string;}