2001-09-07 01:00:42 -07:00
|
|
|
(* camlp4r *)
|
|
|
|
(***********************************************************************)
|
|
|
|
(* *)
|
|
|
|
(* Camlp4 *)
|
|
|
|
(* *)
|
|
|
|
(* Daniel de Rauglaudre, projet Cristal, INRIA Rocquencourt *)
|
|
|
|
(* *)
|
2002-02-16 10:44:22 -08:00
|
|
|
(* Copyright 2002 Institut National de Recherche en Informatique et *)
|
2001-09-07 01:00:42 -07:00
|
|
|
(* Automatique. Distributed only by permission. *)
|
|
|
|
(* *)
|
|
|
|
(***********************************************************************)
|
|
|
|
|
|
|
|
(* $Id$ *)
|
|
|
|
|
2002-02-16 10:44:22 -08:00
|
|
|
type grammar 'te =
|
2001-09-07 01:00:42 -07:00
|
|
|
{ gtokens : Hashtbl.t Token.pattern (ref int);
|
2002-02-16 10:44:22 -08:00
|
|
|
glexer : mutable Token.glexer 'te }
|
2001-09-07 01:00:42 -07:00
|
|
|
;
|
|
|
|
|
2002-02-16 10:44:22 -08:00
|
|
|
type g_entry 'te =
|
|
|
|
{ egram : grammar 'te;
|
2001-09-07 01:00:42 -07:00
|
|
|
ename : string;
|
2002-02-16 10:44:22 -08:00
|
|
|
estart : mutable int -> Stream.t 'te -> Obj.t;
|
|
|
|
econtinue : mutable int -> int -> Obj.t -> Stream.t 'te -> Obj.t;
|
|
|
|
edesc : mutable g_desc 'te }
|
|
|
|
and g_desc 'te =
|
|
|
|
[ Dlevels of list (g_level 'te)
|
|
|
|
| Dparser of Stream.t 'te -> Obj.t ]
|
|
|
|
and g_level 'te =
|
2001-09-07 01:00:42 -07:00
|
|
|
{ assoc : g_assoc;
|
|
|
|
lname : option string;
|
2002-02-16 10:44:22 -08:00
|
|
|
lsuffix : g_tree 'te;
|
|
|
|
lprefix : g_tree 'te }
|
2001-09-07 01:00:42 -07:00
|
|
|
and g_assoc =
|
|
|
|
[ NonA
|
|
|
|
| RightA
|
|
|
|
| LeftA ]
|
2002-02-16 10:44:22 -08:00
|
|
|
and g_symbol 'te =
|
2002-07-19 07:53:56 -07:00
|
|
|
[ Smeta of string and list (g_symbol 'te) and Obj.t
|
|
|
|
| Snterm of g_entry 'te
|
2002-02-16 10:44:22 -08:00
|
|
|
| Snterml of g_entry 'te and string
|
|
|
|
| Slist0 of g_symbol 'te
|
|
|
|
| Slist0sep of g_symbol 'te and g_symbol 'te
|
|
|
|
| Slist1 of g_symbol 'te
|
|
|
|
| Slist1sep of g_symbol 'te and g_symbol 'te
|
|
|
|
| Sopt of g_symbol 'te
|
2001-09-07 01:00:42 -07:00
|
|
|
| Sself
|
|
|
|
| Snext
|
|
|
|
| Stoken of Token.pattern
|
2002-02-16 10:44:22 -08:00
|
|
|
| Stree of g_tree 'te ]
|
2001-09-07 01:00:42 -07:00
|
|
|
and g_action = Obj.t
|
2002-02-16 10:44:22 -08:00
|
|
|
and g_tree 'te =
|
|
|
|
[ Node of g_node 'te
|
2001-09-07 01:00:42 -07:00
|
|
|
| LocAct of g_action and list g_action
|
|
|
|
| DeadEnd ]
|
2002-02-16 10:44:22 -08:00
|
|
|
and g_node 'te =
|
|
|
|
{ node : g_symbol 'te; son : g_tree 'te; brother : g_tree 'te }
|
2001-09-07 01:00:42 -07:00
|
|
|
;
|
|
|
|
|
|
|
|
type position =
|
|
|
|
[ First
|
|
|
|
| Last
|
|
|
|
| Before of string
|
|
|
|
| After of string
|
|
|
|
| Level of string ]
|
|
|
|
;
|
|
|
|
|
|
|
|
value levels_of_rules :
|
2002-02-16 10:44:22 -08:00
|
|
|
g_entry 'te -> option position ->
|
|
|
|
list
|
|
|
|
(option string * option g_assoc *
|
|
|
|
list (list (g_symbol 'te) * g_action)) ->
|
|
|
|
list (g_level 'te);
|
|
|
|
value srules : list (list (g_symbol 'te) * g_action) -> g_symbol 'te;
|
2001-09-07 01:00:42 -07:00
|
|
|
external action : 'a -> g_action = "%identity";
|
|
|
|
|
|
|
|
value delete_rule_in_level_list :
|
2002-02-16 10:44:22 -08:00
|
|
|
g_entry 'te -> list (g_symbol 'te) -> list (g_level 'te) ->
|
|
|
|
list (g_level 'te);
|
2001-09-07 01:00:42 -07:00
|
|
|
|
|
|
|
value warning_verbose : ref bool;
|