RE Remove the camlp4/Camlp4/Sig directory
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@7841 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02master
parent
f7980e95e2
commit
3a67908c91
|
@ -1,2 +0,0 @@
|
|||
*.cm*
|
||||
Grammar.ml
|
|
@ -1,33 +0,0 @@
|
|||
(****************************************************************************)
|
||||
(* *)
|
||||
(* Objective Caml *)
|
||||
(* *)
|
||||
(* INRIA Rocquencourt *)
|
||||
(* *)
|
||||
(* Copyright 2006 Institut National de Recherche en Informatique et *)
|
||||
(* en Automatique. All rights reserved. This file is distributed under *)
|
||||
(* the terms of the GNU Library General Public License, with the special *)
|
||||
(* exception on linking described in LICENSE at the top of the Objective *)
|
||||
(* Caml source tree. *)
|
||||
(* *)
|
||||
(****************************************************************************)
|
||||
|
||||
(* Authors:
|
||||
* - Daniel de Rauglaudre: initial version
|
||||
* - Nicolas Pouillard: refactoring
|
||||
*)
|
||||
|
||||
(** The AntiquotSyntax signature describe the minimal interface needed
|
||||
for antiquotation handling. *)
|
||||
module type S = sig
|
||||
module Ast : Ast.S;
|
||||
|
||||
(** The parse function for expressions.
|
||||
The underlying expression grammar entry is generally "expr; EOI". *)
|
||||
value parse_expr : Ast.Loc.t -> string -> Ast.expr;
|
||||
|
||||
(** The parse function for patterns.
|
||||
The underlying pattern grammar entry is generally "patt; EOI". *)
|
||||
value parse_patt : Ast.Loc.t -> string -> Ast.patt;
|
||||
end;
|
||||
|
|
@ -1,133 +0,0 @@
|
|||
(****************************************************************************)
|
||||
(* *)
|
||||
(* Objective Caml *)
|
||||
(* *)
|
||||
(* INRIA Rocquencourt *)
|
||||
(* *)
|
||||
(* Copyright 2006 Institut National de Recherche en Informatique et *)
|
||||
(* en Automatique. All rights reserved. This file is distributed under *)
|
||||
(* the terms of the GNU Library General Public License, with the special *)
|
||||
(* exception on linking described in LICENSE at the top of the Objective *)
|
||||
(* Caml source tree. *)
|
||||
(* *)
|
||||
(****************************************************************************)
|
||||
|
||||
(* Authors:
|
||||
* - Daniel de Rauglaudre: initial version
|
||||
* - Nicolas Pouillard: refactoring
|
||||
*)
|
||||
|
||||
(** Abstract syntax tree minimal signature.
|
||||
Types of this signature are abstract.
|
||||
See the {!Camlp4Ast.S} signature for a concrete definition. *)
|
||||
module type S = sig
|
||||
|
||||
module Loc : Loc.S;
|
||||
|
||||
type meta_bool = 'abstract;
|
||||
type meta_option 'a = 'abstract;
|
||||
type ctyp = 'abstract;
|
||||
type patt = 'abstract;
|
||||
type expr = 'abstract;
|
||||
type module_type = 'abstract;
|
||||
type sig_item = 'abstract;
|
||||
type with_constr = 'abstract;
|
||||
type module_expr = 'abstract;
|
||||
type str_item = 'abstract;
|
||||
type class_type = 'abstract;
|
||||
type class_sig_item = 'abstract;
|
||||
type class_expr = 'abstract;
|
||||
type class_str_item = 'abstract;
|
||||
type match_case = 'abstract;
|
||||
type ident = 'abstract;
|
||||
type binding = 'abstract;
|
||||
type module_binding = 'abstract;
|
||||
|
||||
value loc_of_ctyp : ctyp -> Loc.t;
|
||||
value loc_of_patt : patt -> Loc.t;
|
||||
value loc_of_expr : expr -> Loc.t;
|
||||
value loc_of_module_type : module_type -> Loc.t;
|
||||
value loc_of_module_expr : module_expr -> Loc.t;
|
||||
value loc_of_sig_item : sig_item -> Loc.t;
|
||||
value loc_of_str_item : str_item -> Loc.t;
|
||||
value loc_of_class_type : class_type -> Loc.t;
|
||||
value loc_of_class_sig_item : class_sig_item -> Loc.t;
|
||||
value loc_of_class_expr : class_expr -> Loc.t;
|
||||
value loc_of_class_str_item : class_str_item -> Loc.t;
|
||||
value loc_of_with_constr : with_constr -> Loc.t;
|
||||
value loc_of_binding : binding -> Loc.t;
|
||||
value loc_of_module_binding : module_binding -> Loc.t;
|
||||
value loc_of_match_case : match_case -> Loc.t;
|
||||
value loc_of_ident : ident -> Loc.t;
|
||||
|
||||
(** This class is the base class for map traversal on the Ast.
|
||||
To make a custom traversal class one just extend it like that:
|
||||
|
||||
This example swap pairs expression contents:
|
||||
open Camlp4.PreCast;
|
||||
[class swap = object
|
||||
inherit Ast.map as super;
|
||||
method expr e =
|
||||
match super#expr e with
|
||||
\[ <:expr\@_loc< ($e1$, $e2$) >> -> <:expr< ($e2$, $e1$) >>
|
||||
| e -> e \];
|
||||
end;
|
||||
value _loc = Loc.ghost;
|
||||
value map = (new swap)#expr;
|
||||
assert (map <:expr< fun x -> (x, 42) >> = <:expr< fun x -> (42, x) >>);]
|
||||
*)
|
||||
class map : object
|
||||
inherit Mapper.c;
|
||||
method meta_bool : meta_bool -> meta_bool;
|
||||
method meta_option : ! 'a 'b . ('a -> 'b) -> meta_option 'a -> meta_option 'b;
|
||||
method _Loc_t : Loc.t -> Loc.t;
|
||||
method expr : expr -> expr;
|
||||
method patt : patt -> patt;
|
||||
method ctyp : ctyp -> ctyp;
|
||||
method str_item : str_item -> str_item;
|
||||
method sig_item : sig_item -> sig_item;
|
||||
|
||||
method module_expr : module_expr -> module_expr;
|
||||
method module_type : module_type -> module_type;
|
||||
method class_expr : class_expr -> class_expr;
|
||||
method class_type : class_type -> class_type;
|
||||
method class_sig_item : class_sig_item -> class_sig_item;
|
||||
method class_str_item : class_str_item -> class_str_item;
|
||||
method with_constr : with_constr -> with_constr;
|
||||
method binding : binding -> binding;
|
||||
method module_binding : module_binding -> module_binding;
|
||||
method match_case : match_case -> match_case;
|
||||
method ident : ident -> ident;
|
||||
end;
|
||||
|
||||
class fold : object ('self_type)
|
||||
method string : string -> 'self_type;
|
||||
method int : int -> 'self_type;
|
||||
method float : float -> 'self_type;
|
||||
method bool : bool -> 'self_type;
|
||||
method list : ! 'a . ('self_type -> 'a -> 'self_type) -> list 'a -> 'self_type;
|
||||
method option : ! 'a . ('self_type -> 'a -> 'self_type) -> option 'a -> 'self_type;
|
||||
method array : ! 'a . ('self_type -> 'a -> 'self_type) -> array 'a -> 'self_type;
|
||||
method ref : ! 'a . ('self_type -> 'a -> 'self_type) -> ref 'a -> 'self_type;
|
||||
method meta_bool : meta_bool -> 'self_type;
|
||||
method meta_option : ! 'a . ('self_type -> 'a -> 'self_type) -> meta_option 'a -> 'self_type;
|
||||
method _Loc_t : Loc.t -> 'self_type;
|
||||
method expr : expr -> 'self_type;
|
||||
method patt : patt -> 'self_type;
|
||||
method ctyp : ctyp -> 'self_type;
|
||||
method str_item : str_item -> 'self_type;
|
||||
method sig_item : sig_item -> 'self_type;
|
||||
method module_expr : module_expr -> 'self_type;
|
||||
method module_type : module_type -> 'self_type;
|
||||
method class_expr : class_expr -> 'self_type;
|
||||
method class_type : class_type -> 'self_type;
|
||||
method class_sig_item : class_sig_item -> 'self_type;
|
||||
method class_str_item : class_str_item -> 'self_type;
|
||||
method with_constr : with_constr -> 'self_type;
|
||||
method binding : binding -> 'self_type;
|
||||
method module_binding : module_binding -> 'self_type;
|
||||
method match_case : match_case -> 'self_type;
|
||||
method ident : ident -> 'self_type;
|
||||
end;
|
||||
|
||||
end;
|
|
@ -1,37 +0,0 @@
|
|||
(****************************************************************************)
|
||||
(* *)
|
||||
(* Objective Caml *)
|
||||
(* *)
|
||||
(* INRIA Rocquencourt *)
|
||||
(* *)
|
||||
(* Copyright 2006 Institut National de Recherche en Informatique et *)
|
||||
(* en Automatique. All rights reserved. This file is distributed under *)
|
||||
(* the terms of the GNU Library General Public License, with the special *)
|
||||
(* exception on linking described in LICENSE at the top of the Objective *)
|
||||
(* Caml source tree. *)
|
||||
(* *)
|
||||
(****************************************************************************)
|
||||
|
||||
(* Authors:
|
||||
* - Nicolas Pouillard: initial version
|
||||
*)
|
||||
|
||||
(** Registerinng and folding of Ast filters.
|
||||
Two kinds of filters must be handled:
|
||||
- Implementation filters: str_item -> str_item.
|
||||
- Interface filters: sig_item -> sig_item. *)
|
||||
module type S = sig
|
||||
|
||||
module Ast : Camlp4Ast.S;
|
||||
|
||||
(** {6 Filters} *)
|
||||
|
||||
type filter 'a = 'a -> 'a;
|
||||
|
||||
value register_sig_item_filter : (filter Ast.sig_item) -> unit;
|
||||
value register_str_item_filter : (filter Ast.str_item) -> unit;
|
||||
|
||||
value fold_interf_filters : ('a -> filter Ast.sig_item -> 'a) -> 'a -> 'a;
|
||||
value fold_implem_filters : ('a -> filter Ast.str_item -> 'a) -> 'a -> 'a;
|
||||
|
||||
end;
|
|
@ -1,976 +0,0 @@
|
|||
(****************************************************************************)
|
||||
(* *)
|
||||
(* Objective Caml *)
|
||||
(* *)
|
||||
(* INRIA Rocquencourt *)
|
||||
(* *)
|
||||
(* Copyright 2006 Institut National de Recherche en Informatique et *)
|
||||
(* en Automatique. All rights reserved. This file is distributed under *)
|
||||
(* the terms of the GNU Library General Public License, with the special *)
|
||||
(* exception on linking described in LICENSE at the top of the Objective *)
|
||||
(* Caml source tree. *)
|
||||
(* *)
|
||||
(****************************************************************************)
|
||||
|
||||
(* Authors:
|
||||
* - Daniel de Rauglaudre: initial version
|
||||
* - Nicolas Pouillard: refactoring
|
||||
*)
|
||||
|
||||
(** Signature for OCaml syntax trees.
|
||||
This signature is an extension of {!Ast.S}
|
||||
It provides:
|
||||
- Types for all kinds of structure.
|
||||
- Map: A base class for map traversals.
|
||||
- Map classes and functions for common kinds. *)
|
||||
module type S = sig
|
||||
|
||||
module Loc : Loc.S;
|
||||
|
||||
type meta_bool =
|
||||
[ BTrue
|
||||
| BFalse
|
||||
| BAnt of string ];
|
||||
type meta_option 'a =
|
||||
[ ONone
|
||||
| OSome of 'a
|
||||
| OAnt of string ];
|
||||
type ident =
|
||||
[ IdAcc of Loc.t and ident and ident (* i . i *)
|
||||
| IdApp of Loc.t and ident and ident (* i i *)
|
||||
| IdLid of Loc.t and string (* foo *)
|
||||
| IdUid of Loc.t and string (* Bar *)
|
||||
| IdAnt of Loc.t and string (* $s$ *) ];
|
||||
type ctyp =
|
||||
[ TyNil of Loc.t
|
||||
| TyAli of Loc.t and ctyp and ctyp (* t as t *) (* list 'a as 'a *)
|
||||
| TyAny of Loc.t (* _ *)
|
||||
| TyApp of Loc.t and ctyp and ctyp (* t t *) (* list 'a *)
|
||||
| TyArr of Loc.t and ctyp and ctyp (* t -> t *) (* int -> string *)
|
||||
| TyCls of Loc.t and ident (* #i *) (* #point *)
|
||||
| TyLab of Loc.t and string and ctyp (* ~s *)
|
||||
| TyId of Loc.t and ident (* i *) (* Lazy.t *)
|
||||
| TyMan of Loc.t and ctyp and ctyp (* t == t *) (* type t = [ A | B ] == Foo.t *)
|
||||
(* type t 'a 'b 'c = t constraint t = t constraint t = t *)
|
||||
| TyDcl of Loc.t and string and list ctyp and ctyp and list (ctyp * ctyp)
|
||||
(* < (t)? (..)? > *) (* < move : int -> 'a .. > as 'a *)
|
||||
| TyObj of Loc.t and ctyp and meta_bool
|
||||
| TyOlb of Loc.t and string and ctyp (* ?s *)
|
||||
| TyPol of Loc.t and ctyp and ctyp (* ! t . t *) (* ! 'a . list 'a -> 'a *)
|
||||
| TyQuo of Loc.t and string (* 's *)
|
||||
| TyQuP of Loc.t and string (* +'s *)
|
||||
| TyQuM of Loc.t and string (* -'s *)
|
||||
| TyVrn of Loc.t and string (* `s *)
|
||||
| TyRec of Loc.t and ctyp (* { t } *) (* { foo : int ; bar : mutable string } *)
|
||||
| TyCol of Loc.t and ctyp and ctyp (* t : t *)
|
||||
| TySem of Loc.t and ctyp and ctyp (* t; t *)
|
||||
| TyCom of Loc.t and ctyp and ctyp (* t, t *)
|
||||
| TySum of Loc.t and ctyp (* [ t ] *) (* [ A of int and string | B ] *)
|
||||
| TyOf of Loc.t and ctyp and ctyp (* t of t *) (* A of int *)
|
||||
| TyAnd of Loc.t and ctyp and ctyp (* t and t *)
|
||||
| TyOr of Loc.t and ctyp and ctyp (* t | t *)
|
||||
| TyPrv of Loc.t and ctyp (* private t *)
|
||||
| TyMut of Loc.t and ctyp (* mutable t *)
|
||||
| TyTup of Loc.t and ctyp (* ( t ) *) (* (int * string) *)
|
||||
| TySta of Loc.t and ctyp and ctyp (* t * t *)
|
||||
| TyVrnEq of Loc.t and ctyp (* [ = t ] *)
|
||||
| TyVrnSup of Loc.t and ctyp (* [ > t ] *)
|
||||
| TyVrnInf of Loc.t and ctyp (* [ < t ] *)
|
||||
| TyVrnInfSup of Loc.t and ctyp and ctyp (* [ < t > t ] *)
|
||||
| TyAmp of Loc.t and ctyp and ctyp (* t & t *)
|
||||
| TyOfAmp of Loc.t and ctyp and ctyp (* t of & t *)
|
||||
| TyAnt of Loc.t and string (* $s$ *)
|
||||
]
|
||||
;
|
||||
type patt =
|
||||
[ PaNil of Loc.t
|
||||
| PaId of Loc.t and ident (* i *)
|
||||
| PaAli of Loc.t and patt and patt (* p as p *) (* (Node x y as n) *)
|
||||
| PaAnt of Loc.t and string (* $s$ *)
|
||||
| PaAny of Loc.t (* _ *)
|
||||
| PaApp of Loc.t and patt and patt (* p p *) (* fun x y -> *)
|
||||
| PaArr of Loc.t and patt (* [| p |] *)
|
||||
| PaCom of Loc.t and patt and patt (* p, p *)
|
||||
| PaSem of Loc.t and patt and patt (* p; p *)
|
||||
| PaChr of Loc.t and string (* c *) (* 'x' *)
|
||||
| PaInt of Loc.t and string
|
||||
| PaInt32 of Loc.t and string
|
||||
| PaInt64 of Loc.t and string
|
||||
| PaNativeInt of Loc.t and string
|
||||
| PaFlo of Loc.t and string
|
||||
| PaLab of Loc.t and string and patt (* ~s or ~s:(p) *)
|
||||
(* ?s or ?s:(p = e) or ?(p = e) *)
|
||||
(* | PaOlb of Loc.t and string and meta_option(*FIXME*) (patt * meta_option(*FIXME*) expr) *)
|
||||
(* ?s or ?s:(p) *)
|
||||
| PaOlb of Loc.t and string and patt
|
||||
(* ?s:(p = e) or ?(p = e) *)
|
||||
| PaOlbi of Loc.t and string and patt and expr
|
||||
| PaOrp of Loc.t and patt and patt (* p | p *)
|
||||
| PaRng of Loc.t and patt and patt (* p .. p *)
|
||||
| PaRec of Loc.t and patt (* { p } *)
|
||||
| PaEq of Loc.t and patt and patt (* p = p *)
|
||||
| PaStr of Loc.t and string (* s *)
|
||||
| PaTup of Loc.t and patt (* ( p ) *)
|
||||
| PaTyc of Loc.t and patt and ctyp (* (p : t) *)
|
||||
| PaTyp of Loc.t and ident (* #i *)
|
||||
| PaVrn of Loc.t and string (* `s *) ]
|
||||
and expr =
|
||||
[ ExNil of Loc.t
|
||||
| ExId of Loc.t and ident (* i *)
|
||||
| ExAcc of Loc.t and expr and expr (* e.e *)
|
||||
| ExAnt of Loc.t and string (* $s$ *)
|
||||
| ExApp of Loc.t and expr and expr (* e e *)
|
||||
| ExAre of Loc.t and expr and expr (* e.(e) *)
|
||||
| ExArr of Loc.t and expr (* [| e |] *)
|
||||
| ExSem of Loc.t and expr and expr (* e; e *)
|
||||
| ExAsf of Loc.t (* assert False *)
|
||||
| ExAsr of Loc.t and expr (* assert e *)
|
||||
| ExAss of Loc.t and expr and expr (* e := e *)
|
||||
| ExChr of Loc.t and string (* 'c' *)
|
||||
| ExCoe of Loc.t and expr and ctyp and ctyp (* (e : t) or (e : t :> t) *)
|
||||
| ExFlo of Loc.t and string (* 3.14 *)
|
||||
(* for s = e to/downto e do { e } *)
|
||||
| ExFor of Loc.t and string and expr and expr and meta_bool and expr
|
||||
| ExFun of Loc.t and match_case (* fun [ a ] *)
|
||||
| ExIfe of Loc.t and expr and expr and expr (* if e then e else e *)
|
||||
| ExInt of Loc.t and string (* 42 *)
|
||||
| ExInt32 of Loc.t and string
|
||||
| ExInt64 of Loc.t and string
|
||||
| ExNativeInt of Loc.t and string
|
||||
| ExLab of Loc.t and string and expr (* ~s or ~s:e *)
|
||||
| ExLaz of Loc.t and expr (* lazy e *)
|
||||
(* let b in e or let rec b in e *)
|
||||
| ExLet of Loc.t and meta_bool and binding and expr
|
||||
(* let module s = me in e *)
|
||||
| ExLmd of Loc.t and string and module_expr and expr
|
||||
(* match e with [ a ] *)
|
||||
| ExMat of Loc.t and expr and match_case
|
||||
(* new i *)
|
||||
| ExNew of Loc.t and ident
|
||||
(* object ((p))? (cst)? end *)
|
||||
| ExObj of Loc.t and patt and class_str_item
|
||||
(* ?s or ?s:e *)
|
||||
| ExOlb of Loc.t and string and expr
|
||||
(* {< b >} *)
|
||||
| ExOvr of Loc.t and binding
|
||||
(* { b } or { (e) with b } *)
|
||||
| ExRec of Loc.t and binding and expr
|
||||
(* do { e } *)
|
||||
| ExSeq of Loc.t and expr
|
||||
(* e#s *)
|
||||
| ExSnd of Loc.t and expr and string
|
||||
(* e.[e] *)
|
||||
| ExSte of Loc.t and expr and expr
|
||||
(* s *) (* "foo" *)
|
||||
| ExStr of Loc.t and string
|
||||
(* try e with [ a ] *)
|
||||
| ExTry of Loc.t and expr and match_case
|
||||
(* (e) *)
|
||||
| ExTup of Loc.t and expr
|
||||
(* e, e *)
|
||||
| ExCom of Loc.t and expr and expr
|
||||
(* (e : t) *)
|
||||
| ExTyc of Loc.t and expr and ctyp
|
||||
(* `s *)
|
||||
| ExVrn of Loc.t and string
|
||||
(* while e do { e } *)
|
||||
| ExWhi of Loc.t and expr and expr ]
|
||||
and module_type =
|
||||
(* i *) (* A.B.C *)
|
||||
[ MtId of Loc.t and ident
|
||||
(* functor (s : mt) -> mt *)
|
||||
| MtFun of Loc.t and string and module_type and module_type
|
||||
(* 's *)
|
||||
| MtQuo of Loc.t and string
|
||||
(* sig (sg)? end *)
|
||||
| MtSig of Loc.t and sig_item
|
||||
(* mt with wc *)
|
||||
| MtWit of Loc.t and module_type and with_constr
|
||||
| MtAnt of Loc.t and string (* $s$ *) ]
|
||||
and sig_item =
|
||||
[ SgNil of Loc.t
|
||||
(* class cict *)
|
||||
| SgCls of Loc.t and class_type
|
||||
(* class type cict *)
|
||||
| SgClt of Loc.t and class_type
|
||||
(* sg ; sg *)
|
||||
| SgSem of Loc.t and sig_item and sig_item
|
||||
(* # s or # s e *)
|
||||
| SgDir of Loc.t and string and expr
|
||||
(* exception t *)
|
||||
| SgExc of Loc.t and ctyp
|
||||
(* |+ external s : t = s ... s +|
|
||||
| SgExt of Loc.t and string and ctyp and list string *)
|
||||
(* external s : t = s *)
|
||||
| SgExt of Loc.t and string and ctyp and string
|
||||
(* include mt *)
|
||||
| SgInc of Loc.t and module_type
|
||||
(* module s : mt *)
|
||||
| SgMod of Loc.t and string and module_type
|
||||
(* module rec mb *)
|
||||
| SgRecMod of Loc.t and module_binding
|
||||
(* module type s = mt *)
|
||||
| SgMty of Loc.t and string and module_type
|
||||
(* open i *)
|
||||
| SgOpn of Loc.t and ident
|
||||
(* type t *)
|
||||
| SgTyp of Loc.t and ctyp
|
||||
(* value s : t *)
|
||||
| SgVal of Loc.t and string and ctyp
|
||||
| SgAnt of Loc.t and string (* $s$ *) ]
|
||||
and with_constr =
|
||||
[ WcNil of Loc.t
|
||||
(* type t = t *)
|
||||
| WcTyp of Loc.t and ctyp and ctyp
|
||||
(* module i = i *)
|
||||
| WcMod of Loc.t and ident and ident
|
||||
(* wc and wc *)
|
||||
| WcAnd of Loc.t and with_constr and with_constr
|
||||
| WcAnt of Loc.t and string (* $s$ *) ]
|
||||
and binding =
|
||||
[ BiNil of Loc.t
|
||||
(* b and b *) (* let a = 42 and c = 43 *)
|
||||
| BiAnd of Loc.t and binding and binding
|
||||
(* b ; b *)
|
||||
| BiSem of Loc.t and binding and binding
|
||||
(* p = e *) (* let patt = expr *)
|
||||
| BiEq of Loc.t and patt and expr
|
||||
| BiAnt of Loc.t and string (* $s$ *) ]
|
||||
and module_binding =
|
||||
[ MbNil of Loc.t
|
||||
(* mb and mb *) (* module rec (s : mt) = me and (s : mt) = me *)
|
||||
| MbAnd of Loc.t and module_binding and module_binding
|
||||
(* s : mt = me *)
|
||||
| MbColEq of Loc.t and string and module_type and module_expr
|
||||
(* s : mt *)
|
||||
| MbCol of Loc.t and string and module_type
|
||||
| MbAnt of Loc.t and string (* $s$ *) ]
|
||||
and match_case =
|
||||
[ McNil of Loc.t
|
||||
(* a | a *)
|
||||
| McOr of Loc.t and match_case and match_case
|
||||
(* p (when e)? -> e *)
|
||||
| McArr of Loc.t and patt and expr and expr
|
||||
| McAnt of Loc.t and string (* $s$ *) ]
|
||||
and module_expr =
|
||||
(* i *)
|
||||
[ MeId of Loc.t and ident
|
||||
(* me me *)
|
||||
| MeApp of Loc.t and module_expr and module_expr
|
||||
(* functor (s : mt) -> me *)
|
||||
| MeFun of Loc.t and string and module_type and module_expr
|
||||
(* struct (st)? end *)
|
||||
| MeStr of Loc.t and str_item
|
||||
(* (me : mt) *)
|
||||
| MeTyc of Loc.t and module_expr and module_type
|
||||
| MeAnt of Loc.t and string (* $s$ *) ]
|
||||
and str_item =
|
||||
[ StNil of Loc.t
|
||||
(* class cice *)
|
||||
| StCls of Loc.t and class_expr
|
||||
(* class type cict *)
|
||||
| StClt of Loc.t and class_type
|
||||
(* st ; st *)
|
||||
| StSem of Loc.t and str_item and str_item
|
||||
(* # s or # s e *)
|
||||
| StDir of Loc.t and string and expr
|
||||
(* exception t or exception t = i *)
|
||||
| StExc of Loc.t and ctyp and meta_option(*FIXME*) ident
|
||||
(* e *)
|
||||
| StExp of Loc.t and expr
|
||||
(* |+ external s : t = s ... s +|
|
||||
| StExt of Loc.t and string and ctyp and list string *)
|
||||
(* external s : t = s *)
|
||||
| StExt of Loc.t and string and ctyp and string
|
||||
(* include me *)
|
||||
| StInc of Loc.t and module_expr
|
||||
(* module s = me *)
|
||||
| StMod of Loc.t and string and module_expr
|
||||
(* module rec mb *)
|
||||
| StRecMod of Loc.t and module_binding
|
||||
(* module type s = mt *)
|
||||
| StMty of Loc.t and string and module_type
|
||||
(* open i *)
|
||||
| StOpn of Loc.t and ident
|
||||
(* type t *)
|
||||
| StTyp of Loc.t and ctyp
|
||||
(* value b or value rec b *)
|
||||
| StVal of Loc.t and meta_bool and binding
|
||||
| StAnt of Loc.t and string (* $s$ *) ]
|
||||
and class_type =
|
||||
[ CtNil of Loc.t
|
||||
(* (virtual)? i ([ t ])? *)
|
||||
| CtCon of Loc.t and meta_bool and ident and ctyp
|
||||
(* [t] -> ct *)
|
||||
| CtFun of Loc.t and ctyp and class_type
|
||||
(* object ((t))? (csg)? end *)
|
||||
| CtSig of Loc.t and ctyp and class_sig_item
|
||||
(* ct and ct *)
|
||||
| CtAnd of Loc.t and class_type and class_type
|
||||
(* ct : ct *)
|
||||
| CtCol of Loc.t and class_type and class_type
|
||||
(* ct = ct *)
|
||||
| CtEq of Loc.t and class_type and class_type
|
||||
(* $s$ *)
|
||||
| CtAnt of Loc.t and string ]
|
||||
and class_sig_item =
|
||||
[ CgNil of Loc.t
|
||||
(* type t = t *)
|
||||
| CgCtr of Loc.t and ctyp and ctyp
|
||||
(* csg ; csg *)
|
||||
| CgSem of Loc.t and class_sig_item and class_sig_item
|
||||
(* inherit ct *)
|
||||
| CgInh of Loc.t and class_type
|
||||
(* method s : t or method private s : t *)
|
||||
| CgMth of Loc.t and string and meta_bool and ctyp
|
||||
(* value (virtual)? (mutable)? s : t *)
|
||||
| CgVal of Loc.t and string and meta_bool and meta_bool and ctyp
|
||||
(* method virtual (mutable)? s : t *)
|
||||
| CgVir of Loc.t and string and meta_bool and ctyp
|
||||
| CgAnt of Loc.t and string (* $s$ *) ]
|
||||
and class_expr =
|
||||
[ CeNil of Loc.t
|
||||
(* ce e *)
|
||||
| CeApp of Loc.t and class_expr and expr
|
||||
(* (virtual)? i ([ t ])? *)
|
||||
| CeCon of Loc.t and meta_bool and ident and ctyp
|
||||
(* fun p -> ce *)
|
||||
| CeFun of Loc.t and patt and class_expr
|
||||
(* let (rec)? b in ce *)
|
||||
| CeLet of Loc.t and meta_bool and binding and class_expr
|
||||
(* object ((p))? (cst)? end *)
|
||||
| CeStr of Loc.t and patt and class_str_item
|
||||
(* ce : ct *)
|
||||
| CeTyc of Loc.t and class_expr and class_type
|
||||
(* ce and ce *)
|
||||
| CeAnd of Loc.t and class_expr and class_expr
|
||||
(* ce = ce *)
|
||||
| CeEq of Loc.t and class_expr and class_expr
|
||||
(* $s$ *)
|
||||
| CeAnt of Loc.t and string ]
|
||||
and class_str_item =
|
||||
[ CrNil of Loc.t
|
||||
(* cst ; cst *)
|
||||
| CrSem of Loc.t and class_str_item and class_str_item
|
||||
(* type t = t *)
|
||||
| CrCtr of Loc.t and ctyp and ctyp
|
||||
(* inherit ce or inherit ce as s *)
|
||||
| CrInh of Loc.t and class_expr and string
|
||||
(* initializer e *)
|
||||
| CrIni of Loc.t and expr
|
||||
(* method (private)? s : t = e or method (private)? s = e *)
|
||||
| CrMth of Loc.t and string and meta_bool and expr and ctyp
|
||||
(* value (mutable)? s = e *)
|
||||
| CrVal of Loc.t and string and meta_bool and expr
|
||||
(* method virtual (private)? s : t *)
|
||||
| CrVir of Loc.t and string and meta_bool and ctyp
|
||||
(* value virtual (private)? s : t *)
|
||||
| CrVvr of Loc.t and string and meta_bool and ctyp
|
||||
| CrAnt of Loc.t and string (* $s$ *) ];
|
||||
|
||||
value loc_of_ctyp : ctyp -> Loc.t;
|
||||
value loc_of_patt : patt -> Loc.t;
|
||||
value loc_of_expr : expr -> Loc.t;
|
||||
value loc_of_module_type : module_type -> Loc.t;
|
||||
value loc_of_module_expr : module_expr -> Loc.t;
|
||||
value loc_of_sig_item : sig_item -> Loc.t;
|
||||
value loc_of_str_item : str_item -> Loc.t;
|
||||
value loc_of_class_type : class_type -> Loc.t;
|
||||
value loc_of_class_sig_item : class_sig_item -> Loc.t;
|
||||
value loc_of_class_expr : class_expr -> Loc.t;
|
||||
value loc_of_class_str_item : class_str_item -> Loc.t;
|
||||
value loc_of_with_constr : with_constr -> Loc.t;
|
||||
value loc_of_binding : binding -> Loc.t;
|
||||
value loc_of_module_binding : module_binding -> Loc.t;
|
||||
value loc_of_match_case : match_case -> Loc.t;
|
||||
value loc_of_ident : ident -> Loc.t;
|
||||
|
||||
module Meta : sig
|
||||
module type META_LOC = sig
|
||||
(** The first location is where to put the returned pattern.
|
||||
Generally it's _loc to match with <:patt< ... >> quotations.
|
||||
The second location is the one to treat. *)
|
||||
value meta_loc_patt : Loc.t -> Loc.t -> patt;
|
||||
(** The first location is where to put the returned expression.
|
||||
Generally it's _loc to match with <:expr< ... >> quotations.
|
||||
The second location is the one to treat. *)
|
||||
value meta_loc_expr : Loc.t -> Loc.t -> expr;
|
||||
end;
|
||||
module MetaLoc : sig
|
||||
value meta_loc_patt : Loc.t -> Loc.t -> patt;
|
||||
value meta_loc_expr : Loc.t -> Loc.t -> expr;
|
||||
end;
|
||||
module MetaGhostLoc : sig
|
||||
value meta_loc_patt : Loc.t -> 'a -> patt;
|
||||
value meta_loc_expr : Loc.t -> 'a -> expr;
|
||||
end;
|
||||
module MetaLocVar : sig
|
||||
value meta_loc_patt : Loc.t -> 'a -> patt;
|
||||
value meta_loc_expr : Loc.t -> 'a -> expr;
|
||||
end;
|
||||
module Make (MetaLoc : META_LOC) : sig
|
||||
module Expr : sig
|
||||
value meta_string : Loc.t -> string -> expr;
|
||||
value meta_int : Loc.t -> string -> expr;
|
||||
value meta_float : Loc.t -> string -> expr;
|
||||
value meta_char : Loc.t -> string -> expr;
|
||||
value meta_bool : Loc.t -> bool -> expr;
|
||||
value meta_list : (Loc.t -> 'a -> expr) -> Loc.t -> list 'a -> expr;
|
||||
value meta_binding : Loc.t -> binding -> expr;
|
||||
value meta_class_expr : Loc.t -> class_expr -> expr;
|
||||
value meta_class_sig_item : Loc.t -> class_sig_item -> expr;
|
||||
value meta_class_str_item : Loc.t -> class_str_item -> expr;
|
||||
value meta_class_type : Loc.t -> class_type -> expr;
|
||||
value meta_ctyp : Loc.t -> ctyp -> expr;
|
||||
value meta_expr : Loc.t -> expr -> expr;
|
||||
value meta_ident : Loc.t -> ident -> expr;
|
||||
value meta_match_case : Loc.t -> match_case -> expr;
|
||||
value meta_meta_bool : Loc.t -> meta_bool -> expr;
|
||||
value meta_meta_option :
|
||||
(Loc.t -> ident -> expr) ->
|
||||
Loc.t -> meta_option ident -> expr;
|
||||
value meta_module_binding : Loc.t -> module_binding -> expr;
|
||||
value meta_module_expr : Loc.t -> module_expr -> expr;
|
||||
value meta_module_type : Loc.t -> module_type -> expr;
|
||||
value meta_patt : Loc.t -> patt -> expr;
|
||||
value meta_sig_item : Loc.t -> sig_item -> expr;
|
||||
value meta_str_item : Loc.t -> str_item -> expr;
|
||||
value meta_with_constr : Loc.t -> with_constr -> expr;
|
||||
end;
|
||||
module Patt : sig
|
||||
value meta_string : Loc.t -> string -> patt;
|
||||
value meta_int : Loc.t -> string -> patt;
|
||||
value meta_float : Loc.t -> string -> patt;
|
||||
value meta_char : Loc.t -> string -> patt;
|
||||
value meta_bool : Loc.t -> bool -> patt;
|
||||
value meta_list : (Loc.t -> 'a -> patt) -> Loc.t -> list 'a -> patt;
|
||||
value meta_binding : Loc.t -> binding -> patt;
|
||||
value meta_class_expr : Loc.t -> class_expr -> patt;
|
||||
value meta_class_sig_item : Loc.t -> class_sig_item -> patt;
|
||||
value meta_class_str_item : Loc.t -> class_str_item -> patt;
|
||||
value meta_class_type : Loc.t -> class_type -> patt;
|
||||
value meta_ctyp : Loc.t -> ctyp -> patt;
|
||||
value meta_expr : Loc.t -> expr -> patt;
|
||||
value meta_ident : Loc.t -> ident -> patt;
|
||||
value meta_match_case : Loc.t -> match_case -> patt;
|
||||
value meta_meta_bool : Loc.t -> meta_bool -> patt;
|
||||
value meta_meta_option :
|
||||
(Loc.t -> ident -> patt) ->
|
||||
Loc.t -> meta_option ident -> patt;
|
||||
value meta_module_binding : Loc.t -> module_binding -> patt;
|
||||
value meta_module_expr : Loc.t -> module_expr -> patt;
|
||||
value meta_module_type : Loc.t -> module_type -> patt;
|
||||
value meta_patt : Loc.t -> patt -> patt;
|
||||
value meta_sig_item : Loc.t -> sig_item -> patt;
|
||||
value meta_str_item : Loc.t -> str_item -> patt;
|
||||
value meta_with_constr : Loc.t -> with_constr -> patt;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
(** See {!Ast.S.map}. *)
|
||||
class map : object
|
||||
inherit Mapper.c;
|
||||
method meta_bool : meta_bool -> meta_bool;
|
||||
method meta_option : ! 'a 'b . ('a -> 'b) -> meta_option 'a -> meta_option 'b;
|
||||
method _Loc_t : Loc.t -> Loc.t;
|
||||
method expr : expr -> expr;
|
||||
method patt : patt -> patt;
|
||||
method ctyp : ctyp -> ctyp;
|
||||
method str_item : str_item -> str_item;
|
||||
method sig_item : sig_item -> sig_item;
|
||||
|
||||
method module_expr : module_expr -> module_expr;
|
||||
method module_type : module_type -> module_type;
|
||||
method class_expr : class_expr -> class_expr;
|
||||
method class_type : class_type -> class_type;
|
||||
method class_sig_item : class_sig_item -> class_sig_item;
|
||||
method class_str_item : class_str_item -> class_str_item;
|
||||
method with_constr : with_constr -> with_constr;
|
||||
method binding : binding -> binding;
|
||||
method module_binding : module_binding -> module_binding;
|
||||
method match_case : match_case -> match_case;
|
||||
method ident : ident -> ident;
|
||||
end;
|
||||
|
||||
(** See {!Ast.S.fold}. *)
|
||||
class fold : object ('self_type)
|
||||
method string : string -> 'self_type;
|
||||
method int : int -> 'self_type;
|
||||
method float : float -> 'self_type;
|
||||
method bool : bool -> 'self_type;
|
||||
method list : ! 'a . ('self_type -> 'a -> 'self_type) -> list 'a -> 'self_type;
|
||||
method option : ! 'a . ('self_type -> 'a -> 'self_type) -> option 'a -> 'self_type;
|
||||
method array : ! 'a . ('self_type -> 'a -> 'self_type) -> array 'a -> 'self_type;
|
||||
method ref : ! 'a . ('self_type -> 'a -> 'self_type) -> ref 'a -> 'self_type;
|
||||
method meta_bool : meta_bool -> 'self_type;
|
||||
method meta_option : ! 'a . ('self_type -> 'a -> 'self_type) -> meta_option 'a -> 'self_type;
|
||||
method _Loc_t : Loc.t -> 'self_type;
|
||||
method expr : expr -> 'self_type;
|
||||
method patt : patt -> 'self_type;
|
||||
method ctyp : ctyp -> 'self_type;
|
||||
method str_item : str_item -> 'self_type;
|
||||
method sig_item : sig_item -> 'self_type;
|
||||
method module_expr : module_expr -> 'self_type;
|
||||
method module_type : module_type -> 'self_type;
|
||||
method class_expr : class_expr -> 'self_type;
|
||||
method class_type : class_type -> 'self_type;
|
||||
method class_sig_item : class_sig_item -> 'self_type;
|
||||
method class_str_item : class_str_item -> 'self_type;
|
||||
method with_constr : with_constr -> 'self_type;
|
||||
method binding : binding -> 'self_type;
|
||||
method module_binding : module_binding -> 'self_type;
|
||||
method match_case : match_case -> 'self_type;
|
||||
method ident : ident -> 'self_type;
|
||||
end;
|
||||
|
||||
(** See {!Ast.S.remove_antiquots}. *)
|
||||
(* class remove_antiquots : object inherit map; end; *)
|
||||
|
||||
class c_expr : [expr -> expr] -> object inherit map; end;
|
||||
class c_patt : [patt -> patt] -> object inherit map; end;
|
||||
class c_ctyp : [ctyp -> ctyp] -> object inherit map; end;
|
||||
class c_str_item : [str_item -> str_item] -> object inherit map; end;
|
||||
class c_sig_item : [sig_item -> sig_item] -> object inherit map; end;
|
||||
class c_loc : [Loc.t -> Loc.t] -> object inherit map; end;
|
||||
|
||||
value map_expr : (expr -> expr) -> expr -> expr;
|
||||
value map_patt : (patt -> patt) -> patt -> patt;
|
||||
value map_ctyp : (ctyp -> ctyp) -> ctyp -> ctyp;
|
||||
value map_str_item : (str_item -> str_item) -> str_item -> str_item;
|
||||
value map_sig_item : (sig_item -> sig_item) -> sig_item -> sig_item;
|
||||
value map_loc : (Loc.t -> Loc.t) -> Loc.t -> Loc.t;
|
||||
|
||||
value ident_of_expr : expr -> ident;
|
||||
value ident_of_ctyp : ctyp -> ident;
|
||||
|
||||
value biAnd_of_list : list binding -> binding;
|
||||
value biSem_of_list : list binding -> binding;
|
||||
value paSem_of_list : list patt -> patt;
|
||||
value paCom_of_list : list patt -> patt;
|
||||
value tyOr_of_list : list ctyp -> ctyp;
|
||||
value tyAnd_of_list : list ctyp -> ctyp;
|
||||
value tySem_of_list : list ctyp -> ctyp;
|
||||
value stSem_of_list : list str_item -> str_item;
|
||||
value sgSem_of_list : list sig_item -> sig_item;
|
||||
value crSem_of_list : list class_str_item -> class_str_item;
|
||||
value cgSem_of_list : list class_sig_item -> class_sig_item;
|
||||
value ctAnd_of_list : list class_type -> class_type;
|
||||
value ceAnd_of_list : list class_expr -> class_expr;
|
||||
value wcAnd_of_list : list with_constr -> with_constr;
|
||||
value meApp_of_list : list module_expr -> module_expr;
|
||||
value mbAnd_of_list : list module_binding -> module_binding;
|
||||
value mcOr_of_list : list match_case -> match_case;
|
||||
value idAcc_of_list : list ident -> ident;
|
||||
value idApp_of_list : list ident -> ident;
|
||||
value exSem_of_list : list expr -> expr;
|
||||
value exCom_of_list : list expr -> expr;
|
||||
|
||||
value list_of_ctyp : ctyp -> list ctyp -> list ctyp;
|
||||
value list_of_binding : binding -> list binding -> list binding;
|
||||
value list_of_with_constr : with_constr -> list with_constr -> list with_constr;
|
||||
value list_of_patt : patt -> list patt -> list patt;
|
||||
value list_of_expr : expr -> list expr -> list expr;
|
||||
value list_of_str_item : str_item -> list str_item -> list str_item;
|
||||
value list_of_sig_item : sig_item -> list sig_item -> list sig_item;
|
||||
value list_of_class_sig_item : class_sig_item -> list class_sig_item -> list class_sig_item;
|
||||
value list_of_class_str_item : class_str_item -> list class_str_item -> list class_str_item;
|
||||
value list_of_class_type : class_type -> list class_type -> list class_type;
|
||||
value list_of_class_expr : class_expr -> list class_expr -> list class_expr;
|
||||
value list_of_module_expr : module_expr -> list module_expr -> list module_expr;
|
||||
value list_of_module_binding : module_binding -> list module_binding -> list module_binding;
|
||||
value list_of_match_case : match_case -> list match_case -> list match_case;
|
||||
value list_of_ident : ident -> list ident -> list ident;
|
||||
|
||||
(** Like [String.escape] but takes care to not
|
||||
escape antiquotations strings. *)
|
||||
value safe_string_escaped : string -> string;
|
||||
|
||||
(** Returns True if the given pattern is irrefutable. *)
|
||||
value is_irrefut_patt : patt -> bool;
|
||||
|
||||
value is_constructor : ident -> bool;
|
||||
value is_patt_constructor : patt -> bool;
|
||||
value is_expr_constructor : expr -> bool;
|
||||
|
||||
value ty_of_stl : (Loc.t * string * list ctyp) -> ctyp;
|
||||
value ty_of_sbt : (Loc.t * string * bool * ctyp) -> ctyp;
|
||||
value bi_of_pe : (patt * expr) -> binding;
|
||||
value pel_of_binding : binding -> list (patt * expr);
|
||||
value binding_of_pel : list (patt * expr) -> binding;
|
||||
value sum_type_of_list : list (Loc.t * string * list ctyp) -> ctyp;
|
||||
value record_type_of_list : list (Loc.t * string * bool * ctyp) -> ctyp;
|
||||
end;
|
||||
|
||||
(** This functor is a restriction functor.
|
||||
It takes a Camlp4Ast module and gives the Ast one.
|
||||
Typical use is for [with] constraints.
|
||||
Example: ... with module Ast = Camlp4.Sig.Camlp4Ast.ToAst Camlp4Ast *)
|
||||
module ToAst (M : S) : Ast.S
|
||||
with module Loc = M.Loc
|
||||
and type meta_bool = M.meta_bool
|
||||
and type meta_option 'a = M.meta_option 'a
|
||||
and type ctyp = M.ctyp
|
||||
and type patt = M.patt
|
||||
and type expr = M.expr
|
||||
and type module_type = M.module_type
|
||||
and type sig_item = M.sig_item
|
||||
and type with_constr = M.with_constr
|
||||
and type module_expr = M.module_expr
|
||||
and type str_item = M.str_item
|
||||
and type class_type = M.class_type
|
||||
and type class_sig_item = M.class_sig_item
|
||||
and type class_expr = M.class_expr
|
||||
and type class_str_item = M.class_str_item
|
||||
and type binding = M.binding
|
||||
and type module_binding = M.module_binding
|
||||
and type match_case = M.match_case
|
||||
and type ident = M.ident
|
||||
= M;
|
||||
|
||||
(** Since the Ast contains locations. This functor produces Ast types
|
||||
for a given location type. *)
|
||||
module Make (Loc : Type.S) = struct
|
||||
|
||||
type meta_bool =
|
||||
[ BTrue
|
||||
| BFalse
|
||||
| BAnt of string ];
|
||||
type meta_option 'a =
|
||||
[ ONone
|
||||
| OSome of 'a
|
||||
| OAnt of string ];
|
||||
type ident =
|
||||
[ IdAcc of Loc.t and ident and ident (* i . i *)
|
||||
| IdApp of Loc.t and ident and ident (* i i *)
|
||||
| IdLid of Loc.t and string (* foo *)
|
||||
| IdUid of Loc.t and string (* Bar *)
|
||||
| IdAnt of Loc.t and string (* $s$ *) ];
|
||||
type ctyp =
|
||||
[ TyNil of Loc.t
|
||||
| TyAli of Loc.t and ctyp and ctyp (* t as t *) (* list 'a as 'a *)
|
||||
| TyAny of Loc.t (* _ *)
|
||||
| TyApp of Loc.t and ctyp and ctyp (* t t *) (* list 'a *)
|
||||
| TyArr of Loc.t and ctyp and ctyp (* t -> t *) (* int -> string *)
|
||||
| TyCls of Loc.t and ident (* #i *) (* #point *)
|
||||
| TyLab of Loc.t and string and ctyp (* ~s *)
|
||||
| TyId of Loc.t and ident (* i *) (* Lazy.t *)
|
||||
| TyMan of Loc.t and ctyp and ctyp (* t == t *) (* type t = [ A | B ] == Foo.t *)
|
||||
(* type t 'a 'b 'c = t constraint t = t constraint t = t *)
|
||||
| TyDcl of Loc.t and string and list ctyp and ctyp and list (ctyp * ctyp)
|
||||
(* < (t)? (..)? > *) (* < move : int -> 'a .. > as 'a *)
|
||||
| TyObj of Loc.t and ctyp and meta_bool
|
||||
| TyOlb of Loc.t and string and ctyp (* ?s *)
|
||||
| TyPol of Loc.t and ctyp and ctyp (* ! t . t *) (* ! 'a . list 'a -> 'a *)
|
||||
| TyQuo of Loc.t and string (* 's *)
|
||||
| TyQuP of Loc.t and string (* +'s *)
|
||||
| TyQuM of Loc.t and string (* -'s *)
|
||||
| TyVrn of Loc.t and string (* `s *)
|
||||
| TyRec of Loc.t and ctyp (* { t } *) (* { foo : int ; bar : mutable string } *)
|
||||
| TyCol of Loc.t and ctyp and ctyp (* t : t *)
|
||||
| TySem of Loc.t and ctyp and ctyp (* t; t *)
|
||||
| TyCom of Loc.t and ctyp and ctyp (* t, t *)
|
||||
| TySum of Loc.t and ctyp (* [ t ] *) (* [ A of int and string | B ] *)
|
||||
| TyOf of Loc.t and ctyp and ctyp (* t of t *) (* A of int *)
|
||||
| TyAnd of Loc.t and ctyp and ctyp (* t and t *)
|
||||
| TyOr of Loc.t and ctyp and ctyp (* t | t *)
|
||||
| TyPrv of Loc.t and ctyp (* private t *)
|
||||
| TyMut of Loc.t and ctyp (* mutable t *)
|
||||
| TyTup of Loc.t and ctyp (* ( t ) *) (* (int * string) *)
|
||||
| TySta of Loc.t and ctyp and ctyp (* t * t *)
|
||||
| TyVrnEq of Loc.t and ctyp (* [ = t ] *)
|
||||
| TyVrnSup of Loc.t and ctyp (* [ > t ] *)
|
||||
| TyVrnInf of Loc.t and ctyp (* [ < t ] *)
|
||||
| TyVrnInfSup of Loc.t and ctyp and ctyp (* [ < t > t ] *)
|
||||
| TyAmp of Loc.t and ctyp and ctyp (* t & t *)
|
||||
| TyOfAmp of Loc.t and ctyp and ctyp (* t of & t *)
|
||||
| TyAnt of Loc.t and string (* $s$ *)
|
||||
]
|
||||
;
|
||||
type patt =
|
||||
[ PaNil of Loc.t
|
||||
| PaId of Loc.t and ident (* i *)
|
||||
| PaAli of Loc.t and patt and patt (* p as p *) (* (Node x y as n) *)
|
||||
| PaAnt of Loc.t and string (* $s$ *)
|
||||
| PaAny of Loc.t (* _ *)
|
||||
| PaApp of Loc.t and patt and patt (* p p *) (* fun x y -> *)
|
||||
| PaArr of Loc.t and patt (* [| p |] *)
|
||||
| PaCom of Loc.t and patt and patt (* p, p *)
|
||||
| PaSem of Loc.t and patt and patt (* p; p *)
|
||||
| PaChr of Loc.t and string (* c *) (* 'x' *)
|
||||
| PaInt of Loc.t and string
|
||||
| PaInt32 of Loc.t and string
|
||||
| PaInt64 of Loc.t and string
|
||||
| PaNativeInt of Loc.t and string
|
||||
| PaFlo of Loc.t and string
|
||||
| PaLab of Loc.t and string and patt (* ~s or ~s:(p) *)
|
||||
(* ?s or ?s:(p = e) or ?(p = e) *)
|
||||
(* | PaOlb of Loc.t and string and (patt * meta_option(*FIXME*) expr) *)
|
||||
(* ?s or ?s:(p) *)
|
||||
| PaOlb of Loc.t and string and patt
|
||||
(* ?s:(p = e) or ?(p = e) *)
|
||||
| PaOlbi of Loc.t and string and patt and expr
|
||||
| PaOrp of Loc.t and patt and patt (* p | p *)
|
||||
| PaRng of Loc.t and patt and patt (* p .. p *)
|
||||
| PaRec of Loc.t and patt (* { p } *)
|
||||
| PaEq of Loc.t and patt and patt (* p = p *)
|
||||
| PaStr of Loc.t and string (* s *)
|
||||
| PaTup of Loc.t and patt (* ( p ) *)
|
||||
| PaTyc of Loc.t and patt and ctyp (* (p : t) *)
|
||||
| PaTyp of Loc.t and ident (* #i *)
|
||||
| PaVrn of Loc.t and string (* `s *) ]
|
||||
and expr =
|
||||
[ ExNil of Loc.t
|
||||
| ExId of Loc.t and ident (* i *)
|
||||
| ExAcc of Loc.t and expr and expr (* e.e *)
|
||||
| ExAnt of Loc.t and string (* $s$ *)
|
||||
| ExApp of Loc.t and expr and expr (* e e *)
|
||||
| ExAre of Loc.t and expr and expr (* e.(e) *)
|
||||
| ExArr of Loc.t and expr (* [| e |] *)
|
||||
| ExSem of Loc.t and expr and expr (* e; e *)
|
||||
| ExAsf of Loc.t (* assert False *)
|
||||
| ExAsr of Loc.t and expr (* assert e *)
|
||||
| ExAss of Loc.t and expr and expr (* e := e *)
|
||||
| ExChr of Loc.t and string (* 'c' *)
|
||||
| ExCoe of Loc.t and expr and ctyp and ctyp (* (e : t) or (e : t :> t) *)
|
||||
| ExFlo of Loc.t and string (* 3.14 *)
|
||||
(* for s = e to/downto e do { e } *)
|
||||
| ExFor of Loc.t and string and expr and expr and meta_bool and expr
|
||||
| ExFun of Loc.t and match_case (* fun [ a ] *)
|
||||
| ExIfe of Loc.t and expr and expr and expr (* if e then e else e *)
|
||||
| ExInt of Loc.t and string (* 42 *)
|
||||
| ExInt32 of Loc.t and string
|
||||
| ExInt64 of Loc.t and string
|
||||
| ExNativeInt of Loc.t and string
|
||||
| ExLab of Loc.t and string and expr (* ~s or ~s:e *)
|
||||
| ExLaz of Loc.t and expr (* lazy e *)
|
||||
(* let b in e or let rec b in e *)
|
||||
| ExLet of Loc.t and meta_bool and binding and expr
|
||||
(* let module s = me in e *)
|
||||
| ExLmd of Loc.t and string and module_expr and expr
|
||||
(* match e with [ a ] *)
|
||||
| ExMat of Loc.t and expr and match_case
|
||||
(* new i *)
|
||||
| ExNew of Loc.t and ident
|
||||
(* object ((p))? (cst)? end *)
|
||||
| ExObj of Loc.t and patt and class_str_item
|
||||
(* ?s or ?s:e *)
|
||||
| ExOlb of Loc.t and string and expr
|
||||
(* {< b >} *)
|
||||
| ExOvr of Loc.t and binding
|
||||
(* { b } or { (e) with b } *)
|
||||
| ExRec of Loc.t and binding and expr
|
||||
(* do { e } *)
|
||||
| ExSeq of Loc.t and expr
|
||||
(* e#s *)
|
||||
| ExSnd of Loc.t and expr and string
|
||||
(* e.[e] *)
|
||||
| ExSte of Loc.t and expr and expr
|
||||
(* s *) (* "foo" *)
|
||||
| ExStr of Loc.t and string
|
||||
(* try e with [ a ] *)
|
||||
| ExTry of Loc.t and expr and match_case
|
||||
(* (e) *)
|
||||
| ExTup of Loc.t and expr
|
||||
(* e, e *)
|
||||
| ExCom of Loc.t and expr and expr
|
||||
(* (e : t) *)
|
||||
| ExTyc of Loc.t and expr and ctyp
|
||||
(* `s *)
|
||||
| ExVrn of Loc.t and string
|
||||
(* while e do { e } *)
|
||||
| ExWhi of Loc.t and expr and expr ]
|
||||
and module_type =
|
||||
(* i *) (* A.B.C *)
|
||||
[ MtId of Loc.t and ident
|
||||
(* functor (s : mt) -> mt *)
|
||||
| MtFun of Loc.t and string and module_type and module_type
|
||||
(* 's *)
|
||||
| MtQuo of Loc.t and string
|
||||
(* sig (sg)? end *)
|
||||
| MtSig of Loc.t and sig_item
|
||||
(* mt with wc *)
|
||||
| MtWit of Loc.t and module_type and with_constr
|
||||
| MtAnt of Loc.t and string (* $s$ *) ]
|
||||
and sig_item =
|
||||
[ SgNil of Loc.t
|
||||
(* class cict *)
|
||||
| SgCls of Loc.t and class_type
|
||||
(* class type cict *)
|
||||
| SgClt of Loc.t and class_type
|
||||
(* sg ; sg *)
|
||||
| SgSem of Loc.t and sig_item and sig_item
|
||||
(* # s or # s e *)
|
||||
| SgDir of Loc.t and string and expr
|
||||
(* exception t *)
|
||||
| SgExc of Loc.t and ctyp
|
||||
(* |+ external s : t = s ... s +|
|
||||
| SgExt of Loc.t and string and ctyp and list string *)
|
||||
(* external s : t = s *)
|
||||
| SgExt of Loc.t and string and ctyp and string
|
||||
(* include mt *)
|
||||
| SgInc of Loc.t and module_type
|
||||
(* module s : mt *)
|
||||
| SgMod of Loc.t and string and module_type
|
||||
(* module rec mb *)
|
||||
| SgRecMod of Loc.t and module_binding
|
||||
(* module type s = mt *)
|
||||
| SgMty of Loc.t and string and module_type
|
||||
(* open i *)
|
||||
| SgOpn of Loc.t and ident
|
||||
(* type t *)
|
||||
| SgTyp of Loc.t and ctyp
|
||||
(* value s : t *)
|
||||
| SgVal of Loc.t and string and ctyp
|
||||
| SgAnt of Loc.t and string (* $s$ *) ]
|
||||
and with_constr =
|
||||
[ WcNil of Loc.t
|
||||
(* type t = t *)
|
||||
| WcTyp of Loc.t and ctyp and ctyp
|
||||
(* module i = i *)
|
||||
| WcMod of Loc.t and ident and ident
|
||||
(* wc and wc *)
|
||||
| WcAnd of Loc.t and with_constr and with_constr
|
||||
| WcAnt of Loc.t and string (* $s$ *) ]
|
||||
and binding =
|
||||
[ BiNil of Loc.t
|
||||
(* b and b *) (* let a = 42 and c = 43 *)
|
||||
| BiAnd of Loc.t and binding and binding
|
||||
(* b ; b *)
|
||||
| BiSem of Loc.t and binding and binding
|
||||
(* p = e *) (* let patt = expr *)
|
||||
| BiEq of Loc.t and patt and expr
|
||||
| BiAnt of Loc.t and string (* $s$ *) ]
|
||||
and module_binding =
|
||||
[ MbNil of Loc.t
|
||||
(* mb and mb *) (* module rec (s : mt) = me and (s : mt) = me *)
|
||||
| MbAnd of Loc.t and module_binding and module_binding
|
||||
(* s : mt = me *)
|
||||
| MbColEq of Loc.t and string and module_type and module_expr
|
||||
(* s : mt *)
|
||||
| MbCol of Loc.t and string and module_type
|
||||
| MbAnt of Loc.t and string (* $s$ *) ]
|
||||
and match_case =
|
||||
[ McNil of Loc.t
|
||||
(* a | a *)
|
||||
| McOr of Loc.t and match_case and match_case
|
||||
(* p (when e)? -> e *)
|
||||
| McArr of Loc.t and patt and expr and expr
|
||||
| McAnt of Loc.t and string (* $s$ *) ]
|
||||
and module_expr =
|
||||
(* i *)
|
||||
[ MeId of Loc.t and ident
|
||||
(* me me *)
|
||||
| MeApp of Loc.t and module_expr and module_expr
|
||||
(* functor (s : mt) -> me *)
|
||||
| MeFun of Loc.t and string and module_type and module_expr
|
||||
(* struct (st)? end *)
|
||||
| MeStr of Loc.t and str_item
|
||||
(* (me : mt) *)
|
||||
| MeTyc of Loc.t and module_expr and module_type
|
||||
| MeAnt of Loc.t and string (* $s$ *) ]
|
||||
and str_item =
|
||||
[ StNil of Loc.t
|
||||
(* class cice *)
|
||||
| StCls of Loc.t and class_expr
|
||||
(* class type cict *)
|
||||
| StClt of Loc.t and class_type
|
||||
(* st ; st *)
|
||||
| StSem of Loc.t and str_item and str_item
|
||||
(* # s or # s e *)
|
||||
| StDir of Loc.t and string and expr
|
||||
(* exception t or exception t = i *)
|
||||
| StExc of Loc.t and ctyp and meta_option(*FIXME*) ident
|
||||
(* e *)
|
||||
| StExp of Loc.t and expr
|
||||
(* |+ external s : t = s ... s +|
|
||||
| StExt of Loc.t and string and ctyp and list string *)
|
||||
(* external s : t = s *)
|
||||
| StExt of Loc.t and string and ctyp and string
|
||||
(* include me *)
|
||||
| StInc of Loc.t and module_expr
|
||||
(* module s = me *)
|
||||
| StMod of Loc.t and string and module_expr
|
||||
(* module rec mb *)
|
||||
| StRecMod of Loc.t and module_binding
|
||||
(* module type s = mt *)
|
||||
| StMty of Loc.t and string and module_type
|
||||
(* open i *)
|
||||
| StOpn of Loc.t and ident
|
||||
(* type t *)
|
||||
| StTyp of Loc.t and ctyp
|
||||
(* value b or value rec b *)
|
||||
| StVal of Loc.t and meta_bool and binding
|
||||
| StAnt of Loc.t and string (* $s$ *) ]
|
||||
and class_type =
|
||||
[ CtNil of Loc.t
|
||||
(* (virtual)? i ([ t ])? *)
|
||||
| CtCon of Loc.t and meta_bool and ident and ctyp
|
||||
(* [t] -> ct *)
|
||||
| CtFun of Loc.t and ctyp and class_type
|
||||
(* object ((t))? (csg)? end *)
|
||||
| CtSig of Loc.t and ctyp and class_sig_item
|
||||
(* ct and ct *)
|
||||
| CtAnd of Loc.t and class_type and class_type
|
||||
(* ct : ct *)
|
||||
| CtCol of Loc.t and class_type and class_type
|
||||
(* ct = ct *)
|
||||
| CtEq of Loc.t and class_type and class_type
|
||||
(* $s$ *)
|
||||
| CtAnt of Loc.t and string ]
|
||||
and class_sig_item =
|
||||
[ CgNil of Loc.t
|
||||
(* type t = t *)
|
||||
| CgCtr of Loc.t and ctyp and ctyp
|
||||
(* csg ; csg *)
|
||||
| CgSem of Loc.t and class_sig_item and class_sig_item
|
||||
(* inherit ct *)
|
||||
| CgInh of Loc.t and class_type
|
||||
(* method s : t or method private s : t *)
|
||||
| CgMth of Loc.t and string and meta_bool and ctyp
|
||||
(* value (virtual)? (mutable)? s : t *)
|
||||
| CgVal of Loc.t and string and meta_bool and meta_bool and ctyp
|
||||
(* method virtual (mutable)? s : t *)
|
||||
| CgVir of Loc.t and string and meta_bool and ctyp
|
||||
| CgAnt of Loc.t and string (* $s$ *) ]
|
||||
and class_expr =
|
||||
[ CeNil of Loc.t
|
||||
(* ce e *)
|
||||
| CeApp of Loc.t and class_expr and expr
|
||||
(* (virtual)? i ([ t ])? *)
|
||||
| CeCon of Loc.t and meta_bool and ident and ctyp
|
||||
(* fun p -> ce *)
|
||||
| CeFun of Loc.t and patt and class_expr
|
||||
(* let (rec)? b in ce *)
|
||||
| CeLet of Loc.t and meta_bool and binding and class_expr
|
||||
(* object ((p))? (cst)? end *)
|
||||
| CeStr of Loc.t and patt and class_str_item
|
||||
(* ce : ct *)
|
||||
| CeTyc of Loc.t and class_expr and class_type
|
||||
(* ce and ce *)
|
||||
| CeAnd of Loc.t and class_expr and class_expr
|
||||
(* ce = ce *)
|
||||
| CeEq of Loc.t and class_expr and class_expr
|
||||
(* $s$ *)
|
||||
| CeAnt of Loc.t and string ]
|
||||
and class_str_item =
|
||||
[ CrNil of Loc.t
|
||||
(* cst ; cst *)
|
||||
| CrSem of Loc.t and class_str_item and class_str_item
|
||||
(* type t = t *)
|
||||
| CrCtr of Loc.t and ctyp and ctyp
|
||||
(* inherit ce or inherit ce as s *)
|
||||
| CrInh of Loc.t and class_expr and string
|
||||
(* initializer e *)
|
||||
| CrIni of Loc.t and expr
|
||||
(* method (private)? s : t = e or method (private)? s = e *)
|
||||
| CrMth of Loc.t and string and meta_bool and expr and ctyp
|
||||
(* value (mutable)? s = e *)
|
||||
| CrVal of Loc.t and string and meta_bool and expr
|
||||
(* method virtual (private)? s : t *)
|
||||
| CrVir of Loc.t and string and meta_bool and ctyp
|
||||
(* value virtual (private)? s : t *)
|
||||
| CrVvr of Loc.t and string and meta_bool and ctyp
|
||||
| CrAnt of Loc.t and string (* $s$ *) ];
|
||||
end;
|
||||
|
|
@ -1,184 +0,0 @@
|
|||
(****************************************************************************)
|
||||
(* *)
|
||||
(* Objective Caml *)
|
||||
(* *)
|
||||
(* INRIA Rocquencourt *)
|
||||
(* *)
|
||||
(* Copyright 2006 Institut National de Recherche en Informatique et *)
|
||||
(* en Automatique. All rights reserved. This file is distributed under *)
|
||||
(* the terms of the GNU Library General Public License, with the special *)
|
||||
(* exception on linking described in LICENSE at the top of the Objective *)
|
||||
(* Caml source tree. *)
|
||||
(* *)
|
||||
(****************************************************************************)
|
||||
|
||||
(* Authors:
|
||||
* - Daniel de Rauglaudre: initial version
|
||||
* - Nicolas Pouillard: refactoring
|
||||
*)
|
||||
|
||||
(** A syntax module is a sort of constistent bunch of modules and values.
|
||||
In such a module you have a parser, a printer, and also modules for
|
||||
locations, syntax trees, tokens, grammars, quotations, anti-quotations.
|
||||
There is also the main grammar entries. *)
|
||||
module type S = sig
|
||||
module Loc : Loc.S;
|
||||
module Warning : Warning.S with module Loc = Loc;
|
||||
|
||||
module Ast : Camlp4Ast.S with module Loc = Loc;
|
||||
module Token : Camlp4Token.S with module Loc = Loc;
|
||||
|
||||
module Gram : Grammar.Static.S with module Loc = Loc and module Token = Token;
|
||||
module AntiquotSyntax : AntiquotSyntax.S with module Ast = Camlp4Ast.ToAst Ast;
|
||||
(* Gram is not constrained here for flexibility *)
|
||||
module Quotation : Quotation.S with module Ast = Camlp4Ast.ToAst Ast;
|
||||
module Parser : Parser.S with module Ast = Camlp4Ast.ToAst Ast;
|
||||
module Printer : Printer.S with module Ast = Camlp4Ast.ToAst Ast;
|
||||
|
||||
value interf : Gram.Entry.t (list Ast.sig_item * option Loc.t);
|
||||
value implem : Gram.Entry.t (list Ast.str_item * option Loc.t);
|
||||
value top_phrase : Gram.Entry.t (option Ast.str_item);
|
||||
value use_file : Gram.Entry.t (list Ast.str_item * option Loc.t);
|
||||
value a_CHAR : Gram.Entry.t string;
|
||||
value a_FLOAT : Gram.Entry.t string;
|
||||
value a_INT : Gram.Entry.t string;
|
||||
value a_INT32 : Gram.Entry.t string;
|
||||
value a_INT64 : Gram.Entry.t string;
|
||||
value a_LABEL : Gram.Entry.t string;
|
||||
value a_LIDENT : Gram.Entry.t string;
|
||||
value a_LIDENT_or_operator : Gram.Entry.t string;
|
||||
value a_NATIVEINT : Gram.Entry.t string;
|
||||
value a_OPTLABEL : Gram.Entry.t string;
|
||||
value a_STRING : Gram.Entry.t string;
|
||||
value a_UIDENT : Gram.Entry.t string;
|
||||
value a_ident : Gram.Entry.t string;
|
||||
value amp_ctyp : Gram.Entry.t Ast.ctyp;
|
||||
value and_ctyp : Gram.Entry.t Ast.ctyp;
|
||||
value match_case : Gram.Entry.t Ast.match_case;
|
||||
value match_case0 : Gram.Entry.t Ast.match_case;
|
||||
value match_case_quot : Gram.Entry.t Ast.match_case;
|
||||
value binding : Gram.Entry.t Ast.binding;
|
||||
value binding_quot : Gram.Entry.t Ast.binding;
|
||||
value class_declaration : Gram.Entry.t Ast.class_expr;
|
||||
value class_description : Gram.Entry.t Ast.class_type;
|
||||
value class_expr : Gram.Entry.t Ast.class_expr;
|
||||
value class_expr_quot : Gram.Entry.t Ast.class_expr;
|
||||
value class_fun_binding : Gram.Entry.t Ast.class_expr;
|
||||
value class_fun_def : Gram.Entry.t Ast.class_expr;
|
||||
value class_info_for_class_expr : Gram.Entry.t Ast.class_expr;
|
||||
value class_info_for_class_type : Gram.Entry.t Ast.class_type;
|
||||
value class_longident : Gram.Entry.t Ast.ident;
|
||||
value class_longident_and_param : Gram.Entry.t Ast.class_expr;
|
||||
value class_name_and_param : Gram.Entry.t (string * Ast.ctyp);
|
||||
value class_sig_item : Gram.Entry.t Ast.class_sig_item;
|
||||
value class_sig_item_quot : Gram.Entry.t Ast.class_sig_item;
|
||||
value class_signature : Gram.Entry.t Ast.class_sig_item;
|
||||
value class_str_item : Gram.Entry.t Ast.class_str_item;
|
||||
value class_str_item_quot : Gram.Entry.t Ast.class_str_item;
|
||||
value class_structure : Gram.Entry.t Ast.class_str_item;
|
||||
value class_type : Gram.Entry.t Ast.class_type;
|
||||
value class_type_declaration : Gram.Entry.t Ast.class_type;
|
||||
value class_type_longident : Gram.Entry.t Ast.ident;
|
||||
value class_type_longident_and_param : Gram.Entry.t Ast.class_type;
|
||||
value class_type_plus : Gram.Entry.t Ast.class_type;
|
||||
value class_type_quot : Gram.Entry.t Ast.class_type;
|
||||
value comma_ctyp : Gram.Entry.t Ast.ctyp;
|
||||
value comma_expr : Gram.Entry.t Ast.expr;
|
||||
value comma_ipatt : Gram.Entry.t Ast.patt;
|
||||
value comma_patt : Gram.Entry.t Ast.patt;
|
||||
value comma_type_parameter : Gram.Entry.t Ast.ctyp;
|
||||
value constrain : Gram.Entry.t (Ast.ctyp * Ast.ctyp);
|
||||
value constructor_arg_list : Gram.Entry.t Ast.ctyp;
|
||||
value constructor_declaration : Gram.Entry.t Ast.ctyp;
|
||||
value constructor_declarations : Gram.Entry.t Ast.ctyp;
|
||||
value ctyp : Gram.Entry.t Ast.ctyp;
|
||||
value ctyp_quot : Gram.Entry.t Ast.ctyp;
|
||||
value cvalue_binding : Gram.Entry.t Ast.expr;
|
||||
value direction_flag : Gram.Entry.t Ast.meta_bool;
|
||||
value dummy : Gram.Entry.t unit;
|
||||
value eq_expr : Gram.Entry.t (string -> Ast.patt -> Ast.patt);
|
||||
value expr : Gram.Entry.t Ast.expr;
|
||||
value expr_eoi : Gram.Entry.t Ast.expr;
|
||||
value expr_quot : Gram.Entry.t Ast.expr;
|
||||
value field : Gram.Entry.t Ast.ctyp;
|
||||
value field_expr : Gram.Entry.t Ast.binding;
|
||||
value fun_binding : Gram.Entry.t Ast.expr;
|
||||
value fun_def : Gram.Entry.t Ast.expr;
|
||||
value ident : Gram.Entry.t Ast.ident;
|
||||
value ident_quot : Gram.Entry.t Ast.ident;
|
||||
value ipatt : Gram.Entry.t Ast.patt;
|
||||
value ipatt_tcon : Gram.Entry.t Ast.patt;
|
||||
value label : Gram.Entry.t string;
|
||||
value label_declaration : Gram.Entry.t Ast.ctyp;
|
||||
value label_expr : Gram.Entry.t Ast.binding;
|
||||
value label_ipatt : Gram.Entry.t Ast.patt;
|
||||
value label_longident : Gram.Entry.t Ast.ident;
|
||||
value label_patt : Gram.Entry.t Ast.patt;
|
||||
value labeled_ipatt : Gram.Entry.t Ast.patt;
|
||||
value let_binding : Gram.Entry.t Ast.binding;
|
||||
value meth_list : Gram.Entry.t Ast.ctyp;
|
||||
value module_binding : Gram.Entry.t Ast.module_binding;
|
||||
value module_binding0 : Gram.Entry.t Ast.module_expr;
|
||||
value module_binding_quot : Gram.Entry.t Ast.module_binding;
|
||||
value module_declaration : Gram.Entry.t Ast.module_type;
|
||||
value module_expr : Gram.Entry.t Ast.module_expr;
|
||||
value module_expr_quot : Gram.Entry.t Ast.module_expr;
|
||||
value module_longident : Gram.Entry.t Ast.ident;
|
||||
value module_longident_with_app : Gram.Entry.t Ast.ident;
|
||||
value module_rec_declaration : Gram.Entry.t Ast.module_binding;
|
||||
value module_type : Gram.Entry.t Ast.module_type;
|
||||
value module_type_quot : Gram.Entry.t Ast.module_type;
|
||||
value more_ctyp : Gram.Entry.t Ast.ctyp;
|
||||
value name_tags : Gram.Entry.t Ast.ctyp;
|
||||
value opt_as_lident : Gram.Entry.t string;
|
||||
value opt_class_self_patt : Gram.Entry.t Ast.patt;
|
||||
value opt_class_self_type : Gram.Entry.t Ast.ctyp;
|
||||
value opt_comma_ctyp : Gram.Entry.t Ast.ctyp;
|
||||
value opt_dot_dot : Gram.Entry.t Ast.meta_bool;
|
||||
value opt_eq_ctyp : Gram.Entry.t (list Ast.ctyp -> Ast.ctyp);
|
||||
value opt_expr : Gram.Entry.t Ast.expr;
|
||||
value opt_meth_list : Gram.Entry.t Ast.ctyp;
|
||||
value opt_mutable : Gram.Entry.t Ast.meta_bool;
|
||||
value opt_polyt : Gram.Entry.t Ast.ctyp;
|
||||
value opt_private : Gram.Entry.t Ast.meta_bool;
|
||||
value opt_rec : Gram.Entry.t Ast.meta_bool;
|
||||
value opt_virtual : Gram.Entry.t Ast.meta_bool;
|
||||
value opt_when_expr : Gram.Entry.t Ast.expr;
|
||||
value patt : Gram.Entry.t Ast.patt;
|
||||
value patt_as_patt_opt : Gram.Entry.t Ast.patt;
|
||||
value patt_eoi : Gram.Entry.t Ast.patt;
|
||||
value patt_quot : Gram.Entry.t Ast.patt;
|
||||
value patt_tcon : Gram.Entry.t Ast.patt;
|
||||
value phrase : Gram.Entry.t Ast.str_item;
|
||||
value pipe_ctyp : Gram.Entry.t Ast.ctyp;
|
||||
value poly_type : Gram.Entry.t Ast.ctyp;
|
||||
value row_field : Gram.Entry.t Ast.ctyp;
|
||||
value sem_ctyp : Gram.Entry.t Ast.ctyp;
|
||||
value sem_expr : Gram.Entry.t Ast.expr;
|
||||
value sem_expr_for_list : Gram.Entry.t (Ast.expr -> Ast.expr);
|
||||
value sem_patt : Gram.Entry.t Ast.patt;
|
||||
value sem_patt_for_list : Gram.Entry.t (Ast.patt -> Ast.patt);
|
||||
value semi : Gram.Entry.t unit;
|
||||
value sequence : Gram.Entry.t Ast.expr;
|
||||
value sig_item : Gram.Entry.t Ast.sig_item;
|
||||
value sig_item_quot : Gram.Entry.t Ast.sig_item;
|
||||
value sig_items : Gram.Entry.t Ast.sig_item;
|
||||
value star_ctyp : Gram.Entry.t Ast.ctyp;
|
||||
value str_item : Gram.Entry.t Ast.str_item;
|
||||
value str_item_quot : Gram.Entry.t Ast.str_item;
|
||||
value str_items : Gram.Entry.t Ast.str_item;
|
||||
value type_constraint : Gram.Entry.t unit;
|
||||
value type_declaration : Gram.Entry.t Ast.ctyp;
|
||||
value type_ident_and_parameters : Gram.Entry.t (string * list Ast.ctyp);
|
||||
value type_kind : Gram.Entry.t Ast.ctyp;
|
||||
value type_longident : Gram.Entry.t Ast.ident;
|
||||
value type_longident_and_parameters : Gram.Entry.t Ast.ctyp;
|
||||
value type_parameter : Gram.Entry.t Ast.ctyp;
|
||||
value type_parameters : Gram.Entry.t (Ast.ctyp -> Ast.ctyp);
|
||||
value typevars : Gram.Entry.t Ast.ctyp;
|
||||
value val_longident : Gram.Entry.t Ast.ident;
|
||||
value value_let : Gram.Entry.t unit;
|
||||
value value_val : Gram.Entry.t unit;
|
||||
value with_constr : Gram.Entry.t Ast.with_constr;
|
||||
value with_constr_quot : Gram.Entry.t Ast.with_constr;
|
||||
end;
|
|
@ -1,72 +0,0 @@
|
|||
(****************************************************************************)
|
||||
(* *)
|
||||
(* Objective Caml *)
|
||||
(* *)
|
||||
(* INRIA Rocquencourt *)
|
||||
(* *)
|
||||
(* Copyright 2006 Institut National de Recherche en Informatique et *)
|
||||
(* en Automatique. All rights reserved. This file is distributed under *)
|
||||
(* the terms of the GNU Library General Public License, with the special *)
|
||||
(* exception on linking described in LICENSE at the top of the Objective *)
|
||||
(* Caml source tree. *)
|
||||
(* *)
|
||||
(****************************************************************************)
|
||||
|
||||
(* Authors:
|
||||
* - Daniel de Rauglaudre: initial version
|
||||
* - Nicolas Pouillard: refactoring
|
||||
*)
|
||||
|
||||
(** This signature describes tokens for the Objective Caml and the Revised
|
||||
syntax lexing rules. For some tokens the data constructor holds two
|
||||
representations with the evaluated one and the source one. For example
|
||||
the INT data constructor holds an integer and a string, this string can
|
||||
contains more information that's needed for a good pretty-printing
|
||||
("42", "4_2", "0000042", "0b0101010"...).
|
||||
|
||||
The meaning of the tokens are:
|
||||
- * [KEYWORD s] is the keyword [s].
|
||||
- * [LIDENT s] is the ident [s] starting with a lowercase letter.
|
||||
- * [UIDENT s] is the ident [s] starting with an uppercase letter.
|
||||
- * [INT i s] (resp. [INT32 i s], [INT64 i s] and [NATIVEINT i s])
|
||||
is the integer constant [i] whose string source is [s].
|
||||
- * [FLOAT f s] is the float constant [f] whose string source is [s].
|
||||
- * [STRING s s'] is the string constant [s] whose string source is [s'].
|
||||
- * [CHAR c s] is the character constant [c] whose string source is [s].
|
||||
- * [QUOTATION q] is a quotation [q], see {!Quotation.t} for more information.
|
||||
- * [ANTIQUOT n s] is an antiquotation [n] holding the string [s].
|
||||
- * [EOI] is the end of input.
|
||||
|
||||
Warning: the second string associated with the constructor [STRING] is
|
||||
the string found in the source without any interpretation. In particular,
|
||||
the backslashes are not interpreted. For example, if the input is ["\n"]
|
||||
the string is *not* a string with one element containing the character
|
||||
"return", but a string of two elements: the backslash and the character
|
||||
["n"]. To interpret a string use the first string of the [STRING]
|
||||
constructor (or if you need to compute it use the module
|
||||
{!Camlp4.Struct.Token.Eval}. Same thing for the constructor [CHAR]. *)
|
||||
|
||||
type t =
|
||||
[ KEYWORD of string
|
||||
| SYMBOL of string
|
||||
| LIDENT of string
|
||||
| UIDENT of string
|
||||
| ESCAPED_IDENT of string
|
||||
| INT of int and string
|
||||
| INT32 of int32 and string
|
||||
| INT64 of int64 and string
|
||||
| NATIVEINT of nativeint and string
|
||||
| FLOAT of float and string
|
||||
| CHAR of char and string
|
||||
| STRING of string and string
|
||||
| LABEL of string
|
||||
| OPTLABEL of string
|
||||
| QUOTATION of Quotation.t
|
||||
| ANTIQUOT of string and string
|
||||
| COMMENT of string
|
||||
| BLANKS of string
|
||||
| NEWLINE
|
||||
| LINE_DIRECTIVE of int and option string
|
||||
| EOI ];
|
||||
|
||||
module type S = Token.S with type t = t;
|
|
@ -1,43 +0,0 @@
|
|||
(****************************************************************************)
|
||||
(* *)
|
||||
(* Objective Caml *)
|
||||
(* *)
|
||||
(* INRIA Rocquencourt *)
|
||||
(* *)
|
||||
(* Copyright 2006 Institut National de Recherche en Informatique et *)
|
||||
(* en Automatique. All rights reserved. This file is distributed under *)
|
||||
(* the terms of the GNU Library General Public License, with the special *)
|
||||
(* exception on linking described in LICENSE at the top of the Objective *)
|
||||
(* Caml source tree. *)
|
||||
(* *)
|
||||
(****************************************************************************)
|
||||
|
||||
(* Authors:
|
||||
* - Daniel de Rauglaudre: initial version
|
||||
* - Nicolas Pouillard: refactoring
|
||||
*)
|
||||
|
||||
module type S = sig
|
||||
type t = 'abstract;
|
||||
exception Error of string and string;
|
||||
|
||||
(** [mk ?ocaml_stdlib ?camlp4_stdlib]
|
||||
The stdlib flag is true by default.
|
||||
To disable it use: [mk ~ocaml_stdlib:False] *)
|
||||
value mk : ?ocaml_stdlib: bool -> ?camlp4_stdlib: bool -> unit -> t;
|
||||
|
||||
(** Fold over the current load path list. *)
|
||||
value fold_load_path : t -> (string -> 'a -> 'a) -> 'a -> 'a;
|
||||
|
||||
(** [load f] Load the file [f]. If [f] is not an absolute path name,
|
||||
the load path list used to find the directory of [f]. *)
|
||||
value load : t -> string -> unit;
|
||||
|
||||
(** [include_dir d] Add the directory [d] in the current load path
|
||||
list (like the common -I option). *)
|
||||
value include_dir : t -> string -> unit;
|
||||
|
||||
(** [find_in_path f] Returns the full path of the file [f] if
|
||||
[f] is in the current load path, raises [Not_found] otherwise. *)
|
||||
value find_in_path : t -> string -> string;
|
||||
end;
|
|
@ -1,26 +0,0 @@
|
|||
(****************************************************************************)
|
||||
(* *)
|
||||
(* Objective Caml *)
|
||||
(* *)
|
||||
(* INRIA Rocquencourt *)
|
||||
(* *)
|
||||
(* Copyright 2006 Institut National de Recherche en Informatique et *)
|
||||
(* en Automatique. All rights reserved. This file is distributed under *)
|
||||
(* the terms of the GNU Library General Public License, with the special *)
|
||||
(* exception on linking described in LICENSE at the top of the Objective *)
|
||||
(* Caml source tree. *)
|
||||
(* *)
|
||||
(****************************************************************************)
|
||||
|
||||
(* Authors:
|
||||
* - Nicolas Pouillard: initial version
|
||||
*)
|
||||
|
||||
(** Signature for errors modules, an Error modules can be registred with
|
||||
the {!ErrorHandler.Register} functor in order to be well printed. *)
|
||||
module type S = sig
|
||||
type t = 'abstract;
|
||||
exception E of t;
|
||||
value to_string : t -> string;
|
||||
value print : Format.formatter -> t -> unit;
|
||||
end;
|
|
@ -1,29 +0,0 @@
|
|||
(****************************************************************************)
|
||||
(* *)
|
||||
(* Objective Caml *)
|
||||
(* *)
|
||||
(* INRIA Rocquencourt *)
|
||||
(* *)
|
||||
(* Copyright 2006 Institut National de Recherche en Informatique et *)
|
||||
(* en Automatique. All rights reserved. This file is distributed under *)
|
||||
(* the terms of the GNU Library General Public License, with the special *)
|
||||
(* exception on linking described in LICENSE at the top of the Objective *)
|
||||
(* Caml source tree. *)
|
||||
(* *)
|
||||
(****************************************************************************)
|
||||
|
||||
(* Authors:
|
||||
* - Daniel de Rauglaudre: initial version
|
||||
* - Nicolas Pouillard: refactoring
|
||||
*)
|
||||
|
||||
(** Internal signature for sematantic actions of grammars,
|
||||
not for the casual user. These functions are unsafe. *)
|
||||
module type S = sig
|
||||
type t = 'abstract;
|
||||
|
||||
value mk : 'a -> t;
|
||||
value get : t -> 'a;
|
||||
value getf : t -> ('a -> 'b);
|
||||
value getf2 : t -> ('a -> 'b -> 'c);
|
||||
end;
|
|
@ -1,102 +0,0 @@
|
|||
(****************************************************************************)
|
||||
(* *)
|
||||
(* Objective Caml *)
|
||||
(* *)
|
||||
(* INRIA Rocquencourt *)
|
||||
(* *)
|
||||
(* Copyright 2006 Institut National de Recherche en Informatique et *)
|
||||
(* en Automatique. All rights reserved. This file is distributed under *)
|
||||
(* the terms of the GNU Library General Public License, with the special *)
|
||||
(* exception on linking described in LICENSE at the top of the Objective *)
|
||||
(* Caml source tree. *)
|
||||
(* *)
|
||||
(****************************************************************************)
|
||||
|
||||
(* Authors:
|
||||
* - Daniel de Rauglaudre: initial version
|
||||
* - Nicolas Pouillard: refactoring
|
||||
*)
|
||||
|
||||
(** Signature for Camlp4 grammars. Here the dynamic means that you can produce as
|
||||
many grammar values as needed with a single grammar module.
|
||||
If you do not need many grammar values it's preferable to use a static one. *)
|
||||
module type S = sig
|
||||
include Structure.S;
|
||||
|
||||
(** Make a new grammar. *)
|
||||
value mk : unit -> gram;
|
||||
|
||||
module Entry : sig
|
||||
(** The abstract type of grammar entries. The type parameter is the type
|
||||
of the semantic actions that are associated with this entry. *)
|
||||
type t 'a = 'abstract;
|
||||
|
||||
(** Make a new entry from the given name. *)
|
||||
value mk : gram -> string -> t 'a;
|
||||
|
||||
(** Make a new entry from a name and an hand made token parser. *)
|
||||
value of_parser :
|
||||
gram -> string -> (Stream.t (Token.t * Loc.t) -> 'a) -> t 'a;
|
||||
|
||||
(** Clear the entry and setup this parser instead. *)
|
||||
value setup_parser :
|
||||
t 'a -> (Stream.t (Token.t * Loc.t) -> 'a) -> unit;
|
||||
|
||||
(** Get the entry name. *)
|
||||
value name : t 'a -> string;
|
||||
|
||||
(** Print the given entry into the given formatter. *)
|
||||
value print : Format.formatter -> t 'a -> unit;
|
||||
|
||||
(** Same as {!print} but show the left-factorization. *)
|
||||
value dump : Format.formatter -> t 'a -> unit;
|
||||
|
||||
(*/*)
|
||||
value obj : t 'a -> internal_entry;
|
||||
value clear : t 'a -> unit;
|
||||
end;
|
||||
|
||||
(** [get_filter g] Get the {!Token.Filter} associated to the [g]. *)
|
||||
value get_filter : gram -> Token.Filter.t;
|
||||
|
||||
type not_filtered 'a = 'abstract;
|
||||
|
||||
(** This function is called by the EXTEND ... END syntax. *)
|
||||
value extend : Entry.t 'a -> extend_statment -> unit;
|
||||
|
||||
(** The delete rule. *)
|
||||
value delete_rule : Entry.t 'a -> delete_statment -> unit;
|
||||
|
||||
value srules : Entry.t 'a -> list (list symbol * Action.t) -> symbol;
|
||||
value sfold0 : ('a -> 'b -> 'b) -> 'b -> fold _ 'a 'b;
|
||||
value sfold1 : ('a -> 'b -> 'b) -> 'b -> fold _ 'a 'b;
|
||||
value sfold0sep : ('a -> 'b -> 'b) -> 'b -> foldsep _ 'a 'b;
|
||||
(* value sfold1sep : ('a -> 'b -> 'b) -> 'b -> foldsep _ 'a 'b; *)
|
||||
|
||||
(** Use the lexer to produce a non filtered token stream from a char stream. *)
|
||||
value lex : gram -> Loc.t -> Stream.t char
|
||||
-> not_filtered (Stream.t (Token.t * Loc.t));
|
||||
|
||||
(** Token stream from string. *)
|
||||
value lex_string : gram -> Loc.t -> string
|
||||
-> not_filtered (Stream.t (Token.t * Loc.t));
|
||||
|
||||
(** Filter a token stream using the {!Token.Filter} module *)
|
||||
value filter : gram -> not_filtered (Stream.t (Token.t * Loc.t))
|
||||
-> Stream.t (Token.t * Loc.t);
|
||||
|
||||
(** Lex, filter and parse a stream of character. *)
|
||||
value parse : Entry.t 'a -> Loc.t -> Stream.t char -> 'a;
|
||||
|
||||
(** Same as {!parse} but from a string. *)
|
||||
value parse_string : Entry.t 'a -> Loc.t -> string -> 'a;
|
||||
|
||||
(** Parse a token stream that is not filtered yet. *)
|
||||
value parse_tokens_before_filter :
|
||||
Entry.t 'a -> not_filtered (Stream.t (Token.t * Loc.t)) -> 'a;
|
||||
|
||||
(** Parse a token stream that is already filtered. *)
|
||||
value parse_tokens_after_filter :
|
||||
Entry.t 'a -> Stream.t (Token.t * Loc.t) -> 'a;
|
||||
|
||||
end;
|
|
@ -1,97 +0,0 @@
|
|||
(****************************************************************************)
|
||||
(* *)
|
||||
(* Objective Caml *)
|
||||
(* *)
|
||||
(* INRIA Rocquencourt *)
|
||||
(* *)
|
||||
(* Copyright 2006 Institut National de Recherche en Informatique et *)
|
||||
(* en Automatique. All rights reserved. This file is distributed under *)
|
||||
(* the terms of the GNU Library General Public License, with the special *)
|
||||
(* exception on linking described in LICENSE at the top of the Objective *)
|
||||
(* Caml source tree. *)
|
||||
(* *)
|
||||
(****************************************************************************)
|
||||
|
||||
(* Authors:
|
||||
* - Daniel de Rauglaudre: initial version
|
||||
* - Nicolas Pouillard: refactoring
|
||||
*)
|
||||
|
||||
(** Signature for Camlp4 grammars. Here the static means that there is only
|
||||
one grammar value by grammar module. If you do not need to store the grammar
|
||||
value it's preferable to use a static one. *)
|
||||
module type S = sig
|
||||
include Structure.S;
|
||||
|
||||
module Entry : sig
|
||||
(** The abstract type of grammar entries. The type parameter is the type
|
||||
of the semantic actions that are associated with this entry. *)
|
||||
type t 'a = 'abstract;
|
||||
|
||||
(** Make a new entry from the given name. *)
|
||||
value mk : string -> t 'a;
|
||||
|
||||
(** Make a new entry from a name and an hand made token parser. *)
|
||||
value of_parser :
|
||||
string -> (Stream.t (Token.t * Loc.t) -> 'a) -> t 'a;
|
||||
|
||||
(** Clear the entry and setup this parser instead. *)
|
||||
value setup_parser :
|
||||
t 'a -> (Stream.t (Token.t * Loc.t) -> 'a) -> unit;
|
||||
|
||||
(** Get the entry name. *)
|
||||
value name : t 'a -> string;
|
||||
|
||||
(** Print the given entry into the given formatter. *)
|
||||
value print : Format.formatter -> t 'a -> unit;
|
||||
|
||||
(** Same as {!print} but show the left-factorization. *)
|
||||
value dump : Format.formatter -> t 'a -> unit;
|
||||
|
||||
(*/*)
|
||||
value obj : t 'a -> internal_entry;
|
||||
value clear : t 'a -> unit;
|
||||
end;
|
||||
|
||||
(** Get the {!Token.Filter} associated to the grammar module. *)
|
||||
value get_filter : unit -> Token.Filter.t;
|
||||
|
||||
type not_filtered 'a = 'abstract;
|
||||
|
||||
(** This function is called by the EXTEND ... END syntax. *)
|
||||
value extend : Entry.t 'a -> extend_statment -> unit;
|
||||
|
||||
(** The delete rule. *)
|
||||
value delete_rule : Entry.t 'a -> delete_statment -> unit;
|
||||
value srules : Entry.t 'a -> list (list symbol * Action.t) -> symbol;
|
||||
value sfold0 : ('a -> 'b -> 'b) -> 'b -> fold _ 'a 'b;
|
||||
value sfold1 : ('a -> 'b -> 'b) -> 'b -> fold _ 'a 'b;
|
||||
value sfold0sep : ('a -> 'b -> 'b) -> 'b -> foldsep _ 'a 'b;
|
||||
(* value sfold1sep : ('a -> 'b -> 'b) -> 'b -> foldsep _ 'a 'b; *)
|
||||
|
||||
(** Use the lexer to produce a non filtered token stream from a char stream. *)
|
||||
value lex : Loc.t -> Stream.t char
|
||||
-> not_filtered (Stream.t (Token.t * Loc.t));
|
||||
(** Token stream from string. *)
|
||||
value lex_string : Loc.t -> string
|
||||
-> not_filtered (Stream.t (Token.t * Loc.t));
|
||||
|
||||
(** Filter a token stream using the {!Token.Filter} module *)
|
||||
value filter : not_filtered (Stream.t (Token.t * Loc.t))
|
||||
-> Stream.t (Token.t * Loc.t);
|
||||
|
||||
(** Lex, filter and parse a stream of character. *)
|
||||
value parse : Entry.t 'a -> Loc.t -> Stream.t char -> 'a;
|
||||
|
||||
(** Same as {!parse} but from a string. *)
|
||||
value parse_string : Entry.t 'a -> Loc.t -> string -> 'a;
|
||||
|
||||
(** Parse a token stream that is not filtered yet. *)
|
||||
value parse_tokens_before_filter :
|
||||
Entry.t 'a -> not_filtered (Stream.t (Token.t * Loc.t)) -> 'a;
|
||||
|
||||
(** Parse a token stream that is already filtered. *)
|
||||
value parse_tokens_after_filter :
|
||||
Entry.t 'a -> Stream.t (Token.t * Loc.t) -> 'a;
|
||||
|
||||
end;
|
|
@ -1,74 +0,0 @@
|
|||
(****************************************************************************)
|
||||
(* *)
|
||||
(* Objective Caml *)
|
||||
(* *)
|
||||
(* INRIA Rocquencourt *)
|
||||
(* *)
|
||||
(* Copyright 2006 Institut National de Recherche en Informatique et *)
|
||||
(* en Automatique. All rights reserved. This file is distributed under *)
|
||||
(* the terms of the GNU Library General Public License, with the special *)
|
||||
(* exception on linking described in LICENSE at the top of the Objective *)
|
||||
(* Caml source tree. *)
|
||||
(* *)
|
||||
(****************************************************************************)
|
||||
|
||||
(* Authors:
|
||||
* - Daniel de Rauglaudre: initial version
|
||||
* - Nicolas Pouillard: refactoring
|
||||
*)
|
||||
|
||||
type assoc =
|
||||
[ NonA
|
||||
| RightA
|
||||
| LeftA ];
|
||||
|
||||
type position =
|
||||
[ First
|
||||
| Last
|
||||
| Before of string
|
||||
| After of string
|
||||
| Level of string ];
|
||||
|
||||
(** Common signature for {!Sig.Grammar.Static} and {!Sig.Grammar.Dynamic}. *)
|
||||
module type S = sig
|
||||
module Loc : Loc.S;
|
||||
module Action : Action.S;
|
||||
module Token : Token.S with module Loc = Loc;
|
||||
|
||||
type gram = 'abstract;
|
||||
type internal_entry = 'abstract;
|
||||
type tree = 'abstract;
|
||||
|
||||
type token_pattern = ((Token.t -> bool) * string);
|
||||
|
||||
type symbol =
|
||||
[ Smeta of string and list symbol and Action.t
|
||||
| Snterm of internal_entry
|
||||
| Snterml of internal_entry and string
|
||||
| Slist0 of symbol
|
||||
| Slist0sep of symbol and symbol
|
||||
| Slist1 of symbol
|
||||
| Slist1sep of symbol and symbol
|
||||
| Sopt of symbol
|
||||
| Sself
|
||||
| Snext
|
||||
| Stoken of token_pattern
|
||||
| Skeyword of string
|
||||
| Stree of tree ];
|
||||
|
||||
type production_rule = (list symbol * Action.t);
|
||||
type single_extend_statment =
|
||||
(option string * option assoc * list production_rule);
|
||||
type extend_statment =
|
||||
(option position * list single_extend_statment);
|
||||
type delete_statment = list symbol;
|
||||
|
||||
type fold 'a 'b 'c =
|
||||
internal_entry -> list symbol ->
|
||||
(Stream.t 'a -> 'b) -> Stream.t 'a -> 'c;
|
||||
|
||||
type foldsep 'a 'b 'c =
|
||||
internal_entry -> list symbol ->
|
||||
(Stream.t 'a -> 'b) -> (Stream.t 'a -> unit) -> Stream.t 'a -> 'c;
|
||||
|
||||
end;
|
|
@ -1,28 +0,0 @@
|
|||
(****************************************************************************)
|
||||
(* *)
|
||||
(* Objective Caml *)
|
||||
(* *)
|
||||
(* INRIA Rocquencourt *)
|
||||
(* *)
|
||||
(* Copyright 2006 Institut National de Recherche en Informatique et *)
|
||||
(* en Automatique. All rights reserved. This file is distributed under *)
|
||||
(* the terms of the GNU Library General Public License, with the special *)
|
||||
(* exception on linking described in LICENSE at the top of the Objective *)
|
||||
(* Caml source tree. *)
|
||||
(* *)
|
||||
(****************************************************************************)
|
||||
|
||||
(* Authors:
|
||||
* - Nicolas Pouillard
|
||||
*)
|
||||
|
||||
(** A signature for extensions identifiers. *)
|
||||
module type S = sig
|
||||
|
||||
(** The name of the extension, typically the module name. *)
|
||||
value name : string;
|
||||
|
||||
(** The version of the extension, typically $Id$ with a versionning system. *)
|
||||
value version : string;
|
||||
|
||||
end;
|
|
@ -1,30 +0,0 @@
|
|||
(****************************************************************************)
|
||||
(* *)
|
||||
(* Objective Caml *)
|
||||
(* *)
|
||||
(* INRIA Rocquencourt *)
|
||||
(* *)
|
||||
(* Copyright 2006 Institut National de Recherche en Informatique et *)
|
||||
(* en Automatique. All rights reserved. This file is distributed under *)
|
||||
(* the terms of the GNU Library General Public License, with the special *)
|
||||
(* exception on linking described in LICENSE at the top of the Objective *)
|
||||
(* Caml source tree. *)
|
||||
(* *)
|
||||
(****************************************************************************)
|
||||
|
||||
(* Authors:
|
||||
* - Nicolas Pouillard: initial version
|
||||
*)
|
||||
|
||||
module type S = sig
|
||||
module Loc : Loc.S;
|
||||
module Token : Token.S with module Loc = Loc;
|
||||
module Error : Error.S;
|
||||
|
||||
(** The constructor for a lexing function. The character stream is the input
|
||||
stream to be lexed. The result is a stream of pairs of a token and
|
||||
a location.
|
||||
The lexer do not use global (mutable) variables: instantiations
|
||||
of [Lexer.mk ()] do not perturb each other. *)
|
||||
value mk : unit -> (Loc.t -> Stream.t char -> Stream.t (Token.t * Loc.t));
|
||||
end;
|
|
@ -1,149 +0,0 @@
|
|||
(****************************************************************************)
|
||||
(* *)
|
||||
(* Objective Caml *)
|
||||
(* *)
|
||||
(* INRIA Rocquencourt *)
|
||||
(* *)
|
||||
(* Copyright 2006 Institut National de Recherche en Informatique et *)
|
||||
(* en Automatique. All rights reserved. This file is distributed under *)
|
||||
(* the terms of the GNU Library General Public License, with the special *)
|
||||
(* exception on linking described in LICENSE at the top of the Objective *)
|
||||
(* Caml source tree. *)
|
||||
(* *)
|
||||
(****************************************************************************)
|
||||
|
||||
(* Authors:
|
||||
* - Nicolas Pouillard: initial version
|
||||
*)
|
||||
|
||||
module type S = sig
|
||||
|
||||
type t = 'a;
|
||||
|
||||
(** Return a start location for the given file name.
|
||||
This location starts at the begining of the file. *)
|
||||
value mk : string -> t;
|
||||
|
||||
(** The [ghost] location can be used when no location
|
||||
information is available. *)
|
||||
value ghost : t;
|
||||
|
||||
(** {6 Conversion functions} *)
|
||||
|
||||
(** Return a location where both positions are set the given position. *)
|
||||
value of_lexing_position : Lexing.position -> t;
|
||||
|
||||
(** Return an OCaml location. *)
|
||||
value to_ocaml_location : t -> Location.t;
|
||||
|
||||
(** Return a location from an OCaml location. *)
|
||||
value of_ocaml_location : Location.t -> t;
|
||||
|
||||
(** Return a location from ocamllex buffer. *)
|
||||
value of_lexbuf : Lexing.lexbuf -> t;
|
||||
|
||||
(** Return a location from [(file_name, start_line, start_bol, start_off,
|
||||
stop_line, stop_bol, stop_off, ghost)]. *)
|
||||
value of_tuple : (string * int * int * int * int * int * int * bool) -> t;
|
||||
|
||||
(** Return [(file_name, start_line, start_bol, start_off,
|
||||
stop_line, stop_bol, stop_off, ghost)]. *)
|
||||
value to_tuple : t -> (string * int * int * int * int * int * int * bool);
|
||||
|
||||
(** [merge loc1 loc2] Return a location that starts at [loc1] and end at [loc2]. *)
|
||||
value merge : t -> t -> t;
|
||||
|
||||
(** The stop pos becomes equal to the start pos. *)
|
||||
value join : t -> t;
|
||||
|
||||
(** [move selector n loc]
|
||||
Return the location where positions are moved.
|
||||
Affected positions are chosen with [selector].
|
||||
Returned positions have their character offset plus [n]. *)
|
||||
value move : [= `start | `stop | `both ] -> int -> t -> t;
|
||||
|
||||
(** [shift n loc] Return the location where the new start position is the old
|
||||
stop position, and where the new stop position character offset is the
|
||||
old one plus [n]. *)
|
||||
value shift : int -> t -> t;
|
||||
|
||||
(** [move_line n loc] Return the location with the old line count plus [n].
|
||||
The "begin of line" of both positions become the current offset. *)
|
||||
value move_line : int -> t -> t;
|
||||
|
||||
(** Accessors *)
|
||||
|
||||
(** Return the file name *)
|
||||
value file_name : t -> string;
|
||||
|
||||
(** Return the line number of the begining of this location. *)
|
||||
value start_line : t -> int;
|
||||
|
||||
(** Return the line number of the ending of this location. *)
|
||||
value stop_line : t -> int;
|
||||
|
||||
(** Returns the number of characters from the begining of the file
|
||||
to the begining of the line of location's begining. *)
|
||||
value start_bol : t -> int;
|
||||
|
||||
(** Returns the number of characters from the begining of the file
|
||||
to the begining of the line of location's ending. *)
|
||||
value stop_bol : t -> int;
|
||||
|
||||
(** Returns the number of characters from the begining of the file
|
||||
of the begining of this location. *)
|
||||
value start_off : t -> int;
|
||||
|
||||
(** Return the number of characters from the begining of the file
|
||||
of the ending of this location. *)
|
||||
value stop_off : t -> int;
|
||||
|
||||
(** Return the start position as a Lexing.position. *)
|
||||
value start_pos : t -> Lexing.position;
|
||||
|
||||
(** Return the stop position as a Lexing.position. *)
|
||||
value stop_pos : t -> Lexing.position;
|
||||
|
||||
(** Generally, return true if this location does not come
|
||||
from an input stream. *)
|
||||
value is_ghost : t -> bool;
|
||||
|
||||
(** Return the associated ghost location. *)
|
||||
value ghostify : t -> t;
|
||||
|
||||
(** Return the location with the give file name *)
|
||||
value set_file_name : string -> t -> t;
|
||||
|
||||
(** [strictly_before loc1 loc2] True if the stop position of [loc1] is
|
||||
strictly_before the start position of [loc2]. *)
|
||||
value strictly_before : t -> t -> bool;
|
||||
|
||||
(** Return the location with an absolute file name. *)
|
||||
value make_absolute : t -> t;
|
||||
|
||||
(** Print the location into the formatter in a format suitable for error
|
||||
reporting. *)
|
||||
value print : Format.formatter -> t -> unit;
|
||||
|
||||
(** Print the location in a short format useful for debugging. *)
|
||||
value dump : Format.formatter -> t -> unit;
|
||||
|
||||
(** Same as {!print} but return a string instead of printting it. *)
|
||||
value to_string : t -> string;
|
||||
|
||||
(** [Exc_located loc e] is an encapsulation of the exception [e] with
|
||||
the input location [loc]. To be used in quotation expanders
|
||||
and in grammars to specify some input location for an error.
|
||||
Do not raise this exception directly: rather use the following
|
||||
function [Loc.raise]. *)
|
||||
exception Exc_located of t and exn;
|
||||
|
||||
(** [raise loc e], if [e] is already an [Exc_located] exception,
|
||||
re-raise it, else raise the exception [Exc_located loc e]. *)
|
||||
value raise : t -> exn -> 'a;
|
||||
|
||||
(** The name of the location variable used in grammars and in
|
||||
the predefined quotations for OCaml syntax trees. Default: [_loc]. *)
|
||||
value name : ref string;
|
||||
|
||||
end;
|
|
@ -1,33 +0,0 @@
|
|||
(****************************************************************************)
|
||||
(* *)
|
||||
(* Objective Caml *)
|
||||
(* *)
|
||||
(* INRIA Rocquencourt *)
|
||||
(* *)
|
||||
(* Copyright 2006 Institut National de Recherche en Informatique et *)
|
||||
(* en Automatique. All rights reserved. This file is distributed under *)
|
||||
(* the terms of the GNU Library General Public License, with the special *)
|
||||
(* exception on linking described in LICENSE at the top of the Objective *)
|
||||
(* Caml source tree. *)
|
||||
(* *)
|
||||
(****************************************************************************)
|
||||
|
||||
(* Authors:
|
||||
* - Nicolas Pouillard: initial version
|
||||
*)
|
||||
|
||||
(** Base class for map traversal, it includes some builtin types. *)
|
||||
class c = object
|
||||
method string x : string = x;
|
||||
method int x : int = x;
|
||||
method float x : float = x;
|
||||
method bool x : bool = x;
|
||||
method list : ! 'a 'b . ('a -> 'b) -> list 'a -> list 'b =
|
||||
List.map;
|
||||
method option : ! 'a 'b . ('a -> 'b) -> option 'a -> option 'b =
|
||||
fun f -> fun [ None -> None | Some x -> Some (f x) ];
|
||||
method array : ! 'a 'b . ('a -> 'b) -> array 'a -> array 'b =
|
||||
Array.map;
|
||||
method ref : ! 'a 'b . ('a -> 'b) -> ref 'a -> ref 'b =
|
||||
fun f { val = x } -> { val = f x };
|
||||
end;
|
|
@ -1,29 +0,0 @@
|
|||
(****************************************************************************)
|
||||
(* *)
|
||||
(* Objective Caml *)
|
||||
(* *)
|
||||
(* INRIA Rocquencourt *)
|
||||
(* *)
|
||||
(* Copyright 2006 Institut National de Recherche en Informatique et *)
|
||||
(* en Automatique. All rights reserved. This file is distributed under *)
|
||||
(* the terms of the GNU Library General Public License, with the special *)
|
||||
(* exception on linking described in LICENSE at the top of the Objective *)
|
||||
(* Caml source tree. *)
|
||||
(* *)
|
||||
(****************************************************************************)
|
||||
|
||||
(* Authors:
|
||||
* - Nicolas Pouillard: initial version
|
||||
*)
|
||||
|
||||
(** Base class for map traversal, it includes some builtin types. *)
|
||||
class c : object
|
||||
method string : string -> string;
|
||||
method int : int -> int;
|
||||
method float : float -> float;
|
||||
method bool : bool -> bool;
|
||||
method list : ! 'a 'b . ('a -> 'b) -> list 'a -> list 'b;
|
||||
method option : ! 'a 'b . ('a -> 'b) -> option 'a -> option 'b;
|
||||
method array : ! 'a 'b . ('a -> 'b) -> array 'a -> array 'b;
|
||||
method ref : ! 'a 'b . ('a -> 'b) -> ref 'a -> ref 'b;
|
||||
end;
|
|
@ -1,39 +0,0 @@
|
|||
(****************************************************************************)
|
||||
(* *)
|
||||
(* Objective Caml *)
|
||||
(* *)
|
||||
(* INRIA Rocquencourt *)
|
||||
(* *)
|
||||
(* Copyright 2006 Institut National de Recherche en Informatique et *)
|
||||
(* en Automatique. All rights reserved. This file is distributed under *)
|
||||
(* the terms of the GNU Library General Public License, with the special *)
|
||||
(* exception on linking described in LICENSE at the top of the Objective *)
|
||||
(* Caml source tree. *)
|
||||
(* *)
|
||||
(****************************************************************************)
|
||||
|
||||
(* Authors:
|
||||
* - Daniel de Rauglaudre: initial version
|
||||
* - Nicolas Pouillard: refactoring
|
||||
*)
|
||||
|
||||
(** {6 Parser} *)
|
||||
module type S = sig
|
||||
|
||||
module Ast : Ast.S;
|
||||
open Ast;
|
||||
|
||||
(** Called when parsing an implementation (ml file) to build the syntax
|
||||
tree; the returned list contains the phrases (structure items) as a
|
||||
single "declare" node (a list of structure items); if the parser
|
||||
encounter a directive it stops (since the directive may change the
|
||||
syntax), the given [directive_handler] function evaluates it and
|
||||
the parsing starts again. *)
|
||||
value parse_implem : ?directive_handler:(str_item -> option str_item) ->
|
||||
Loc.t -> Stream.t char -> Ast.str_item;
|
||||
|
||||
(** Same as {!parse_implem} but for interface (mli file). *)
|
||||
value parse_interf : ?directive_handler:(sig_item -> option sig_item) ->
|
||||
Loc.t -> Stream.t char -> Ast.sig_item;
|
||||
|
||||
end;
|
|
@ -1,31 +0,0 @@
|
|||
(****************************************************************************)
|
||||
(* *)
|
||||
(* Objective Caml *)
|
||||
(* *)
|
||||
(* INRIA Rocquencourt *)
|
||||
(* *)
|
||||
(* Copyright 2006 Institut National de Recherche en Informatique et *)
|
||||
(* en Automatique. All rights reserved. This file is distributed under *)
|
||||
(* the terms of the GNU Library General Public License, with the special *)
|
||||
(* exception on linking described in LICENSE at the top of the Objective *)
|
||||
(* Caml source tree. *)
|
||||
(* *)
|
||||
(****************************************************************************)
|
||||
|
||||
(* Authors:
|
||||
* - Daniel de Rauglaudre: initial version
|
||||
* - Nicolas Pouillard: refactoring
|
||||
*)
|
||||
|
||||
(** {6 Printer} *)
|
||||
|
||||
module type S = sig
|
||||
|
||||
module Ast : Ast.S;
|
||||
|
||||
value print_interf : ?input_file:string -> ?output_file:string ->
|
||||
Ast.sig_item -> unit;
|
||||
value print_implem : ?input_file:string -> ?output_file:string ->
|
||||
Ast.str_item -> unit;
|
||||
|
||||
end;
|
|
@ -1,81 +0,0 @@
|
|||
(* camlp4r *)
|
||||
(****************************************************************************)
|
||||
(* *)
|
||||
(* Objective Caml *)
|
||||
(* *)
|
||||
(* INRIA Rocquencourt *)
|
||||
(* *)
|
||||
(* Copyright 1998-2006 Institut National de Recherche en Informatique et *)
|
||||
(* en Automatique. All rights reserved. This file is distributed under *)
|
||||
(* the terms of the GNU Library General Public License, with the special *)
|
||||
(* exception on linking described in LICENSE at the top of the Objective *)
|
||||
(* Caml source tree. *)
|
||||
(* *)
|
||||
(****************************************************************************)
|
||||
|
||||
(* Authors:
|
||||
* - Daniel de Rauglaudre: initial version
|
||||
* - Nicolas Pouillard: refactoring
|
||||
*)
|
||||
|
||||
(* $Id$ *)
|
||||
|
||||
(** Quotation operations. *)
|
||||
|
||||
type t =
|
||||
{ q_name : string ;
|
||||
q_loc : string ;
|
||||
q_shift : int ;
|
||||
q_contents : string };
|
||||
|
||||
module type S = sig
|
||||
module Ast : Ast.S;
|
||||
open Ast;
|
||||
|
||||
(** The Loc.t is the initial location. The option string is the optional name
|
||||
for the location variable. The string is the quotation contents. *)
|
||||
type expand_fun 'a = Loc.t -> option string -> string -> 'a;
|
||||
|
||||
(** The type for quotation expanders kind:
|
||||
- [ExStr exp] for an expander [exp] returning a string which
|
||||
can be parsed to create a syntax tree. Its boolean parameter
|
||||
tells whether the quotation is in position of an expression
|
||||
(True) or in position of a pattern (False). Quotations expanders
|
||||
created with this way may work for some particular language syntax,
|
||||
and not for another one (e.g. may work when used with Revised
|
||||
syntax and not when used with Ocaml syntax, and conversely).
|
||||
- [ExAst (expr_exp, patt_exp)] for expanders returning directly
|
||||
syntax trees, therefore not necessiting to be parsed afterwards.
|
||||
The function [expr_exp] is called when the quotation is in
|
||||
position of an expression, and [patt_exp] when the quotation is
|
||||
in position of a pattern. Quotation expanders created with this
|
||||
way are independant from the language syntax. *)
|
||||
type expander =
|
||||
[ ExStr of bool -> expand_fun string
|
||||
| ExAst of (expand_fun Ast.expr) and (expand_fun Ast.patt) ];
|
||||
|
||||
(** [add name exp] adds the quotation [name] associated with the
|
||||
expander [exp]. *)
|
||||
value add : string -> expander -> unit;
|
||||
|
||||
(** [find name] returns the expander of the given quotation name. *)
|
||||
value find : string -> expander;
|
||||
|
||||
(** [default] holds the default quotation name. *)
|
||||
value default : ref string;
|
||||
|
||||
(** function translating quotation names; default = identity *)
|
||||
value translate : ref (string -> string);
|
||||
|
||||
value expand_expr : (Loc.t -> string -> Ast.expr) -> Loc.t -> t -> Ast.expr;
|
||||
value expand_patt : (Loc.t -> string -> Ast.patt) -> Loc.t -> t -> Ast.patt;
|
||||
|
||||
(** [dump_file] optionally tells Camlp4 to dump the
|
||||
result of an expander if this result is syntactically incorrect.
|
||||
If [None] (default), this result is not dumped. If [Some fname], the
|
||||
result is dumped in the file [fname]. *)
|
||||
value dump_file : ref (option string);
|
||||
|
||||
module Error : Error.S;
|
||||
|
||||
end;
|
|
@ -1,35 +0,0 @@
|
|||
(****************************************************************************)
|
||||
(* *)
|
||||
(* Objective Caml *)
|
||||
(* *)
|
||||
(* INRIA Rocquencourt *)
|
||||
(* *)
|
||||
(* Copyright 2006 Institut National de Recherche en Informatique et *)
|
||||
(* en Automatique. All rights reserved. This file is distributed under *)
|
||||
(* the terms of the GNU Library General Public License, with the special *)
|
||||
(* exception on linking described in LICENSE at the top of the Objective *)
|
||||
(* Caml source tree. *)
|
||||
(* *)
|
||||
(****************************************************************************)
|
||||
|
||||
(* Authors:
|
||||
* - Daniel de Rauglaudre: initial version
|
||||
* - Nicolas Pouillard: refactoring
|
||||
*)
|
||||
|
||||
(** A syntax module is a sort of constistent bunch of modules and values.
|
||||
In such a module you have a parser, a printer, and also modules for
|
||||
locations, syntax trees, tokens, grammars, quotations, anti-quotations.
|
||||
There is also the main grammar entries. *)
|
||||
module type S = sig
|
||||
module Loc : Loc.S;
|
||||
module Warning : Warning.S with module Loc = Loc;
|
||||
module Ast : Ast.S with module Loc = Loc;
|
||||
module Token : Token.S with module Loc = Loc;
|
||||
module Gram : Grammar.Static.S with module Loc = Loc and module Token = Token;
|
||||
module AntiquotSyntax : AntiquotSyntax.S with module Ast = Ast;
|
||||
(* Gram is not constrained here for flexibility *)
|
||||
module Quotation : Quotation.S with module Ast = Ast;
|
||||
module Parser : Parser.S with module Ast = Ast;
|
||||
module Printer : Printer.S with module Ast = Ast;
|
||||
end;
|
|
@ -1,26 +0,0 @@
|
|||
(****************************************************************************)
|
||||
(* *)
|
||||
(* Objective Caml *)
|
||||
(* *)
|
||||
(* INRIA Rocquencourt *)
|
||||
(* *)
|
||||
(* Copyright 2006 Institut National de Recherche en Informatique et *)
|
||||
(* en Automatique. All rights reserved. This file is distributed under *)
|
||||
(* the terms of the GNU Library General Public License, with the special *)
|
||||
(* exception on linking described in LICENSE at the top of the Objective *)
|
||||
(* Caml source tree. *)
|
||||
(* *)
|
||||
(****************************************************************************)
|
||||
|
||||
(* Authors:
|
||||
* - Nicolas Pouillard: initial version
|
||||
*)
|
||||
|
||||
module type S = functor (Syn : Syntax.S)
|
||||
-> (Syntax.S with module Loc = Syn.Loc
|
||||
and module Warning = Syn.Warning
|
||||
and module Ast = Syn.Ast
|
||||
and module Token = Syn.Token
|
||||
and module Gram = Syn.Gram
|
||||
and module AntiquotSyntax = Syn.AntiquotSyntax
|
||||
and module Quotation = Syn.Quotation);
|
|
@ -1,69 +0,0 @@
|
|||
(****************************************************************************)
|
||||
(* *)
|
||||
(* Objective Caml *)
|
||||
(* *)
|
||||
(* INRIA Rocquencourt *)
|
||||
(* *)
|
||||
(* Copyright 2006 Institut National de Recherche en Informatique et *)
|
||||
(* en Automatique. All rights reserved. This file is distributed under *)
|
||||
(* the terms of the GNU Library General Public License, with the special *)
|
||||
(* exception on linking described in LICENSE at the top of the Objective *)
|
||||
(* Caml source tree. *)
|
||||
(* *)
|
||||
(****************************************************************************)
|
||||
|
||||
(* Authors:
|
||||
* - Nicolas Pouillard: initial version
|
||||
*)
|
||||
|
||||
type stream_filter 'a 'loc = Stream.t ('a * 'loc) -> Stream.t ('a * 'loc);
|
||||
|
||||
module type S = sig
|
||||
|
||||
module Loc : Loc.S;
|
||||
|
||||
type t = 'abstract;
|
||||
|
||||
value to_string : t -> string;
|
||||
|
||||
value print : Format.formatter -> t -> unit;
|
||||
|
||||
value match_keyword : string -> t -> bool;
|
||||
|
||||
value extract_string : t -> string;
|
||||
|
||||
module Filter : sig
|
||||
|
||||
type token_filter = stream_filter t Loc.t;
|
||||
|
||||
(** The type for this filter chain.
|
||||
A basic implementation just store the [is_keyword] function given
|
||||
by [mk] and use it in the [filter] function. *)
|
||||
type t = 'abstract;
|
||||
|
||||
(** The given predicate function returns true if the given string
|
||||
is a keyword. This function can be used in filters to translate
|
||||
identifier tokens to keyword tokens. *)
|
||||
value mk : (string -> bool) -> t;
|
||||
|
||||
(** This function allows to register a new filter to the token filter chain.
|
||||
You can choose to not support these and raise an exception. *)
|
||||
value define_filter : t -> (token_filter -> token_filter) -> unit;
|
||||
|
||||
(** This function filter the given stream and return a filtered stream.
|
||||
A basic implementation just match identifiers against the [is_keyword]
|
||||
function to produce token keywords instead. *)
|
||||
value filter : t -> token_filter;
|
||||
|
||||
(** Called by the grammar system when a keyword is used.
|
||||
The boolean argument is True when it's the first time that keyword
|
||||
is used. If you do not care about this information just return [()]. *)
|
||||
value keyword_added : t -> string -> bool -> unit;
|
||||
|
||||
(** Called by the grammar system when a keyword is no longer used.
|
||||
If you do not care about this information just return [()]. *)
|
||||
value keyword_removed : t -> string -> unit;
|
||||
end;
|
||||
|
||||
module Error : Error.S;
|
||||
end;
|
|
@ -1,21 +0,0 @@
|
|||
(****************************************************************************)
|
||||
(* *)
|
||||
(* Objective Caml *)
|
||||
(* *)
|
||||
(* INRIA Rocquencourt *)
|
||||
(* *)
|
||||
(* Copyright 2006 Institut National de Recherche en Informatique et *)
|
||||
(* en Automatique. All rights reserved. This file is distributed under *)
|
||||
(* the terms of the GNU Library General Public License, with the special *)
|
||||
(* exception on linking described in LICENSE at the top of the Objective *)
|
||||
(* Caml source tree. *)
|
||||
(* *)
|
||||
(****************************************************************************)
|
||||
|
||||
(* Authors:
|
||||
* - Nicolas Pouillard: initial version
|
||||
*)
|
||||
|
||||
module type S = sig
|
||||
type t = 'abstract;
|
||||
end;
|
|
@ -1,25 +0,0 @@
|
|||
(****************************************************************************)
|
||||
(* *)
|
||||
(* Objective Caml *)
|
||||
(* *)
|
||||
(* INRIA Rocquencourt *)
|
||||
(* *)
|
||||
(* Copyright 2006 Institut National de Recherche en Informatique et *)
|
||||
(* en Automatique. All rights reserved. This file is distributed under *)
|
||||
(* the terms of the GNU Library General Public License, with the special *)
|
||||
(* exception on linking described in LICENSE at the top of the Objective *)
|
||||
(* Caml source tree. *)
|
||||
(* *)
|
||||
(****************************************************************************)
|
||||
|
||||
(* Authors:
|
||||
* - Nicolas Pouillard: initial version
|
||||
*)
|
||||
|
||||
module type S = sig
|
||||
module Loc : Loc.S;
|
||||
type t = Loc.t -> string -> unit;
|
||||
value default : t;
|
||||
value current : ref t;
|
||||
value print : t;
|
||||
end;
|
Loading…
Reference in New Issue