1 (**************************************************************************)
2 (* *)
3 (* OCaml *)
4 (* *)
5 (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)
6 (* *)
7 (* Copyright 1996 Institut National de Recherche en Informatique et *)
8 (* en Automatique. *)
9 (* *)
10 (* All rights reserved. This file is distributed under the terms of *)
11 (* the GNU Lesser General Public License version 2.1, with the *)
12 (* special exception on linking described in the file LICENSE. *)
13 (* *)
14 (**************************************************************************)
15
16 (* The shallow abstract syntax *)
17
18 type location = {
19 loc_file : string;
20 start_pos : int;
21 end_pos : int;
22 start_line : int;
23 start_col : int;
24 }
25
26 type regular_expression =
27 Epsilon
28 | Characters of Cset.t
29 | Eof
30 | Sequence of regular_expression * regular_expression
31 | Alternative of regular_expression * regular_expression
32 | Repetition of regular_expression
33 | Bind of regular_expression * (string * location)
34
35 type ('arg,'action) entry =
36 {name:string ;
37 shortest : bool ;
38 args : 'arg ;
39 clauses : (regular_expression * 'action) list}
40
41 type lexer_definition = {
42 header: location;
43 entrypoints: ((string list, location) entry) list;
44 trailer: location;
45 refill_handler : location option;
46 }
47