Refactor the run module, moving out of the Make functor everything that can be moved...
[tatoo.git] / src / qNameSet.ml
1 (***********************************************************************)
2 (*                                                                     *)
3 (*                               TAToo                                 *)
4 (*                                                                     *)
5 (*                     Kim Nguyen, LRI UMR8623                         *)
6 (*                   Université Paris-Sud & CNRS                       *)
7 (*                                                                     *)
8 (*  Copyright 2010-2012 Université Paris-Sud and Centre National de la *)
9 (*  Recherche Scientifique. All rights reserved.  This file is         *)
10 (*  distributed under the terms of the GNU Lesser General Public       *)
11 (*  License, with the special exception on linking described in file   *)
12 (*  ../LICENSE.                                                        *)
13 (*                                                                     *)
14 (***********************************************************************)
15
16 include FiniteCofinite.Make(Ptset.Make(QName))
17
18 let print_finite fmt e conv =
19   Format.fprintf fmt "{";
20   Pretty.print_list ~sep:"," QName.print fmt (conv e);
21   Format.fprintf fmt "}"
22
23 let printer fmt e test conv inv is_any =
24   if test e then print_finite fmt e conv
25   else
26     let () = Format.fprintf fmt "%s" Pretty.big_sigma in
27     if not (is_any e) then begin
28       Format.fprintf fmt "-";
29       print_finite fmt (inv e) conv
30     end
31
32 let print fmt e = printer fmt e is_finite elements complement is_any
33
34 let specials = [ QName.document; QName.text; QName.text ]
35 let notstar = from_list specials
36 let star = diff any notstar
37 let node = any
38 let text = singleton QName.text
39
40 module Weak =
41 struct
42   include FiniteCofinite.Weak(Ptset.Weak(QName))
43   let print fmt e =  printer fmt e is_finite elements complement is_any
44   let notstar = from_list specials
45   let star = diff any notstar
46   let node = any
47   let text = singleton QName.text
48 end