2 (****************************************************************************)
6 (* INRIA Rocquencourt *)
8 (* Copyright 2006 Institut National de Recherche en Informatique et *)
9 (* en Automatique. All rights reserved. This file is distributed under *)
10 (* the terms of the GNU Library General Public License, with the special *)
11 (* exception on linking described in LICENSE at the top of the Objective *)
12 (* Caml source tree. *)
14 (****************************************************************************)
17 * - Daniel de Rauglaudre: initial version
18 * - Nicolas Pouillard: refactoring
23 (** Camlp4 signature repository *)
25 (** {6 Basic signatures} *)
27 (** Signature with just a type. *)
28 module type Type = sig
32 (** Signature for errors modules, an Error modules can be registred with
33 the {!ErrorHandler.Register} functor in order to be well printed. *)
34 module type Error = sig
37 value to_string : t -> string;
38 value print : Format.formatter -> t -> unit;
41 (** A signature for extensions identifiers. *)
44 (** The name of the extension, typically the module name. *)
47 (** The version of the extension, typically $ Id$ with a versionning system. *)
48 value version : string;
52 (** A signature for warnings abstract from locations. *)
53 module Warning (Loc : Type) = struct
55 type warning = Loc.t -> string -> unit;
56 value default_warning : warning;
57 value current_warning : ref warning;
58 value print_warning : warning;
62 (** {6 Advanced signatures} *)
64 (** A signature for locations. *)
69 (** Return a start location for the given file name.
70 This location starts at the begining of the file. *)
71 value mk : string -> t;
73 (** The [ghost] location can be used when no location
74 information is available. *)
77 (** {6 Conversion functions} *)
79 (** Return a location where both positions are set the given position. *)
80 value of_lexing_position : Lexing.position -> t;
82 (** Return an OCaml location. *)
83 value to_ocaml_location : t -> Camlp4_import.Location.t;
85 (** Return a location from an OCaml location. *)
86 value of_ocaml_location : Camlp4_import.Location.t -> t;
88 (** Return a location from ocamllex buffer. *)
89 value of_lexbuf : Lexing.lexbuf -> t;
91 (** Return a location from [(file_name, start_line, start_bol, start_off,
92 stop_line, stop_bol, stop_off, ghost)]. *)
93 value of_tuple : (string * int * int * int * int * int * int * bool) -> t;
95 (** Return [(file_name, start_line, start_bol, start_off,
96 stop_line, stop_bol, stop_off, ghost)]. *)
97 value to_tuple : t -> (string * int * int * int * int * int * int * bool);
99 (** [merge loc1 loc2] Return a location that starts at [loc1] and end at [loc2]. *)
100 value merge : t -> t -> t;
102 (** The stop pos becomes equal to the start pos. *)
105 (** [move selector n loc]
106 Return the location where positions are moved.
107 Affected positions are chosen with [selector].
108 Returned positions have their character offset plus [n]. *)
109 value move : [= `start | `stop | `both ] -> int -> t -> t;
111 (** [shift n loc] Return the location where the new start position is the old
112 stop position, and where the new stop position character offset is the
114 value shift : int -> t -> t;
116 (** [move_line n loc] Return the location with the old line count plus [n].
117 The "begin of line" of both positions become the current offset. *)
118 value move_line : int -> t -> t;
122 (** Return the file name *)
123 value file_name : t -> string;
125 (** Return the line number of the begining of this location. *)
126 value start_line : t -> int;
128 (** Return the line number of the ending of this location. *)
129 value stop_line : t -> int;
131 (** Returns the number of characters from the begining of the file
132 to the begining of the line of location's begining. *)
133 value start_bol : t -> int;
135 (** Returns the number of characters from the begining of the file
136 to the begining of the line of location's ending. *)
137 value stop_bol : t -> int;
139 (** Returns the number of characters from the begining of the file
140 of the begining of this location. *)
141 value start_off : t -> int;
143 (** Return the number of characters from the begining of the file
144 of the ending of this location. *)
145 value stop_off : t -> int;
147 (** Return the start position as a Lexing.position. *)
148 value start_pos : t -> Lexing.position;
150 (** Return the stop position as a Lexing.position. *)
151 value stop_pos : t -> Lexing.position;
153 (** Generally, return true if this location does not come
154 from an input stream. *)
155 value is_ghost : t -> bool;
157 (** Return the associated ghost location. *)
158 value ghostify : t -> t;
160 (** Return the location with the give file name *)
161 value set_file_name : string -> t -> t;
163 (** [strictly_before loc1 loc2] True if the stop position of [loc1] is
164 strictly_before the start position of [loc2]. *)
165 value strictly_before : t -> t -> bool;
167 (** Return the location with an absolute file name. *)
168 value make_absolute : t -> t;
170 (** Print the location into the formatter in a format suitable for error
172 value print : Format.formatter -> t -> unit;
174 (** Print the location in a short format useful for debugging. *)
175 value dump : Format.formatter -> t -> unit;
177 (** Same as {!print} but return a string instead of printting it. *)
178 value to_string : t -> string;
180 (** [Exc_located loc e] is an encapsulation of the exception [e] with
181 the input location [loc]. To be used in quotation expanders
182 and in grammars to specify some input location for an error.
183 Do not raise this exception directly: rather use the following
184 function [Loc.raise]. *)
185 exception Exc_located of t and exn;
187 (** [raise loc e], if [e] is already an [Exc_located] exception,
188 re-raise it, else raise the exception [Exc_located loc e]. *)
189 value raise : t -> exn -> 'a;
191 (** The name of the location variable used in grammars and in
192 the predefined quotations for OCaml syntax trees. Default: [_loc]. *)
193 value name : ref string;
197 (** Abstract syntax tree minimal signature.
198 Types of this signature are abstract.
199 See the {!Camlp4Ast} signature for a concrete definition. *)
200 module type Ast = sig
202 (** {6 Syntactic categories as abstract types} *)
226 (** {6 Location accessors} *)
228 value loc_of_ctyp : ctyp -> loc;
229 value loc_of_patt : patt -> loc;
230 value loc_of_expr : expr -> loc;
231 value loc_of_module_type : module_type -> loc;
232 value loc_of_module_expr : module_expr -> loc;
233 value loc_of_sig_item : sig_item -> loc;
234 value loc_of_str_item : str_item -> loc;
235 value loc_of_class_type : class_type -> loc;
236 value loc_of_class_sig_item : class_sig_item -> loc;
237 value loc_of_class_expr : class_expr -> loc;
238 value loc_of_class_str_item : class_str_item -> loc;
239 value loc_of_with_constr : with_constr -> loc;
240 value loc_of_binding : binding -> loc;
241 value loc_of_rec_binding : rec_binding -> loc;
242 value loc_of_module_binding : module_binding -> loc;
243 value loc_of_match_case : match_case -> loc;
244 value loc_of_ident : ident -> loc;
246 (** {6 Traversals} *)
248 (** This class is the base class for map traversal on the Ast.
249 To make a custom traversal class one just extend it like that:
251 This example swap pairs expression contents:
254 inherit Ast.map as super;
256 match super#expr e with
257 \[ <:expr\@_loc< ($e1$, $e2$) >> -> <:expr< ($e2$, $e1$) >>
260 value _loc = Loc.ghost;
261 value map = (new swap)#expr;
262 assert (map <:expr< fun x -> (x, 42) >> = <:expr< fun x -> (42, x) >>);]
264 class map : object ('self_type)
265 method string : string -> string;
266 method list : ! 'a 'b . ('self_type -> 'a -> 'b) -> list 'a -> list 'b;
267 method meta_bool : meta_bool -> meta_bool;
268 method meta_option : ! 'a 'b . ('self_type -> 'a -> 'b) -> meta_option 'a -> meta_option 'b;
269 method meta_list : ! 'a 'b . ('self_type -> 'a -> 'b) -> meta_list 'a -> meta_list 'b;
270 method loc : loc -> loc;
271 method expr : expr -> expr;
272 method patt : patt -> patt;
273 method ctyp : ctyp -> ctyp;
274 method str_item : str_item -> str_item;
275 method sig_item : sig_item -> sig_item;
277 method module_expr : module_expr -> module_expr;
278 method module_type : module_type -> module_type;
279 method class_expr : class_expr -> class_expr;
280 method class_type : class_type -> class_type;
281 method class_sig_item : class_sig_item -> class_sig_item;
282 method class_str_item : class_str_item -> class_str_item;
283 method with_constr : with_constr -> with_constr;
284 method binding : binding -> binding;
285 method rec_binding : rec_binding -> rec_binding;
286 method module_binding : module_binding -> module_binding;
287 method match_case : match_case -> match_case;
288 method ident : ident -> ident;
290 method unknown : ! 'a. 'a -> 'a;
293 (** Fold style traversal *)
294 class fold : object ('self_type)
295 method string : string -> 'self_type;
296 method list : ! 'a . ('self_type -> 'a -> 'self_type) -> list 'a -> 'self_type;
297 method meta_bool : meta_bool -> 'self_type;
298 method meta_option : ! 'a . ('self_type -> 'a -> 'self_type) -> meta_option 'a -> 'self_type;
299 method meta_list : ! 'a . ('self_type -> 'a -> 'self_type) -> meta_list 'a -> 'self_type;
300 method loc : loc -> 'self_type;
301 method expr : expr -> 'self_type;
302 method patt : patt -> 'self_type;
303 method ctyp : ctyp -> 'self_type;
304 method str_item : str_item -> 'self_type;
305 method sig_item : sig_item -> 'self_type;
306 method module_expr : module_expr -> 'self_type;
307 method module_type : module_type -> 'self_type;
308 method class_expr : class_expr -> 'self_type;
309 method class_type : class_type -> 'self_type;
310 method class_sig_item : class_sig_item -> 'self_type;
311 method class_str_item : class_str_item -> 'self_type;
312 method with_constr : with_constr -> 'self_type;
313 method binding : binding -> 'self_type;
314 method rec_binding : rec_binding -> 'self_type;
315 method module_binding : module_binding -> 'self_type;
316 method match_case : match_case -> 'self_type;
317 method ident : ident -> 'self_type;
319 method unknown : ! 'a. 'a -> 'self_type;
325 (** Signature for OCaml syntax trees. *) (*
326 This signature is an extension of {!Ast}
328 - Types for all kinds of structure.
329 - Map: A base class for map traversals.
330 - Map classes and functions for common kinds.
333 ctyp :: Representaion of types
334 patt :: The type of patterns
335 expr :: The type of expressions
336 match_case :: The type of cases for match/function/try constructions
337 ident :: The type of identifiers (including path like Foo(X).Bar.y)
338 binding :: The type of let bindings
339 rec_binding :: The type of record definitions
342 module_type :: The type of module types
343 sig_item :: The type of signature items
344 str_item :: The type of structure items
345 module_expr :: The type of module expressions
346 module_binding :: The type of recursive module definitions
347 with_constr :: The type of `with' constraints
350 class_type :: The type of class types
351 class_sig_item :: The type of class signature items
352 class_expr :: The type of class expressions
353 class_str_item :: The type of class structure items
355 module type Camlp4Ast = sig
357 (** The inner module for locations *)
360 INCLUDE "camlp4/Camlp4/Camlp4Ast.partial.ml";
362 value loc_of_ctyp : ctyp -> loc;
363 value loc_of_patt : patt -> loc;
364 value loc_of_expr : expr -> loc;
365 value loc_of_module_type : module_type -> loc;
366 value loc_of_module_expr : module_expr -> loc;
367 value loc_of_sig_item : sig_item -> loc;
368 value loc_of_str_item : str_item -> loc;
369 value loc_of_class_type : class_type -> loc;
370 value loc_of_class_sig_item : class_sig_item -> loc;
371 value loc_of_class_expr : class_expr -> loc;
372 value loc_of_class_str_item : class_str_item -> loc;
373 value loc_of_with_constr : with_constr -> loc;
374 value loc_of_binding : binding -> loc;
375 value loc_of_rec_binding : rec_binding -> loc;
376 value loc_of_module_binding : module_binding -> loc;
377 value loc_of_match_case : match_case -> loc;
378 value loc_of_ident : ident -> loc;
381 module type META_LOC = sig
382 (* The first location is where to put the returned pattern.
383 Generally it's _loc to match with <:patt< ... >> quotations.
384 The second location is the one to treat. *)
385 value meta_loc_patt : loc -> loc -> patt;
386 (* The first location is where to put the returned expression.
387 Generally it's _loc to match with <:expr< ... >> quotations.
388 The second location is the one to treat. *)
389 value meta_loc_expr : loc -> loc -> expr;
392 value meta_loc_patt : loc -> loc -> patt;
393 value meta_loc_expr : loc -> loc -> expr;
395 module MetaGhostLoc : sig
396 value meta_loc_patt : loc -> 'a -> patt;
397 value meta_loc_expr : loc -> 'a -> expr;
399 module MetaLocVar : sig
400 value meta_loc_patt : loc -> 'a -> patt;
401 value meta_loc_expr : loc -> 'a -> expr;
403 module Make (MetaLoc : META_LOC) : sig
405 value meta_string : loc -> string -> expr;
406 value meta_int : loc -> string -> expr;
407 value meta_float : loc -> string -> expr;
408 value meta_char : loc -> string -> expr;
409 value meta_bool : loc -> bool -> expr;
410 value meta_list : (loc -> 'a -> expr) -> loc -> list 'a -> expr;
411 value meta_binding : loc -> binding -> expr;
412 value meta_rec_binding : loc -> rec_binding -> expr;
413 value meta_class_expr : loc -> class_expr -> expr;
414 value meta_class_sig_item : loc -> class_sig_item -> expr;
415 value meta_class_str_item : loc -> class_str_item -> expr;
416 value meta_class_type : loc -> class_type -> expr;
417 value meta_ctyp : loc -> ctyp -> expr;
418 value meta_expr : loc -> expr -> expr;
419 value meta_ident : loc -> ident -> expr;
420 value meta_match_case : loc -> match_case -> expr;
421 value meta_module_binding : loc -> module_binding -> expr;
422 value meta_module_expr : loc -> module_expr -> expr;
423 value meta_module_type : loc -> module_type -> expr;
424 value meta_patt : loc -> patt -> expr;
425 value meta_sig_item : loc -> sig_item -> expr;
426 value meta_str_item : loc -> str_item -> expr;
427 value meta_with_constr : loc -> with_constr -> expr;
430 value meta_string : loc -> string -> patt;
431 value meta_int : loc -> string -> patt;
432 value meta_float : loc -> string -> patt;
433 value meta_char : loc -> string -> patt;
434 value meta_bool : loc -> bool -> patt;
435 value meta_list : (loc -> 'a -> patt) -> loc -> list 'a -> patt;
436 value meta_binding : loc -> binding -> patt;
437 value meta_rec_binding : loc -> rec_binding -> patt;
438 value meta_class_expr : loc -> class_expr -> patt;
439 value meta_class_sig_item : loc -> class_sig_item -> patt;
440 value meta_class_str_item : loc -> class_str_item -> patt;
441 value meta_class_type : loc -> class_type -> patt;
442 value meta_ctyp : loc -> ctyp -> patt;
443 value meta_expr : loc -> expr -> patt;
444 value meta_ident : loc -> ident -> patt;
445 value meta_match_case : loc -> match_case -> patt;
446 value meta_module_binding : loc -> module_binding -> patt;
447 value meta_module_expr : loc -> module_expr -> patt;
448 value meta_module_type : loc -> module_type -> patt;
449 value meta_patt : loc -> patt -> patt;
450 value meta_sig_item : loc -> sig_item -> patt;
451 value meta_str_item : loc -> str_item -> patt;
452 value meta_with_constr : loc -> with_constr -> patt;
457 (** See {!Ast.map}. *)
458 class map : object ('self_type)
459 method string : string -> string;
460 method list : ! 'a 'b . ('self_type -> 'a -> 'b) -> list 'a -> list 'b;
461 method meta_bool : meta_bool -> meta_bool;
462 method meta_option : ! 'a 'b . ('self_type -> 'a -> 'b) -> meta_option 'a -> meta_option 'b;
463 method meta_list : ! 'a 'b . ('self_type -> 'a -> 'b) -> meta_list 'a -> meta_list 'b;
464 method loc : loc -> loc;
465 method expr : expr -> expr;
466 method patt : patt -> patt;
467 method ctyp : ctyp -> ctyp;
468 method str_item : str_item -> str_item;
469 method sig_item : sig_item -> sig_item;
471 method module_expr : module_expr -> module_expr;
472 method module_type : module_type -> module_type;
473 method class_expr : class_expr -> class_expr;
474 method class_type : class_type -> class_type;
475 method class_sig_item : class_sig_item -> class_sig_item;
476 method class_str_item : class_str_item -> class_str_item;
477 method with_constr : with_constr -> with_constr;
478 method binding : binding -> binding;
479 method rec_binding : rec_binding -> rec_binding;
480 method module_binding : module_binding -> module_binding;
481 method match_case : match_case -> match_case;
482 method ident : ident -> ident;
484 method unknown : ! 'a. 'a -> 'a;
487 (** See {!Ast.fold}. *)
488 class fold : object ('self_type)
489 method string : string -> 'self_type;
490 method list : ! 'a . ('self_type -> 'a -> 'self_type) -> list 'a -> 'self_type;
491 method meta_bool : meta_bool -> 'self_type;
492 method meta_option : ! 'a . ('self_type -> 'a -> 'self_type) -> meta_option 'a -> 'self_type;
493 method meta_list : ! 'a . ('self_type -> 'a -> 'self_type) -> meta_list 'a -> 'self_type;
494 method loc : loc -> 'self_type;
495 method expr : expr -> 'self_type;
496 method patt : patt -> 'self_type;
497 method ctyp : ctyp -> 'self_type;
498 method str_item : str_item -> 'self_type;
499 method sig_item : sig_item -> 'self_type;
500 method module_expr : module_expr -> 'self_type;
501 method module_type : module_type -> 'self_type;
502 method class_expr : class_expr -> 'self_type;
503 method class_type : class_type -> 'self_type;
504 method class_sig_item : class_sig_item -> 'self_type;
505 method class_str_item : class_str_item -> 'self_type;
506 method with_constr : with_constr -> 'self_type;
507 method binding : binding -> 'self_type;
508 method rec_binding : rec_binding -> 'self_type;
509 method module_binding : module_binding -> 'self_type;
510 method match_case : match_case -> 'self_type;
511 method ident : ident -> 'self_type;
513 method unknown : ! 'a. 'a -> 'self_type;
516 value map_expr : (expr -> expr) -> map;
517 value map_patt : (patt -> patt) -> map;
518 value map_ctyp : (ctyp -> ctyp) -> map;
519 value map_str_item : (str_item -> str_item) -> map;
520 value map_sig_item : (sig_item -> sig_item) -> map;
521 value map_loc : (loc -> loc) -> map;
523 value ident_of_expr : expr -> ident;
524 value ident_of_patt : patt -> ident;
525 value ident_of_ctyp : ctyp -> ident;
527 value biAnd_of_list : list binding -> binding;
528 value rbSem_of_list : list rec_binding -> rec_binding;
529 value paSem_of_list : list patt -> patt;
530 value paCom_of_list : list patt -> patt;
531 value tyOr_of_list : list ctyp -> ctyp;
532 value tyAnd_of_list : list ctyp -> ctyp;
533 value tyAmp_of_list : list ctyp -> ctyp;
534 value tySem_of_list : list ctyp -> ctyp;
535 value tyCom_of_list : list ctyp -> ctyp;
536 value tySta_of_list : list ctyp -> ctyp;
537 value stSem_of_list : list str_item -> str_item;
538 value sgSem_of_list : list sig_item -> sig_item;
539 value crSem_of_list : list class_str_item -> class_str_item;
540 value cgSem_of_list : list class_sig_item -> class_sig_item;
541 value ctAnd_of_list : list class_type -> class_type;
542 value ceAnd_of_list : list class_expr -> class_expr;
543 value wcAnd_of_list : list with_constr -> with_constr;
544 value meApp_of_list : list module_expr -> module_expr;
545 value mbAnd_of_list : list module_binding -> module_binding;
546 value mcOr_of_list : list match_case -> match_case;
547 value idAcc_of_list : list ident -> ident;
548 value idApp_of_list : list ident -> ident;
549 value exSem_of_list : list expr -> expr;
550 value exCom_of_list : list expr -> expr;
552 value list_of_ctyp : ctyp -> list ctyp -> list ctyp;
553 value list_of_binding : binding -> list binding -> list binding;
554 value list_of_rec_binding : rec_binding -> list rec_binding -> list rec_binding;
555 value list_of_with_constr : with_constr -> list with_constr -> list with_constr;
556 value list_of_patt : patt -> list patt -> list patt;
557 value list_of_expr : expr -> list expr -> list expr;
558 value list_of_str_item : str_item -> list str_item -> list str_item;
559 value list_of_sig_item : sig_item -> list sig_item -> list sig_item;
560 value list_of_class_sig_item : class_sig_item -> list class_sig_item -> list class_sig_item;
561 value list_of_class_str_item : class_str_item -> list class_str_item -> list class_str_item;
562 value list_of_class_type : class_type -> list class_type -> list class_type;
563 value list_of_class_expr : class_expr -> list class_expr -> list class_expr;
564 value list_of_module_expr : module_expr -> list module_expr -> list module_expr;
565 value list_of_module_binding : module_binding -> list module_binding -> list module_binding;
566 value list_of_match_case : match_case -> list match_case -> list match_case;
567 value list_of_ident : ident -> list ident -> list ident;
569 (** Like [String.escape] but takes care to not
570 escape antiquotations strings. *)
571 value safe_string_escaped : string -> string;
573 (** Returns True if the given pattern is irrefutable. *)
574 value is_irrefut_patt : patt -> bool;
576 value is_constructor : ident -> bool;
577 value is_patt_constructor : patt -> bool;
578 value is_expr_constructor : expr -> bool;
580 value ty_of_stl : (Loc.t * string * list ctyp) -> ctyp;
581 value ty_of_sbt : (Loc.t * string * bool * ctyp) -> ctyp;
582 value bi_of_pe : (patt * expr) -> binding;
583 value pel_of_binding : binding -> list (patt * expr);
584 value binding_of_pel : list (patt * expr) -> binding;
585 value sum_type_of_list : list (Loc.t * string * list ctyp) -> ctyp;
586 value record_type_of_list : list (Loc.t * string * bool * ctyp) -> ctyp;
589 (** This functor is a restriction functor.
590 It takes a Camlp4Ast module and gives the Ast one.
591 Typical use is for [with] constraints.
592 Example: ... with module Ast = Camlp4.Sig.Camlp4AstToAst Camlp4Ast *)
593 module Camlp4AstToAst (M : Camlp4Ast) : Ast
594 with type loc = M.loc
595 and type meta_bool = M.meta_bool
596 and type meta_option 'a = M.meta_option 'a
597 and type meta_list 'a = M.meta_list 'a
598 and type ctyp = M.ctyp
599 and type patt = M.patt
600 and type expr = M.expr
601 and type module_type = M.module_type
602 and type sig_item = M.sig_item
603 and type with_constr = M.with_constr
604 and type module_expr = M.module_expr
605 and type str_item = M.str_item
606 and type class_type = M.class_type
607 and type class_sig_item = M.class_sig_item
608 and type class_expr = M.class_expr
609 and type class_str_item = M.class_str_item
610 and type binding = M.binding
611 and type rec_binding = M.rec_binding
612 and type module_binding = M.module_binding
613 and type match_case = M.match_case
614 and type ident = M.ident
617 (** Concrete definition of Camlp4 ASTs abstracted from locations.
618 Since the Ast contains locations, this functor produces Ast types
619 for a given location type. *)
620 module MakeCamlp4Ast (Loc : Type) = struct
622 INCLUDE "camlp4/Camlp4/Camlp4Ast.partial.ml";
628 (** A type for stream filters. *)
629 type stream_filter 'a 'loc = Stream.t ('a * 'loc) -> Stream.t ('a * 'loc);
631 (** Registerinng and folding of Ast filters.
632 Two kinds of filters must be handled:
633 - Implementation filters: str_item -> str_item.
634 - Interface filters: sig_item -> sig_item. *)
635 module type AstFilters = sig
637 module Ast : Camlp4Ast;
639 type filter 'a = 'a -> 'a;
641 value register_sig_item_filter : (filter Ast.sig_item) -> unit;
642 value register_str_item_filter : (filter Ast.str_item) -> unit;
643 value register_topphrase_filter : (filter Ast.str_item) -> unit;
645 value fold_interf_filters : ('a -> filter Ast.sig_item -> 'a) -> 'a -> 'a;
646 value fold_implem_filters : ('a -> filter Ast.str_item -> 'a) -> 'a -> 'a;
647 value fold_topphrase_filters : ('a -> filter Ast.str_item -> 'a) -> 'a -> 'a;
651 (** ASTs as one single dynamic type *)
652 module type DynAst = sig
656 value ctyp_tag : tag Ast.ctyp;
657 value patt_tag : tag Ast.patt;
658 value expr_tag : tag Ast.expr;
659 value module_type_tag : tag Ast.module_type;
660 value sig_item_tag : tag Ast.sig_item;
661 value with_constr_tag : tag Ast.with_constr;
662 value module_expr_tag : tag Ast.module_expr;
663 value str_item_tag : tag Ast.str_item;
664 value class_type_tag : tag Ast.class_type;
665 value class_sig_item_tag : tag Ast.class_sig_item;
666 value class_expr_tag : tag Ast.class_expr;
667 value class_str_item_tag : tag Ast.class_str_item;
668 value match_case_tag : tag Ast.match_case;
669 value ident_tag : tag Ast.ident;
670 value binding_tag : tag Ast.binding;
671 value rec_binding_tag : tag Ast.rec_binding;
672 value module_binding_tag : tag Ast.module_binding;
674 value string_of_tag : tag 'a -> string;
676 module Pack (X : sig type t 'a; end) : sig
678 value pack : tag 'a -> X.t 'a -> pack;
679 value unpack : tag 'a -> pack -> X.t 'a;
680 value print_tag : Format.formatter -> pack -> unit;
685 (** {6 Quotation operations} *)
687 (** The generic quotation type.
688 To see how fields are used here is an example:
689 <:q_name@q_loc<q_contents>>
690 The last one, q_shift is equal to the length of "<:q_name@q_loc<". *)
695 q_contents : string };
697 (** The signature for a quotation expander registery. *)
698 module type Quotation = sig
700 module DynAst : DynAst with module Ast = Ast;
703 (** The [loc] is the initial location. The option string is the optional name
704 for the location variable. The string is the quotation contents. *)
705 type expand_fun 'a = loc -> option string -> string -> 'a;
707 (** [add name exp] adds the quotation [name] associated with the
709 value add : string -> DynAst.tag 'a -> expand_fun 'a -> unit;
711 (** [find name] returns the expander of the given quotation name. *)
712 value find : string -> DynAst.tag 'a -> expand_fun 'a;
714 (** [default] holds the default quotation name. *)
715 value default : ref string;
717 (** [parse_quotation_result parse_function loc position_tag quotation quotation_result]
718 It's a parser wrapper, this function handles the error reporting for you. *)
719 value parse_quotation_result :
720 (loc -> string -> 'a) -> loc -> quotation -> string -> string -> 'a;
722 (** function translating quotation names; default = identity *)
723 value translate : ref (string -> string);
725 value expand : loc -> quotation -> DynAst.tag 'a -> 'a;
727 (** [dump_file] optionally tells Camlp4 to dump the
728 result of an expander if this result is syntactically incorrect.
729 If [None] (default), this result is not dumped. If [Some fname], the
730 result is dumped in the file [fname]. *)
731 value dump_file : ref (option string);
733 module Error : Error;
739 (** A signature for tokens. *)
740 module type Token = sig
746 value to_string : t -> string;
748 value print : Format.formatter -> t -> unit;
750 value match_keyword : string -> t -> bool;
752 value extract_string : t -> string;
756 type token_filter = stream_filter t Loc.t;
758 (** The type for this filter chain.
759 A basic implementation just store the [is_keyword] function given
760 by [mk] and use it in the [filter] function. *)
763 (** The given predicate function returns true if the given string
764 is a keyword. This function can be used in filters to translate
765 identifier tokens to keyword tokens. *)
766 value mk : (string -> bool) -> t;
768 (** This function allows to register a new filter to the token filter chain.
769 You can choose to not support these and raise an exception. *)
770 value define_filter : t -> (token_filter -> token_filter) -> unit;
772 (** This function filter the given stream and return a filtered stream.
773 A basic implementation just match identifiers against the [is_keyword]
774 function to produce token keywords instead. *)
775 value filter : t -> token_filter;
777 (** Called by the grammar system when a keyword is used.
778 The boolean argument is True when it's the first time that keyword
779 is used. If you do not care about this information just return [()]. *)
780 value keyword_added : t -> string -> bool -> unit;
782 (** Called by the grammar system when a keyword is no longer used.
783 If you do not care about this information just return [()]. *)
784 value keyword_removed : t -> string -> unit;
787 module Error : Error;
790 (** This signature describes tokens for the Objective Caml and the Revised
791 syntax lexing rules. For some tokens the data constructor holds two
792 representations with the evaluated one and the source one. For example
793 the INT data constructor holds an integer and a string, this string can
794 contains more information that's needed for a good pretty-printing
795 ("42", "4_2", "0000042", "0b0101010"...).
797 The meaning of the tokens are:
798 - [KEYWORD s] is the keyword [s].
799 - [LIDENT s] is the ident [s] starting with a lowercase letter.
800 - [UIDENT s] is the ident [s] starting with an uppercase letter.
801 - [INT i s] (resp. [INT32 i s], [INT64 i s] and [NATIVEINT i s])
802 the integer constant [i] whose string source is [s].
803 - [FLOAT f s] is the float constant [f] whose string source is [s].
804 - [STRING s s'] is the string constant [s] whose string source is [s'].
805 - [CHAR c s] is the character constant [c] whose string source is [s].
806 - [QUOTATION q] is a quotation [q], see {!Quotation.t} for more information.
807 - [ANTIQUOT n s] is an antiquotation [n] holding the string [s].
808 - [EOI] is the end of input.
810 Warning: the second string associated with the constructor [STRING] is
811 the string found in the source without any interpretation. In particular,
812 the backslashes are not interpreted. For example, if the input is ["\n"]
813 the string is *not* a string with one element containing the character
814 "return", but a string of two elements: the backslash and the character
815 ["n"]. To interpret a string use the first string of the [STRING]
816 constructor (or if you need to compute it use the module
817 {!Camlp4.Struct.Token.Eval}. Same thing for the constructor [CHAR]. *)
823 | ESCAPED_IDENT of string
824 | INT of int and string
825 | INT32 of int32 and string
826 | INT64 of int64 and string
827 | NATIVEINT of nativeint and string
828 | FLOAT of float and string
829 | CHAR of char and string
830 | STRING of string and string
833 | QUOTATION of quotation
834 | ANTIQUOT of string and string
838 | LINE_DIRECTIVE of int and option string
841 (** A signature for specialized tokens. *)
842 module type Camlp4Token = Token with type t = camlp4_token;
844 (** {6 Dynamic loaders} *)
846 (** A signature for dynamic loaders. *)
847 module type DynLoader = sig
849 exception Error of string and string;
851 (** [mk ?ocaml_stdlib ?camlp4_stdlib]
852 The stdlib flag is true by default.
853 To disable it use: [mk ~ocaml_stdlib:False] *)
854 value mk : ?ocaml_stdlib: bool -> ?camlp4_stdlib: bool -> unit -> t;
856 (** Fold over the current load path list. *)
857 value fold_load_path : t -> (string -> 'a -> 'a) -> 'a -> 'a;
859 (** [load f] Load the file [f]. If [f] is not an absolute path name,
860 the load path list used to find the directory of [f]. *)
861 value load : t -> string -> unit;
863 (** [include_dir d] Add the directory [d] in the current load path
864 list (like the common -I option). *)
865 value include_dir : t -> string -> unit;
867 (** [find_in_path f] Returns the full path of the file [f] if
868 [f] is in the current load path, raises [Not_found] otherwise. *)
869 value find_in_path : t -> string -> string;
871 (** [is_native] [True] if we are in native code, [False] for bytecode. *)
872 value is_native : bool;
875 (** A signature for grammars. *)
876 module Grammar = struct
878 (** Internal signature for sematantic actions of grammars,
879 not for the casual user. These functions are unsafe. *)
880 module type Action = sig
885 value getf : t -> ('a -> 'b);
886 value getf2 : t -> ('a -> 'b -> 'c);
901 (** Common signature for {!Sig.Grammar.Static} and {!Sig.Grammar.Dynamic}. *)
902 module type Structure = sig
904 module Action : Action;
905 module Token : Token with module Loc = Loc;
911 type token_pattern = ((Token.t -> bool) * string);
914 [ Smeta of string and list symbol and Action.t
915 | Snterm of internal_entry
916 | Snterml of internal_entry and string
918 | Slist0sep of symbol and symbol
920 | Slist1sep of symbol and symbol
924 | Stoken of token_pattern
928 type production_rule = (list symbol * Action.t);
929 type single_extend_statment =
930 (option string * option assoc * list production_rule);
931 type extend_statment =
932 (option position * list single_extend_statment);
933 type delete_statment = list symbol;
936 internal_entry -> list symbol ->
937 (Stream.t 'a -> 'b) -> Stream.t 'a -> 'c;
939 type foldsep 'a 'b 'c =
940 internal_entry -> list symbol ->
941 (Stream.t 'a -> 'b) -> (Stream.t 'a -> unit) -> Stream.t 'a -> 'c;
945 (** Signature for Camlp4 grammars. Here the dynamic means that you can produce as
946 many grammar values as needed with a single grammar module.
947 If you do not need many grammar values it's preferable to use a static one. *)
948 module type Dynamic = sig
951 (** Make a new grammar. *)
952 value mk : unit -> gram;
955 (** The abstract type of grammar entries. The type parameter is the type
956 of the semantic actions that are associated with this entry. *)
959 (** Make a new entry from the given name. *)
960 value mk : gram -> string -> t 'a;
962 (** Make a new entry from a name and an hand made token parser. *)
964 gram -> string -> (Stream.t (Token.t * Loc.t) -> 'a) -> t 'a;
966 (** Clear the entry and setup this parser instead. *)
968 t 'a -> (Stream.t (Token.t * Loc.t) -> 'a) -> unit;
970 (** Get the entry name. *)
971 value name : t 'a -> string;
973 (** Print the given entry into the given formatter. *)
974 value print : Format.formatter -> t 'a -> unit;
976 (** Same as {!print} but show the left-factorization. *)
977 value dump : Format.formatter -> t 'a -> unit;
980 value obj : t 'a -> internal_entry;
981 value clear : t 'a -> unit;
985 (** [get_filter g] Get the {!Token.Filter} associated to the [g]. *)
986 value get_filter : gram -> Token.Filter.t;
988 type not_filtered 'a;
990 (** This function is called by the EXTEND ... END syntax. *)
991 value extend : Entry.t 'a -> extend_statment -> unit;
993 (** The delete rule. *)
994 value delete_rule : Entry.t 'a -> delete_statment -> unit;
996 value srules : Entry.t 'a -> list (list symbol * Action.t) -> symbol;
997 value sfold0 : ('a -> 'b -> 'b) -> 'b -> fold _ 'a 'b;
998 value sfold1 : ('a -> 'b -> 'b) -> 'b -> fold _ 'a 'b;
999 value sfold0sep : ('a -> 'b -> 'b) -> 'b -> foldsep _ 'a 'b;
1000 (* value sfold1sep : ('a -> 'b -> 'b) -> 'b -> foldsep _ 'a 'b; *)
1002 (** Use the lexer to produce a non filtered token stream from a char stream. *)
1003 value lex : gram -> Loc.t -> Stream.t char
1004 -> not_filtered (Stream.t (Token.t * Loc.t));
1006 (** Token stream from string. *)
1007 value lex_string : gram -> Loc.t -> string
1008 -> not_filtered (Stream.t (Token.t * Loc.t));
1010 (** Filter a token stream using the {!Token.Filter} module *)
1011 value filter : gram -> not_filtered (Stream.t (Token.t * Loc.t))
1012 -> Stream.t (Token.t * Loc.t);
1014 (** Lex, filter and parse a stream of character. *)
1015 value parse : Entry.t 'a -> Loc.t -> Stream.t char -> 'a;
1017 (** Same as {!parse} but from a string. *)
1018 value parse_string : Entry.t 'a -> Loc.t -> string -> 'a;
1020 (** Parse a token stream that is not filtered yet. *)
1021 value parse_tokens_before_filter :
1022 Entry.t 'a -> not_filtered (Stream.t (Token.t * Loc.t)) -> 'a;
1024 (** Parse a token stream that is already filtered. *)
1025 value parse_tokens_after_filter :
1026 Entry.t 'a -> Stream.t (Token.t * Loc.t) -> 'a;
1030 (** Signature for Camlp4 grammars. Here the static means that there is only
1031 one grammar value by grammar module. If you do not need to store the grammar
1032 value it's preferable to use a static one. *)
1033 module type Static = sig
1037 (** The abstract type of grammar entries. The type parameter is the type
1038 of the semantic actions that are associated with this entry. *)
1041 (** Make a new entry from the given name. *)
1042 value mk : string -> t 'a;
1044 (** Make a new entry from a name and an hand made token parser. *)
1046 string -> (Stream.t (Token.t * Loc.t) -> 'a) -> t 'a;
1048 (** Clear the entry and setup this parser instead. *)
1049 value setup_parser :
1050 t 'a -> (Stream.t (Token.t * Loc.t) -> 'a) -> unit;
1052 (** Get the entry name. *)
1053 value name : t 'a -> string;
1055 (** Print the given entry into the given formatter. *)
1056 value print : Format.formatter -> t 'a -> unit;
1058 (** Same as {!print} but show the left-factorization. *)
1059 value dump : Format.formatter -> t 'a -> unit;
1062 value obj : t 'a -> internal_entry;
1063 value clear : t 'a -> unit;
1067 (** Get the {!Token.Filter} associated to the grammar module. *)
1068 value get_filter : unit -> Token.Filter.t;
1070 type not_filtered 'a;
1072 (** This function is called by the EXTEND ... END syntax. *)
1073 value extend : Entry.t 'a -> extend_statment -> unit;
1075 (** The delete rule. *)
1076 value delete_rule : Entry.t 'a -> delete_statment -> unit;
1077 value srules : Entry.t 'a -> list (list symbol * Action.t) -> symbol;
1078 value sfold0 : ('a -> 'b -> 'b) -> 'b -> fold _ 'a 'b;
1079 value sfold1 : ('a -> 'b -> 'b) -> 'b -> fold _ 'a 'b;
1080 value sfold0sep : ('a -> 'b -> 'b) -> 'b -> foldsep _ 'a 'b;
1081 (* value sfold1sep : ('a -> 'b -> 'b) -> 'b -> foldsep _ 'a 'b; *)
1083 (** Use the lexer to produce a non filtered token stream from a char stream. *)
1084 value lex : Loc.t -> Stream.t char
1085 -> not_filtered (Stream.t (Token.t * Loc.t));
1086 (** Token stream from string. *)
1087 value lex_string : Loc.t -> string
1088 -> not_filtered (Stream.t (Token.t * Loc.t));
1090 (** Filter a token stream using the {!Token.Filter} module *)
1091 value filter : not_filtered (Stream.t (Token.t * Loc.t))
1092 -> Stream.t (Token.t * Loc.t);
1094 (** Lex, filter and parse a stream of character. *)
1095 value parse : Entry.t 'a -> Loc.t -> Stream.t char -> 'a;
1097 (** Same as {!parse} but from a string. *)
1098 value parse_string : Entry.t 'a -> Loc.t -> string -> 'a;
1100 (** Parse a token stream that is not filtered yet. *)
1101 value parse_tokens_before_filter :
1102 Entry.t 'a -> not_filtered (Stream.t (Token.t * Loc.t)) -> 'a;
1104 (** Parse a token stream that is already filtered. *)
1105 value parse_tokens_after_filter :
1106 Entry.t 'a -> Stream.t (Token.t * Loc.t) -> 'a;
1112 (** A signature for lexers. *)
1113 module type Lexer = sig
1115 module Token : Token with module Loc = Loc;
1116 module Error : Error;
1118 (** The constructor for a lexing function. The character stream is the input
1119 stream to be lexed. The result is a stream of pairs of a token and
1121 The lexer do not use global (mutable) variables: instantiations
1122 of [Lexer.mk ()] do not perturb each other. *)
1123 value mk : unit -> (Loc.t -> Stream.t char -> Stream.t (Token.t * Loc.t));
1127 (** A signature for parsers abstract from ASTs. *)
1128 module Parser (Ast : Ast) = struct
1129 module type SIMPLE = sig
1130 (** The parse function for expressions.
1131 The underlying expression grammar entry is generally "expr; EOI". *)
1132 value parse_expr : Ast.loc -> string -> Ast.expr;
1134 (** The parse function for patterns.
1135 The underlying pattern grammar entry is generally "patt; EOI". *)
1136 value parse_patt : Ast.loc -> string -> Ast.patt;
1141 (** Called when parsing an implementation (ml file) to build the syntax
1142 tree; the returned list contains the phrases (structure items) as a
1143 single "declare" node (a list of structure items); if the parser
1144 encounter a directive it stops (since the directive may change the
1145 syntax), the given [directive_handler] function evaluates it and
1146 the parsing starts again. *)
1147 value parse_implem : ?directive_handler:(Ast.str_item -> option Ast.str_item) ->
1148 Ast.loc -> Stream.t char -> Ast.str_item;
1150 (** Same as {!parse_implem} but for interface (mli file). *)
1151 value parse_interf : ?directive_handler:(Ast.sig_item -> option Ast.sig_item) ->
1152 Ast.loc -> Stream.t char -> Ast.sig_item;
1156 (** A signature for printers abstract from ASTs. *)
1157 module Printer (Ast : Ast) = struct
1160 value print_interf : ?input_file:string -> ?output_file:string ->
1161 Ast.sig_item -> unit;
1162 value print_implem : ?input_file:string -> ?output_file:string ->
1163 Ast.str_item -> unit;
1168 (** A syntax module is a sort of constistent bunch of modules and values.
1169 In such a module you have a parser, a printer, and also modules for
1170 locations, syntax trees, tokens, grammars, quotations, anti-quotations.
1171 There is also the main grammar entries. *)
1172 module type Syntax = sig
1174 module Ast : Ast with type loc = Loc.t;
1175 module Token : Token with module Loc = Loc;
1176 module Gram : Grammar.Static with module Loc = Loc and module Token = Token;
1177 module Quotation : Quotation with module Ast = Ast;
1179 module AntiquotSyntax : (Parser Ast).SIMPLE;
1181 include (Warning Loc).S;
1182 include (Parser Ast).S;
1183 include (Printer Ast).S;
1186 (** A syntax module is a sort of constistent bunch of modules and values.
1187 In such a module you have a parser, a printer, and also modules for
1188 locations, syntax trees, tokens, grammars, quotations, anti-quotations.
1189 There is also the main grammar entries. *)
1190 module type Camlp4Syntax = sig
1193 module Ast : Camlp4Ast with module Loc = Loc;
1194 module Token : Camlp4Token with module Loc = Loc;
1196 module Gram : Grammar.Static with module Loc = Loc and module Token = Token;
1197 module Quotation : Quotation with module Ast = Camlp4AstToAst Ast;
1199 module AntiquotSyntax : (Parser Ast).SIMPLE;
1201 include (Warning Loc).S;
1202 include (Parser Ast).S;
1203 include (Printer Ast).S;
1205 value interf : Gram.Entry.t (list Ast.sig_item * option Loc.t);
1206 value implem : Gram.Entry.t (list Ast.str_item * option Loc.t);
1207 value top_phrase : Gram.Entry.t (option Ast.str_item);
1208 value use_file : Gram.Entry.t (list Ast.str_item * option Loc.t);
1209 value a_CHAR : Gram.Entry.t string;
1210 value a_FLOAT : Gram.Entry.t string;
1211 value a_INT : Gram.Entry.t string;
1212 value a_INT32 : Gram.Entry.t string;
1213 value a_INT64 : Gram.Entry.t string;
1214 value a_LABEL : Gram.Entry.t string;
1215 value a_LIDENT : Gram.Entry.t string;
1216 value a_NATIVEINT : Gram.Entry.t string;
1217 value a_OPTLABEL : Gram.Entry.t string;
1218 value a_STRING : Gram.Entry.t string;
1219 value a_UIDENT : Gram.Entry.t string;
1220 value a_ident : Gram.Entry.t string;
1221 value amp_ctyp : Gram.Entry.t Ast.ctyp;
1222 value and_ctyp : Gram.Entry.t Ast.ctyp;
1223 value match_case : Gram.Entry.t Ast.match_case;
1224 value match_case0 : Gram.Entry.t Ast.match_case;
1225 value match_case_quot : Gram.Entry.t Ast.match_case;
1226 value binding : Gram.Entry.t Ast.binding;
1227 value binding_quot : Gram.Entry.t Ast.binding;
1228 value rec_binding_quot : Gram.Entry.t Ast.rec_binding;
1229 value class_declaration : Gram.Entry.t Ast.class_expr;
1230 value class_description : Gram.Entry.t Ast.class_type;
1231 value class_expr : Gram.Entry.t Ast.class_expr;
1232 value class_expr_quot : Gram.Entry.t Ast.class_expr;
1233 value class_fun_binding : Gram.Entry.t Ast.class_expr;
1234 value class_fun_def : Gram.Entry.t Ast.class_expr;
1235 value class_info_for_class_expr : Gram.Entry.t Ast.class_expr;
1236 value class_info_for_class_type : Gram.Entry.t Ast.class_type;
1237 value class_longident : Gram.Entry.t Ast.ident;
1238 value class_longident_and_param : Gram.Entry.t Ast.class_expr;
1239 value class_name_and_param : Gram.Entry.t (string * Ast.ctyp);
1240 value class_sig_item : Gram.Entry.t Ast.class_sig_item;
1241 value class_sig_item_quot : Gram.Entry.t Ast.class_sig_item;
1242 value class_signature : Gram.Entry.t Ast.class_sig_item;
1243 value class_str_item : Gram.Entry.t Ast.class_str_item;
1244 value class_str_item_quot : Gram.Entry.t Ast.class_str_item;
1245 value class_structure : Gram.Entry.t Ast.class_str_item;
1246 value class_type : Gram.Entry.t Ast.class_type;
1247 value class_type_declaration : Gram.Entry.t Ast.class_type;
1248 value class_type_longident : Gram.Entry.t Ast.ident;
1249 value class_type_longident_and_param : Gram.Entry.t Ast.class_type;
1250 value class_type_plus : Gram.Entry.t Ast.class_type;
1251 value class_type_quot : Gram.Entry.t Ast.class_type;
1252 value comma_ctyp : Gram.Entry.t Ast.ctyp;
1253 value comma_expr : Gram.Entry.t Ast.expr;
1254 value comma_ipatt : Gram.Entry.t Ast.patt;
1255 value comma_patt : Gram.Entry.t Ast.patt;
1256 value comma_type_parameter : Gram.Entry.t Ast.ctyp;
1257 value constrain : Gram.Entry.t (Ast.ctyp * Ast.ctyp);
1258 value constructor_arg_list : Gram.Entry.t Ast.ctyp;
1259 value constructor_declaration : Gram.Entry.t Ast.ctyp;
1260 value constructor_declarations : Gram.Entry.t Ast.ctyp;
1261 value ctyp : Gram.Entry.t Ast.ctyp;
1262 value ctyp_quot : Gram.Entry.t Ast.ctyp;
1263 value cvalue_binding : Gram.Entry.t Ast.expr;
1264 value direction_flag : Gram.Entry.t Ast.meta_bool;
1265 value dummy : Gram.Entry.t unit;
1266 value eq_expr : Gram.Entry.t (string -> Ast.patt -> Ast.patt);
1267 value expr : Gram.Entry.t Ast.expr;
1268 value expr_eoi : Gram.Entry.t Ast.expr;
1269 value expr_quot : Gram.Entry.t Ast.expr;
1270 value field_expr : Gram.Entry.t Ast.rec_binding;
1271 value field_expr_list : Gram.Entry.t Ast.rec_binding;
1272 value fun_binding : Gram.Entry.t Ast.expr;
1273 value fun_def : Gram.Entry.t Ast.expr;
1274 value ident : Gram.Entry.t Ast.ident;
1275 value ident_quot : Gram.Entry.t Ast.ident;
1276 value ipatt : Gram.Entry.t Ast.patt;
1277 value ipatt_tcon : Gram.Entry.t Ast.patt;
1278 value label : Gram.Entry.t string;
1279 value label_declaration : Gram.Entry.t Ast.ctyp;
1280 value label_declaration_list : Gram.Entry.t Ast.ctyp;
1281 value label_expr : Gram.Entry.t Ast.rec_binding;
1282 value label_expr_list : Gram.Entry.t Ast.rec_binding;
1283 value label_ipatt : Gram.Entry.t Ast.patt;
1284 value label_ipatt_list : Gram.Entry.t Ast.patt;
1285 value label_longident : Gram.Entry.t Ast.ident;
1286 value label_patt : Gram.Entry.t Ast.patt;
1287 value label_patt_list : Gram.Entry.t Ast.patt;
1288 value labeled_ipatt : Gram.Entry.t Ast.patt;
1289 value let_binding : Gram.Entry.t Ast.binding;
1290 value meth_list : Gram.Entry.t (Ast.ctyp * Ast.meta_bool);
1291 value meth_decl : Gram.Entry.t Ast.ctyp;
1292 value module_binding : Gram.Entry.t Ast.module_binding;
1293 value module_binding0 : Gram.Entry.t Ast.module_expr;
1294 value module_binding_quot : Gram.Entry.t Ast.module_binding;
1295 value module_declaration : Gram.Entry.t Ast.module_type;
1296 value module_expr : Gram.Entry.t Ast.module_expr;
1297 value module_expr_quot : Gram.Entry.t Ast.module_expr;
1298 value module_longident : Gram.Entry.t Ast.ident;
1299 value module_longident_with_app : Gram.Entry.t Ast.ident;
1300 value module_rec_declaration : Gram.Entry.t Ast.module_binding;
1301 value module_type : Gram.Entry.t Ast.module_type;
1302 value module_type_quot : Gram.Entry.t Ast.module_type;
1303 value more_ctyp : Gram.Entry.t Ast.ctyp;
1304 value name_tags : Gram.Entry.t Ast.ctyp;
1305 value opt_as_lident : Gram.Entry.t string;
1306 value opt_class_self_patt : Gram.Entry.t Ast.patt;
1307 value opt_class_self_type : Gram.Entry.t Ast.ctyp;
1308 value opt_comma_ctyp : Gram.Entry.t Ast.ctyp;
1309 value opt_dot_dot : Gram.Entry.t Ast.meta_bool;
1310 value opt_eq_ctyp : Gram.Entry.t Ast.ctyp;
1311 value opt_expr : Gram.Entry.t Ast.expr;
1312 value opt_meth_list : Gram.Entry.t Ast.ctyp;
1313 value opt_mutable : Gram.Entry.t Ast.meta_bool;
1314 value opt_polyt : Gram.Entry.t Ast.ctyp;
1315 value opt_private : Gram.Entry.t Ast.meta_bool;
1316 value opt_rec : Gram.Entry.t Ast.meta_bool;
1317 value opt_virtual : Gram.Entry.t Ast.meta_bool;
1318 value opt_when_expr : Gram.Entry.t Ast.expr;
1319 value patt : Gram.Entry.t Ast.patt;
1320 value patt_as_patt_opt : Gram.Entry.t Ast.patt;
1321 value patt_eoi : Gram.Entry.t Ast.patt;
1322 value patt_quot : Gram.Entry.t Ast.patt;
1323 value patt_tcon : Gram.Entry.t Ast.patt;
1324 value phrase : Gram.Entry.t Ast.str_item;
1325 value poly_type : Gram.Entry.t Ast.ctyp;
1326 value row_field : Gram.Entry.t Ast.ctyp;
1327 value sem_expr : Gram.Entry.t Ast.expr;
1328 value sem_expr_for_list : Gram.Entry.t (Ast.expr -> Ast.expr);
1329 value sem_patt : Gram.Entry.t Ast.patt;
1330 value sem_patt_for_list : Gram.Entry.t (Ast.patt -> Ast.patt);
1331 value semi : Gram.Entry.t unit;
1332 value sequence : Gram.Entry.t Ast.expr;
1333 value do_sequence : Gram.Entry.t Ast.expr;
1334 value sig_item : Gram.Entry.t Ast.sig_item;
1335 value sig_item_quot : Gram.Entry.t Ast.sig_item;
1336 value sig_items : Gram.Entry.t Ast.sig_item;
1337 value star_ctyp : Gram.Entry.t Ast.ctyp;
1338 value str_item : Gram.Entry.t Ast.str_item;
1339 value str_item_quot : Gram.Entry.t Ast.str_item;
1340 value str_items : Gram.Entry.t Ast.str_item;
1341 value type_constraint : Gram.Entry.t unit;
1342 value type_declaration : Gram.Entry.t Ast.ctyp;
1343 value type_ident_and_parameters : Gram.Entry.t (string * list Ast.ctyp);
1344 value type_kind : Gram.Entry.t Ast.ctyp;
1345 value type_longident : Gram.Entry.t Ast.ident;
1346 value type_longident_and_parameters : Gram.Entry.t Ast.ctyp;
1347 value type_parameter : Gram.Entry.t Ast.ctyp;
1348 value type_parameters : Gram.Entry.t (Ast.ctyp -> Ast.ctyp);
1349 value typevars : Gram.Entry.t Ast.ctyp;
1350 value val_longident : Gram.Entry.t Ast.ident;
1351 value value_let : Gram.Entry.t unit;
1352 value value_val : Gram.Entry.t unit;
1353 value with_constr : Gram.Entry.t Ast.with_constr;
1354 value with_constr_quot : Gram.Entry.t Ast.with_constr;
1355 value prefixop : Gram.Entry.t Ast.expr;
1356 value infixop0 : Gram.Entry.t Ast.expr;
1357 value infixop1 : Gram.Entry.t Ast.expr;
1358 value infixop2 : Gram.Entry.t Ast.expr;
1359 value infixop3 : Gram.Entry.t Ast.expr;
1360 value infixop4 : Gram.Entry.t Ast.expr;
1363 (** A signature for syntax extension (syntax -> syntax functors). *)
1364 module type SyntaxExtension = functor (Syn : Syntax)
1365 -> (Syntax with module Loc = Syn.Loc
1366 and module Ast = Syn.Ast
1367 and module Token = Syn.Token
1368 and module Gram = Syn.Gram
1369 and module Quotation = Syn.Quotation);