| 1 |
(* |
| 2 |
RE - A regular expression library |
| 3 |
|
| 4 |
Copyright (C) 2001 Jerome Vouillon |
| 5 |
email: [email protected] |
| 6 |
|
| 7 |
This library is free software; you can redistribute it and/or |
| 8 |
modify it under the terms of the GNU Lesser General Public |
| 9 |
License as published by the Free Software Foundation, with |
| 10 |
linking exception; either version 2.1 of the License, or (at |
| 11 |
your option) any later version. |
| 12 |
|
| 13 |
This library is distributed in the hope that it will be useful, |
| 14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 |
Lesser General Public License for more details. |
| 17 |
|
| 18 |
You should have received a copy of the GNU Lesser General Public |
| 19 |
License along with this library; if not, write to the Free Software |
| 20 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 21 |
*) |
| 22 |
|
| 23 |
(* Regular expressions *) |
| 24 |
|
| 25 |
module Mark : sig |
| 26 |
type t [@@immediate] |
| 27 |
|
| 28 |
val compare : t -> t -> int |
| 29 |
val start : t |
| 30 |
val prev : t -> t |
| 31 |
val next : t -> t |
| 32 |
val next2 : t -> t |
| 33 |
val group_count : t -> int |
| 34 |
end |
| 35 |
|
| 36 |
module Sem : sig |
| 37 |
type t = |
| 38 |
[ `Longest |
| 39 |
| `Shortest |
| 40 |
| `First |
| 41 |
] |
| 42 |
|
| 43 |
val pp : t Fmt.t |
| 44 |
end |
| 45 |
|
| 46 |
module Rep_kind : sig |
| 47 |
type t = |
| 48 |
[ `Greedy |
| 49 |
| `Non_greedy |
| 50 |
] |
| 51 |
|
| 52 |
val pp : t Fmt.t |
| 53 |
end |
| 54 |
|
| 55 |
type expr |
| 56 |
|
| 57 |
val is_eps : expr -> bool |
| 58 |
val pp : expr Fmt.t |
| 59 |
|
| 60 |
module Ids : sig |
| 61 |
type t |
| 62 |
|
| 63 |
val create : unit -> t |
| 64 |
end |
| 65 |
|
| 66 |
val cst : Ids.t -> Cset.t -> expr |
| 67 |
val empty : Ids.t -> expr |
| 68 |
val alt : Ids.t -> expr list -> expr |
| 69 |
val seq : Ids.t -> Sem.t -> expr -> expr -> expr |
| 70 |
val eps : Ids.t -> expr |
| 71 |
val rep : Ids.t -> Rep_kind.t -> Sem.t -> expr -> expr |
| 72 |
val mark : Ids.t -> Mark.t -> expr |
| 73 |
val pmark : Ids.t -> Pmark.t -> expr |
| 74 |
val erase : Ids.t -> Mark.t -> Mark.t -> expr |
| 75 |
val before : Ids.t -> Category.t -> expr |
| 76 |
val after : Ids.t -> Category.t -> expr |
| 77 |
val rename : Ids.t -> expr -> expr |
| 78 |
|
| 79 |
(****) |
| 80 |
|
| 81 |
(* States of the automata *) |
| 82 |
|
| 83 |
module Idx : sig |
| 84 |
type t |
| 85 |
|
| 86 |
val to_int : t -> int |
| 87 |
end |
| 88 |
|
| 89 |
module Status : sig |
| 90 |
type t = |
| 91 |
| Failed |
| 92 |
| Match of Mark_infos.t * Pmark.Set.t |
| 93 |
| Running |
| 94 |
end |
| 95 |
|
| 96 |
module State : sig |
| 97 |
type t |
| 98 |
|
| 99 |
val dummy : t |
| 100 |
val create : Category.t -> expr -> t |
| 101 |
val idx : t -> Idx.t |
| 102 |
val status : t -> Status.t |
| 103 |
|
| 104 |
module Table : Hashtbl.S with type key = t |
| 105 |
end |
| 106 |
|
| 107 |
(****) |
| 108 |
|
| 109 |
(* Computation of the states following a given state *) |
| 110 |
|
| 111 |
module Working_area : sig |
| 112 |
type t |
| 113 |
|
| 114 |
val create : unit -> t |
| 115 |
val index_count : t -> int |
| 116 |
end |
| 117 |
|
| 118 |
val delta : Working_area.t -> Category.t -> Cset.c -> State.t -> State.t |