12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382# 1 "vendor/parser-standard/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=|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_unboxed_integerofstring*char(** Integer constants such as [#3] [#3l] [#3L] [#3n].
A suffix [[g-z][G-Z]] is required by the parser.
Suffixes except ['l'], ['L'] and ['n'] are rejected by the typechecker
*)|Pconst_charofchar(** Character such as ['c']. *)|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 except ['s'] are rejected by the typechecker.
*)|Pconst_unboxed_floatofstring*charoption(** Float constant such as [#3.4], [#2e5] or [#1.4e-4].
Suffixes [g-z][G-Z] are accepted by the parser.
Suffixes except ['s'] are rejected by the typechecker.
*)typelocation_stack=Location.tlisttypemodality=|Modalityofstring[@@unboxed]typemodalities=modalityloclisttypemode=|Modeofstring[@@unboxed]typemodes=modeloclisttypeinclude_kind=Structure|Functor(** {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]] *)}andcore_type_desc=|Ptyp_anyofjkind_annotationoption(** [_] or [_ : k] *)|Ptyp_varofstring*jkind_annotationoption(** A type variable such as ['a] or ['a : k] *)|Ptyp_arrowofarg_label*core_type*core_type*modes*modes(** [Ptyp_arrow(lbl, T1, T2, M1, M2)] represents:
- [T1 @ M1 -> T2 @ M2] when [lbl] is
{{!arg_label.Nolabel}[Nolabel]},
- [~l:(T1 @ M1) -> (T2 @ M2)] when [lbl] is
{{!arg_label.Labelled}[Labelled]},
- [?l:(T1 @ M1) -> (T2 @ M2)] when [lbl] is
{{!arg_label.Optional}[Optional]}.
*)|Ptyp_tupleof(stringoption*core_type)list(** [Ptyp_tuple(tl)] represents a product type:
- [T1 * ... * Tn] when [tl] is [(None,T1);...;(None,Tn)]
- [L1:T1 * ... * Ln:Tn] when [tl] is [(Some L1,T1);...;(Some Ln,Tn)]
- A mix, e.g. [L1:T1 * T2] when [tl] is [(Some L1,T1);(None,T2)]
Invariant: [n >= 2].
*)|Ptyp_unboxed_tupleof(stringoption*core_type)list(** Unboxed tuple types: [Ptyp_unboxed_tuple([(Some l1,P1);...;(Some l2,Pn)]]
represents a product type [#(l1:T1 * ... * l2:Tn)], and the labels
are optional.
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*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*stringlocoption*jkind_annotationoption(** [T as 'a] or [T as ('a : k)] or [T as (_ : k)].
Invariant: the name or jkind annotation is non-None.
*)|Ptyp_variantofrow_fieldlist*closed_flag*labellistoption(** [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_polyof(stringloc*jkind_annotationoption)list*core_type(** ['a1 ... 'an. T]
[('a1 : k1) ... ('an : kn). 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_openofLongident.tloc*core_type(** [M.(T)] *)|Ptyp_quoteofcore_type(** [<[T]>] *)|Ptyp_spliceofcore_type(** [$T] *)|Ptyp_of_kindofjkind_annotation(** [(type : k)] *)|Ptyp_extensionofextension(** [[%id]]. *)andarg_label=Asttypes.arg_label=Nolabel|Labelledofstring|Optionalofstringandpackage_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=|Rtagoflabelloc*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_tupleof(stringoption*pattern)list*Asttypes.closed_flag(** [Ppat_tuple(pl, Closed)] represents
- [(P1, ..., Pn)] when [pl] is [(None, P1);...;(None, Pn)]
- [(~L1:P1, ..., ~Ln:Pn)] when [pl] is
[(Some L1, P1);...;(Some Ln, Pn)]
- A mix, e.g. [(~L1:P1, P2)] when [pl] is [(Some L1, P1);(None, P2)]
- If pattern is open, then it also ends in a [..]
Invariant:
- If Closed, [n >= 2].
- If Open, [n >= 1].
*)|Ppat_unboxed_unit(** [#()] *)|Ppat_unboxed_boolofbool(** [#false] or [#true] *)|Ppat_unboxed_tupleof(stringoption*pattern)list*Asttypes.closed_flag(** Unboxed tuple patterns: [#(l1:P1, ..., ln:Pn)] is [([(Some
l1,P1);...;(Some l2,Pn)], Closed)], and the labels are optional. An
[Open] pattern ends in [..].
Invariant:
- If Closed, [n >= 2]
- If Open, [n >= 1]
*)|Ppat_constructofLongident.tloc*((stringloc*jkind_annotationoption)list*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, None; b, None], P)]
- [C (type (a : k) b) P]
when [args] is [Some ([a, Some k; b, None], P)]
*)|Ppat_variantoflabel*patternoption(** [Ppat_variant(`A, pat)] represents:
- [`A] when [pat] is [None],
- [`A P] when [pat] is [Some P]
*)|Ppat_recordof(Longident.tloc*pattern)list*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_record_unboxed_productof(Longident.tloc*pattern)list*closed_flag(** [Ppat_record_unboxed_product([(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_arrayofmutable_flag*patternlist(** Pattern [[| P1; ...; Pn |]] or [[: P1; ...; Pn :]] *)|Ppat_orofpattern*pattern(** Pattern [P1 | P2] *)|Ppat_constraintofpattern*core_typeoption*modes(** [Ppat_constraint(tyopt, modes)] represents:
- [(P : ty @@ modes)] when [tyopt] is [Some ty]
- [(P @ modes)] when [tyopt] is [None]
*)|Ppat_typeofLongident.tloc(** Pattern [#tconst] *)|Ppat_lazyofpattern(** Pattern [lazy P] *)|Ppat_unpackofstringoptionloc(** [Ppat_unpack(s)] represents:
- [(module P)] when [s] is [Some "P"]
- [(module _)] when [s] is [None]
Note: [(module P : S)] is represented as
[Ppat_constraint(Ppat_unpack(Some "P"), Ptyp_package S)]
*)|Ppat_exceptionofpattern(** Pattern [exception P] *)|Ppat_extensionofextension(** Pattern [[%id]] *)|Ppat_openofLongident.tloc*pattern(** Pattern [M.(P)] *)(** {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_letofmutable_flag*rec_flag*value_bindinglist*expression(** [Pexp_let(mut, rec, [(P1,E1) ; ... ; (Pn,En)], E)] represents:
- [let P1 = E1 and ... and Pn = EN in E]
when [rec] is {{!Asttypes.rec_flag.Nonrecursive}[Nonrecursive]}
and [mut] = {{!Asttypes.mutable_flag.Immutable}[Immutable]}.
- [let rec P1 = E1 and ... and Pn = EN in E]
when [rec] is {{!Asttypes.rec_flag.Recursive}[Recursive]}
and [mut] = {{!Asttypes.mutable_flag.Immutable}[Immutable]}.
- [let mutable P1 = E1 in E]
when [rec] is {{!Asttypes.rec_flag.Nonrecursive}[Nonrecursive]}
and [mut] = {{!Asttypes.mutable_flag.Mutable}[Mutable]}.
Invariant: If [mut = Mutable] then [n = 1] and [rec = Nonrecursive] *)|Pexp_functionoffunction_paramlist*function_constraint*function_body(** [Pexp_function ([P1; ...; Pn], C, body)] represents any construct
involving [fun] or [function], including:
- [fun P1 ... Pn -> E]
when [body = Pfunction_body E]
- [fun P1 ... Pn -> function p1 -> e1 | ... | pm -> em]
when [body = Pfunction_cases [ p1 -> e1; ...; pm -> em ]]
[C] represents a type constraint or coercion placed immediately before the
arrow, e.g. [fun P1 ... Pn : ty -> ...] when [C = Some (Pconstraint ty)].
A function must have parameters. [Pexp_function (params, _, body)] must
have non-empty [params] or a [Pfunction_cases _] body.
*)|Pexp_applyofexpression*(arg_label*expression)list(** [Pexp_apply(E0, [(l1, E1) ; ... ; (ln, En)])]
represents [E0 ~l1:E1 ... ~ln:En]
[li] can be
{{!arg_label.Nolabel}[Nolabel]} (non labeled argument),
{{!arg_label.Labelled}[Labelled]} (labelled arguments) or
{{!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_tupleof(stringoption*expression)list(** [Pexp_tuple(el)] represents
- [(E1, ..., En)]
when [el] is [(None, E1);...;(None, En)]
- [(~L1:E1, ..., ~Ln:En)]
when [el] is [(Some L1, E1);...;(Some Ln, En)]
- A mix, e.g.:
[(~L1:E1, E2)] when [el] is [(Some L1, E1); (None, E2)]
Invariant: [n >= 2]
*)|Pexp_unboxed_unit(** [#()] *)|Pexp_unboxed_boolofbool(** [#false] or [#true] *)|Pexp_unboxed_tupleof(stringoption*expression)list(** Unboxed tuple expressions: [Pexp_unboxed_tuple([(Some l1,P1);...;(Some
l2,Pn)])] represents [#(l1:E1, ..., ln:En)], and the labels are
optional.
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_variantoflabel*expressionoption(** [Pexp_variant(`A, exp)] represents
- [`A] when [exp] is [None]
- [`A E] when [exp] is [Some E]
*)|Pexp_recordof(Longident.tloc*expression)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_record_unboxed_productof(Longident.tloc*expression)list*expressionoption(** [Pexp_record_unboxed_product([(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_unboxed_fieldofexpression*Longident.tloc(** [E.#l] *)|Pexp_setfieldofexpression*Longident.tloc*expression(** [E1.l <- E2] *)|Pexp_arrayofmutable_flag*expressionlist(** [[| E1; ...; En |]] or [[: E1; ...; En :]] *)|Pexp_idxofblock_access*unboxed_accesslist(** [(BA1 UA1 UA2 ...)] e.g. [(.foo.#bar.#baz)]
Above, BA1=.foo, UA1=.#bar, and UA2=#.baz *)|Pexp_ifthenelseofexpression*expression*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_typeoption*modes(** [(E : T @@ modes)] *)|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_setvaroflabelloc*expression(** [x <- 2]
Represents both setting an instance variable
and setting a mutable variable. *)|Pexp_overrideof(labelloc*expression)list(** [{< x1 = E1; ...; xn = En >}] *)|Pexp_letmoduleofstringoptionloc*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*jkind_annotationoption*expression(** [fun (type t) -> E] or [fun (type t : k) -> E] *)|Pexp_packofmodule_expr(** [(module ME)].
[(module ME : S)] is represented as
[Pexp_constraint(Pexp_pack ME, Ptyp_package S)] *)|Pexp_openofopen_declaration*expression(** - [M.(E)]
- [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_stackofexpression(** stack_ exp *)|Pexp_borrowofexpression(** borrow_ exp *)|Pexp_comprehensionofcomprehension_expression(** [[? BODY ...CLAUSES... ?]], where:
- [?] is either [""] (list), [:] (immutable array), or [|] (array).
- [BODY] is an expression.
- [CLAUSES] is a series of [comprehension_clause].
*)|Pexp_overwriteofexpression*expression(** overwrite_ exp with exp *)|Pexp_hole(** _ *)|Pexp_quoteofexpression(** runtime metaprogramming quotations <[E]> *)|Pexp_spliceofexpression(** runtime metaprogramming splicing $(E) *)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;}andfunction_param_desc=|Pparam_valofarg_label*expressionoption*pattern(** [Pparam_val (lbl, exp0, P)] represents the parameter:
- [P]
when [lbl] is {{!Asttypes.arg_label.Nolabel}[Nolabel]}
and [exp0] is [None]
- [~l:P]
when [lbl] is {{!Asttypes.arg_label.Labelled}[Labelled l]}
and [exp0] is [None]
- [?l:P]
when [lbl] is {{!Asttypes.arg_label.Optional}[Optional l]}
and [exp0] is [None]
- [?l:(P = E0)]
when [lbl] is {{!Asttypes.arg_label.Optional}[Optional l]}
and [exp0] is [Some E0]
Note: If [E0] is provided, only
{{!Asttypes.arg_label.Optional}[Optional]} is allowed.
*)|Pparam_newtypeofstringloc*jkind_annotationoption(** [Pparam_newtype x] represents the parameter [(type x)].
[x] carries the location of the identifier, whereas the [pparam_loc]
on the enclosing [function_param] node is the location of the [(type x)]
as a whole.
Multiple parameters [(type a b c)] are represented as multiple
[Pparam_newtype] nodes, let's say:
{[ [ { pparam_kind = Pparam_newtype a; pparam_loc = loc1 };
{ pparam_kind = Pparam_newtype b; pparam_loc = loc2 };
{ pparam_kind = Pparam_newtype c; pparam_loc = loc3 };
]
]}
Here, the first loc [loc1] is the location of [(type a b c)], and the
subsequent locs [loc2] and [loc3] are the same as [loc1], except marked as
ghost locations. The locations on [a], [b], [c], correspond to the
variables [a], [b], and [c] in the source code.
*)andfunction_param={pparam_loc:Location.t;pparam_desc:function_param_desc;}andfunction_body=|Pfunction_bodyofexpression|Pfunction_casesofcaselist*Location.t*attributes(** In [Pfunction_cases (_, loc, attrs)], the location extends from the
start of the [function] keyword to the end of the last case. The compiler
will only use typechecking-related attributes from [attrs], e.g. enabling
or disabling a warning.
*)(** See the comment on {{!expression_desc.Pexp_function}[Pexp_function]}. *)andtype_constraint=|Pconstraintofcore_type|Pcoerceofcore_typeoption*core_type(** See the comment on {{!expression_desc.Pexp_function}[Pexp_function]}. *)andfunction_constraint={mode_annotations:modes;(** The mode annotation placed on a function let-binding, e.g.
[let local_ f x : int -> int = ...].
The [local_] syntax is parsed into two nodes: the field here, and [pvb_modes].
This field only affects the interpretation of [ret_type_constraint], while the
latter is translated in [typecore] to [Pexp_constraint] to contrain the mode of the
function.
(* CR zqian: This field is not failthful representation of the user syntax, and
complicates [pprintast]. It should be removed and their functionality should be
moved to [pvb_modes]. *)
*)ret_mode_annotations:modes;(** The mode annotation placed on a function's body, e.g.
[let f x : int -> int @@ local = ...].
This field constrains the mode of function's body.
*)ret_type_constraint:type_constraintoption;(** The type constraint placed on a function's body. *)}(** See the comment on {{!expression_desc.Pexp_function}[Pexp_function]}. *)andblock_access=|Baccess_fieldofLongident.tloc(** [.foo] *)|Baccess_arrayofmutable_flag*index_kind*expression(** Mutable array accesses: [.(E)], [.L(E)], [.l(E)], [.n(E)]
Immutable array accesses: [.:(E)], [.:L(E)], [.:l(E)], [.:n(E)]
Indexed by [int], [int64#], [int32#], or [nativeint#], respectively.
*)|Baccess_blockofmutable_flag*expression(** Access using another block index: [.idx_imm(E)], [.idx_mut(E)]
(usually followed by unboxed accesses, to deepen the index).
*)andunboxed_access=|Uaccess_unboxed_fieldofLongident.tloc(** [.#foo] *)andcomprehension_iterator=|Pcomp_rangeof{start:expression;stop:expression;direction:direction_flag}(** "= START to STOP" (direction = Upto)
"= START downto STOP" (direction = Downto) *)|Pcomp_inofexpression(** "in EXPR" *)(** [@...] PAT (in/=) ... *)andcomprehension_clause_binding={pcomp_cb_pattern:pattern;pcomp_cb_iterator:comprehension_iterator;pcomp_cb_attributes:attributes}andcomprehension_clause=|Pcomp_forofcomprehension_clause_bindinglist(** "for PAT (in/=) ... and PAT (in/=) ... and ..."; must be nonempty *)|Pcomp_whenofexpression(** "when EXPR" *)andcomprehension={pcomp_body:expression;(** The body/generator of the comprehension *)pcomp_clauses:comprehension_clauselist;(** The clauses of the comprehension; must be nonempty *)}andcomprehension_expression=|Pcomp_list_comprehensionofcomprehension(** [[BODY ...CLAUSES...]] *)|Pcomp_array_comprehensionofmutable_flag*comprehension(** [[|BODY ...CLAUSES...|]] (flag = Mutable)
[[:BODY ...CLAUSES...:]] (flag = Immutable)
(only allowed with [-extension immutable_arrays])
*)(** {2 Value descriptions} *)andvalue_description={pval_name:stringloc;pval_type:core_type;pval_modalities:modalities;pval_prim:stringlist;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*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_jkind_annotation:jkind_annotationoption;(** for [: jkind] *)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_record_unboxed_productoflabel_declarationlist(** Invariant: non-empty list *)|Ptype_openandlabel_declaration={pld_name:stringloc;pld_mutable:mutable_flag;pld_modalities:modalities;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:(stringloc*jkind_annotationoption)list;(** jkind annotations are [C : ('a : kind1) ('a2 : kind2). ...] *)pcd_args:constructor_arguments;pcd_res:core_typeoption;pcd_loc:Location.t;pcd_attributes:attributes;(** [C of ... [\@id1] [\@id2]] *)}andconstructor_argument={pca_modalities:modalities;pca_type:core_type;pca_loc:Location.t;}andconstructor_arguments=|Pcstr_tupleofconstructor_argumentlist|Pcstr_recordoflabel_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*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_declof(stringloc*jkind_annotationoption)list*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 : k)... . T1 * ... * Tn -> T0] when
{ul {- [existentials] is [[('a : k);...]],}
{- [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_arrowofarg_label*core_type*class_type(** [Pcty_arrow(lbl, T, CT)] represents:
- [T -> CT]
when [lbl] is {{!arg_label.Nolabel}[Nolabel]},
- [~l:T -> CT]
when [lbl] is {{!arg_label.Labelled}[Labelled l]},
- [?l:T -> CT]
when [lbl] is {{!arg_label.Optional}[Optional l]}.
*)|Pcty_extensionofextension(** [%id] *)|Pcty_openofopen_description*class_type(** [let open M in CT] *)andclass_signature={pcsig_self:core_type;pcsig_fields:class_type_fieldlist;}(** Values of type [class_signature] represents:
- [object('selfpat) ... end]
- [object ... end] when {{!class_signature.pcsig_self}[pcsig_self]}
is {{!core_type_desc.Ptyp_any}[Ptyp_any]}
*)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_flag*virtual_flag*core_type)(** [val x: T] *)|Pctf_methodof(labelloc*private_flag*virtual_flag*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*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 {{!arg_label.Nolabel}[Nolabel]}
and [exp0] is [None],
- [fun ~l:P -> CE]
when [lbl] is {{!arg_label.Labelled}[Labelled l]}
and [exp0] is [None],
- [fun ?l:P -> CE]
when [lbl] is {{!arg_label.Optional}[Optional l]}
and [exp0] is [None],
- [fun ?l:(P = E0) -> CE]
when [lbl] is {{!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_letofrec_flag*value_bindinglist*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:pattern;pcstr_fields:class_fieldlist;}(** Values of type {!class_structure} represents:
- [object(selfpat) ... end]
- [object ... end] when {{!class_structure.pcstr_self}[pcstr_self]}
is {{!pattern_desc.Ppat_any}[Ppat_any]}
*)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_flag*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_flag*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_parameter*module_type*modes(** [functor(X : MT1 @@ modes) -> MT2 @ modes] *)|Pmty_withofmodule_type*with_constraintlist(** [MT with ...] *)|Pmty_typeofofmodule_expr(** [module type of ME] *)|Pmty_extensionofextension(** [[%id]] *)|Pmty_aliasofLongident.tloc(** [(module M)] *)(*_ [Pmty_strengthen] might be a better fit for [with_constraint] *)|Pmty_strengthenofmodule_type*Longident.tloc(** [MT with S] *)andfunctor_parameter=|Unit(** [()] *)|Namedofstringoptionloc*module_type*modes(** [Named(name, MT)] represents:
- [(X : MT @@ modes)] when [name] is [Some X],
- [(_ : MT @@ modes)] when [name] is [None] *)andsignature={psg_modalities:modalities;psg_items:signature_itemlist;psg_loc:Location.t;}andsignature_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*modalities(** [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]] *)|Psig_kind_abbrevofstringloc*jkind_annotation(** [kind_abbrev_ name = k] *)andmodule_declaration={pmd_name:stringoptionloc;pmd_type:module_type;pmd_modalities:modalities;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_kind:include_kind;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_parameter*module_expr(** [functor(X : MT1) -> ME] *)|Pmod_applyofmodule_expr*module_expr(** [ME1(ME2)] *)|Pmod_apply_unitofmodule_expr(** [ME1()] *)|Pmod_constraintofmodule_expr*module_typeoption*modes(** - [(ME : MT @@ modes)]
- [(ME @ modes)]
- [(ME : MT)]
*)|Pmod_unpackofexpression(** [(val E)] *)|Pmod_extensionofextension(** [[%id]] *)|Pmod_instanceofmodule_instance(** [Foo(Param1)(Arg1(Param2)(Arg2)) [@jane.non_erasable.instances]]
The name of an instance module. Gets converted to [Global.Name.t] in
the OxCaml compiler. *)|Pmod_hole(** [_] *)andmodule_instance={pmod_instance_head:string;pmod_instance_args:(string*module_instance)list}(** [M(P1)(MI1)...(Pn)(MIn)] *)andstructure=structure_itemlistandstructure_item={pstr_desc:structure_item_desc;pstr_loc:Location.t;}andstructure_item_desc=|Pstr_evalofexpression*attributes(** [E] *)|Pstr_valueofrec_flag*value_bindinglist(** [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]] *)|Pstr_kind_abbrevofstringloc*jkind_annotation(** [kind_abbrev_ name = k] *)andvalue_constraint=|Pvc_constraintof{locally_abstract_univars:stringloclist;typ:core_type;}|Pvc_coercionof{ground:core_typeoption;coercion:core_type}(**
- [Pvc_constraint { locally_abstract_univars=[]; typ}]
is a simple type constraint on a value binding: [ let x : typ]
- More generally, in [Pvc_constraint { locally_abstract_univars; typ}]
[locally_abstract_univars] is the list of locally abstract type
variables in [ let x: type a ... . typ ]
- [Pvc_coercion { ground=None; coercion }] represents [let x :> typ]
- [Pvc_coercion { ground=Some g; coercion }] represents [let x : g :> typ]
*)andvalue_binding={pvb_pat:pattern;pvb_expr:expression;pvb_constraint:value_constraintoption;pvb_modes:modes;pvb_attributes:attributes;pvb_loc:Location.t;}(** [let pat : type_constraint = exp] *)andmodule_binding={pmb_name:stringoptionloc;pmb_expr:module_expr;pmb_attributes:attributes;pmb_loc:Location.t;}(** Values of type [module_binding] represents [module X = ME] *)andjkind_annotation_desc=|Default|Abbreviationofstring(* CR layouts v2.8: [mod] can have only layouts on the left, not
full kind annotations. We may want to narrow this type some. *)|Modofjkind_annotation*modes|Withofjkind_annotation*core_type*modalities|Kind_ofofcore_type|Productofjkind_annotationlistandjkind_annotation={pjkind_loc:Location.t;pjkind_desc:jkind_annotation_desc}(** {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_boolofbool