diff options
-rw-r--r-- | camlp4/.cvsignore | 8 | ||||
-rw-r--r-- | camlp4/Camlp4/.cvsignore | 5 | ||||
-rw-r--r-- | camlp4/Camlp4/Sig.ml | 1304 | ||||
-rw-r--r-- | camlp4/Camlp4/Struct/.cvsignore | 2 |
4 files changed, 1304 insertions, 15 deletions
diff --git a/camlp4/.cvsignore b/camlp4/.cvsignore index 87e91ff06..493096e25 100644 --- a/camlp4/.cvsignore +++ b/camlp4/.cvsignore @@ -1,11 +1,3 @@ *.cm* -Camlp4Printers.ml -Camlp4Parsers.ml -Camlp4Filters.ml -Camlp4Top.ml .cache-status -Camlp4.ml -yam *.tmp.ml -*.run -*.opt diff --git a/camlp4/Camlp4/.cvsignore b/camlp4/Camlp4/.cvsignore index f0e1ae707..e69de29bb 100644 --- a/camlp4/Camlp4/.cvsignore +++ b/camlp4/Camlp4/.cvsignore @@ -1,5 +0,0 @@ -*.cm* -Sig.ml -Struct.ml -Syntax.ml -Printers.ml diff --git a/camlp4/Camlp4/Sig.ml b/camlp4/Camlp4/Sig.ml new file mode 100644 index 000000000..8dd41d87d --- /dev/null +++ b/camlp4/Camlp4/Sig.ml @@ -0,0 +1,1304 @@ +(* camlp4r *) +(****************************************************************************) +(* *) +(* 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 Type = sig + type t = 'abstract; +end; + +(** Signature for errors modules, an Error modules can be registred with + the {!ErrorHandler.Register} functor in order to be well printed. *) +module type Error = sig + type t = 'abstract; + exception E of t; + value to_string : t -> string; + value print : Format.formatter -> t -> unit; +end; + +(** A signature for extensions identifiers. *) +module type Id = 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; + +module type Loc = 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; + +module type Warning = sig + module Loc : Loc; + type t = Loc.t -> string -> unit; + value default : t; + value current : ref t; + value print : t; +end; + +(** Base class for map traversal, it includes some builtin types. *) +class mapper : 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 = 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; + +(** Abstract syntax tree minimal signature. + Types of this signature are abstract. + See the {!Camlp4Ast} signature for a concrete definition. *) +module type Ast = sig + + module Loc : Loc; + + 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; + 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; + + +(** The AntiquotSyntax signature describe the minimal interface needed + for antiquotation handling. *) +module type AntiquotSyntax = sig + module Ast : Ast; + + (** 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; + +(** Signature for OCaml syntax trees. + This signature is an extension of {!Ast} + It provides: + - Types for all kinds of structure. + - Map: A base class for map traversals. + - Map classes and functions for common kinds. *) +module type Camlp4Ast = sig + + module Loc : Loc; + + INCLUDE "camlp4/Camlp4/Camlp4Ast.partial.ml"; + + 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.map}. *) + class map : object + inherit mapper; + 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.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.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.Camlp4AstToAst Camlp4Ast *) +module Camlp4AstToAst (M : Camlp4Ast) : Ast + 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 MakeCamlp4Ast (Loc : Type) = struct + + INCLUDE "camlp4/Camlp4/Camlp4Ast.partial.ml"; + +end; + +(** 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 AstFilters = sig + + module Ast : Camlp4Ast; + + (** {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; + +(** Quotation operations. *) + +type quotation = + { q_name : string ; + q_loc : string ; + q_shift : int ; + q_contents : string }; + +module type Quotation = sig + module Ast : Ast; + 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 -> quotation -> Ast.expr; + value expand_patt : (Loc.t -> string -> Ast.patt) -> Loc.t -> quotation -> 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; + +end; + +type stream_filter 'a 'loc = Stream.t ('a * 'loc) -> Stream.t ('a * 'loc); + +module type Token = sig + + module Loc : Loc; + + 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; +end; + +(** 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 camlp4_token = + [ 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 + | ANTIQUOT of string and string + | COMMENT of string + | BLANKS of string + | NEWLINE + | LINE_DIRECTIVE of int and option string + | EOI ]; + +module type Camlp4Token = Token with type t = camlp4_token; + +module type DynLoader = 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; + +module Grammar = struct + + (** Internal signature for sematantic actions of grammars, + not for the casual user. These functions are unsafe. *) + module type Action = sig + type t = 'abstract; + + value mk : 'a -> t; + value get : t -> 'a; + value getf : t -> ('a -> 'b); + value getf2 : t -> ('a -> 'b -> 'c); + end; + + 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 Structure = sig + module Loc : Loc; + module Action : Action; + module Token : Token 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; + + (** 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 Dynamic = sig + include Structure; + + (** 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; + + (** 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 Static = sig + include Structure; + + 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; + +end; + +module type Lexer = sig + module Loc : Loc; + module Token : Token with module Loc = Loc; + module Error : Error; + + (** 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; + + +(** {6 Parser} *) +module type Parser = sig + + module Ast : Ast; + 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; + +(** {6 Printer} *) + +module type Printer = sig + + module Ast : Ast; + + 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; + +(** 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 Syntax = sig + module Loc : Loc; + module Warning : Warning with module Loc = Loc; + module Ast : Ast with module Loc = Loc; + module Token : Token with module Loc = Loc; + module Gram : Grammar.Static with module Loc = Loc and module Token = Token; + module AntiquotSyntax : AntiquotSyntax with module Ast = Ast; + (* Gram is not constrained here for flexibility *) + module Quotation : Quotation with module Ast = Ast; + module Parser : Parser with module Ast = Ast; + module Printer : Printer with module Ast = Ast; +end; + +(** 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 Camlp4Syntax = sig + module Loc : Loc; + module Warning : Warning with module Loc = Loc; + + module Ast : Camlp4Ast with module Loc = Loc; + module Token : Camlp4Token with module Loc = Loc; + + module Gram : Grammar.Static with module Loc = Loc and module Token = Token; + module AntiquotSyntax : AntiquotSyntax with module Ast = Camlp4AstToAst Ast; + (* Gram is not constrained here for flexibility *) + module Quotation : Quotation with module Ast = Camlp4AstToAst Ast; + module Parser : Parser with module Ast = Camlp4AstToAst Ast; + module Printer : Printer with module Ast = Camlp4AstToAst 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; + +module type SyntaxExtension = functor (Syn : Syntax) + -> (Syntax 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); + diff --git a/camlp4/Camlp4/Struct/.cvsignore b/camlp4/Camlp4/Struct/.cvsignore index 1faf93690..262784dbd 100644 --- a/camlp4/Camlp4/Struct/.cvsignore +++ b/camlp4/Camlp4/Struct/.cvsignore @@ -1,4 +1,2 @@ -*.cm* -Grammar.ml Lexer.ml Camlp4Ast.tmp.ml |