From b00bff88c7902e828804c06b7f9dc55222fdc84e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kim=20Nguy=E1=BB=85n?= Date: Thu, 4 Apr 2013 18:48:43 +0200 Subject: [PATCH] Flatten the sources, only leave the XPath module packed. --- _tags | 8 ------ src/{auto => }/ata.ml | 9 +++--- src/{auto => }/ata.mli | 26 ++++++++--------- src/auto.mlpack | 6 ---- src/{utils => }/cache.ml | 0 src/{utils => }/cache.mli | 0 src/{utils => }/common_sig.ml | 0 src/{auto => }/eval.ml | 5 ++-- src/{utils => }/finiteCofinite.ml | 0 src/{utils => }/finiteCofinite.mli | 0 src/{utils => }/finiteCofinite_sig.ml | 0 src/{auto => }/formula.ml | 3 +- src/{auto => }/formula.mli | 8 +++--- src/{utils => }/hcons.ml | 0 src/{utils => }/hcons.mli | 0 src/{utils => }/hcons_sig.ml | 0 src/{utils => }/hlist.ml | 0 src/{utils => }/hlist.mli | 0 src/{utils => }/hlist_sig.ml | 0 src/{auto => }/html.ml | 0 src/{auto => }/html.mli | 0 src/{utils => }/misc.ml | 0 src/{tree/naive.ml => naive_tree.ml} | 25 ++++++++-------- src/{tree/naive.mli => naive_tree.mli} | 4 +-- src/{utils => }/pretty.ml | 0 src/{utils => }/pretty.mli | 0 src/{utils => }/ptset.ml | 0 src/{utils => }/ptset.mli | 0 src/{utils => }/ptset_sig.ml | 0 src/{utils => }/qName.ml | 0 src/{utils => }/qName.mli | 0 src/{utils => }/qNameSet.ml | 0 src/{utils => }/qNameSet.mli | 0 src/{auto => }/state.ml | 3 +- src/{auto => }/state.mli | 0 src/{auto => }/stateSet.ml | 3 +- src/{auto => }/stateSet.mli | 4 +-- src/tatoo.ml | 12 ++++---- src/{tree/sig.ml => tree.ml} | 33 ++++++++++++++++++--- src/tree.mlpack | 3 -- src/tree/common.ml | 40 -------------------------- src/{utils => }/uid.ml | 0 src/{utils => }/uid.mli | 0 src/utils.mlpack | 15 ---------- src/xpath/ast.ml | 7 ++--- src/xpath/ast.mli | 12 ++++---- src/xpath/compile.ml | 12 ++++---- src/xpath/compile.mli | 4 +-- src/xpath/xpath_internal_parser.mly | 30 +++++++++---------- 49 files changed, 108 insertions(+), 164 deletions(-) rename src/{auto => }/ata.ml (98%) rename src/{auto => }/ata.mli (77%) delete mode 100644 src/auto.mlpack rename src/{utils => }/cache.ml (100%) rename src/{utils => }/cache.mli (100%) rename src/{utils => }/common_sig.ml (100%) rename src/{auto => }/eval.ml (97%) rename src/{utils => }/finiteCofinite.ml (100%) rename src/{utils => }/finiteCofinite.mli (100%) rename src/{utils => }/finiteCofinite_sig.ml (100%) rename src/{auto => }/formula.ml (98%) rename src/{auto => }/formula.mli (92%) rename src/{utils => }/hcons.ml (100%) rename src/{utils => }/hcons.mli (100%) rename src/{utils => }/hcons_sig.ml (100%) rename src/{utils => }/hlist.ml (100%) rename src/{utils => }/hlist.mli (100%) rename src/{utils => }/hlist_sig.ml (100%) rename src/{auto => }/html.ml (100%) rename src/{auto => }/html.mli (100%) rename src/{utils => }/misc.ml (100%) rename src/{tree/naive.ml => naive_tree.ml} (94%) rename src/{tree/naive.mli => naive_tree.mli} (92%) rename src/{utils => }/pretty.ml (100%) rename src/{utils => }/pretty.mli (100%) rename src/{utils => }/ptset.ml (100%) rename src/{utils => }/ptset.mli (100%) rename src/{utils => }/ptset_sig.ml (100%) rename src/{utils => }/qName.ml (100%) rename src/{utils => }/qName.mli (100%) rename src/{utils => }/qNameSet.ml (100%) rename src/{utils => }/qNameSet.mli (100%) rename src/{auto => }/state.ml (94%) rename src/{auto => }/state.mli (100%) rename src/{auto => }/stateSet.ml (93%) rename src/{auto => }/stateSet.mli (91%) rename src/{tree/sig.ml => tree.ml} (80%) delete mode 100644 src/tree.mlpack delete mode 100644 src/tree/common.ml rename src/{utils => }/uid.ml (100%) rename src/{utils => }/uid.mli (100%) delete mode 100644 src/utils.mlpack diff --git a/_tags b/_tags index f500328..347e39c 100644 --- a/_tags +++ b/_tags @@ -16,14 +16,6 @@ true: inline(1000), unsafe(true) : for-pack(Xpath) : include -: for-pack(Utils) -: include - -: for-pack(Tree) -: include - -: for-pack(Auto) -: include : include #Enable warning for all but generated files: diff --git a/src/auto/ata.ml b/src/ata.ml similarity index 98% rename from src/auto/ata.ml rename to src/ata.ml index af729da..08a4308 100644 --- a/src/auto/ata.ml +++ b/src/ata.ml @@ -14,12 +14,11 @@ (***********************************************************************) (* - Time-stamp: + Time-stamp: *) INCLUDE "utils.ml" open Format -open Utils type predicate = | First_child | Next_sibling @@ -28,7 +27,7 @@ type predicate = | First_child | Stay | Is_first_child | Is_next_sibling - | Is of (Tree.Common.NodeKind.t) + | Is of (Tree.NodeKind.t) | Has_first_child | Has_next_sibling @@ -63,7 +62,7 @@ struct | Stay -> fprintf ppf "%s(%a)" Pretty.epsilon State.print q | Is_first_child -> fprintf ppf "FC%s?" Pretty.inverse | Is_next_sibling -> fprintf ppf "NS%s?" Pretty.inverse - | Is k -> fprintf ppf "is-%a?" Tree.Common.NodeKind.print k + | Is k -> fprintf ppf "is-%a?" Tree.NodeKind.print k | Has_first_child -> fprintf ppf "FC?" | Has_next_sibling -> fprintf ppf "NS?" @@ -77,7 +76,7 @@ end module SFormula = struct include Formula.Make(Atom) - open Tree.Common.NodeKind + open Tree.NodeKind let mk_atom a b c = atom_ (Atom.make (a,b,c)) let mk_kind k = mk_atom (Is k) true State.dummy let has_first_child = diff --git a/src/auto/ata.mli b/src/ata.mli similarity index 77% rename from src/auto/ata.mli rename to src/ata.mli index 0ca6e55..bb94a7c 100644 --- a/src/auto/ata.mli +++ b/src/ata.mli @@ -14,7 +14,7 @@ (***********************************************************************) (* - Time-stamp: + Time-stamp: *) type predicate = @@ -25,7 +25,7 @@ type predicate = | Stay | Is_first_child | Is_next_sibling - | Is of Tree.Common.NodeKind.t + | Is of Tree.NodeKind.t | Has_first_child | Has_next_sibling @@ -39,7 +39,7 @@ module SFormula : sig include module type of Formula.Make(Atom) val mk_atom : predicate -> bool -> State.t -> t - val mk_kind : Tree.Common.NodeKind.t -> t + val mk_kind : Tree.NodeKind.t -> t val has_first_child : t val has_next_sibling : t val is_first_child : t @@ -57,36 +57,36 @@ module SFormula : end -module Transition : Utils.Hcons.S with - type data = State.t * Utils.QNameSet.t * SFormula.t +module Transition : Hcons.S with + type data = State.t * QNameSet.t * SFormula.t module TransList : sig - include Utils.Hlist.S with type elt = Transition.t + include Hlist.S with type elt = Transition.t val print : Format.formatter -> ?sep:string -> t -> unit end type t = private { - id : Utils.Uid.t; + id : Uid.t; mutable states : StateSet.t; mutable selection_states: StateSet.t; - transitions: (State.t, (Utils.QNameSet.t*SFormula.t) list) Hashtbl.t; - mutable cache2 : TransList.t Utils.Cache.N2.t; - mutable cache6 : (TransList.t*StateSet.t) Utils.Cache.N6.t; + transitions: (State.t, (QNameSet.t*SFormula.t) list) Hashtbl.t; + mutable cache2 : TransList.t Cache.N2.t; + mutable cache6 : (TransList.t*StateSet.t) Cache.N6.t; } val create : StateSet.t -> StateSet.t -> t val reset : t -> unit -val get_trans : t -> Utils.QNameSet.elt -> StateSet.t -> TransList.t +val get_trans : t -> QNameSet.elt -> StateSet.t -> TransList.t val eval_trans : t -> TransList.t -> StateSet.t -> StateSet.t -> StateSet.t -> StateSet.t - -> bool -> bool -> bool -> bool -> Tree.Common.NodeKind.t + -> bool -> bool -> bool -> bool -> Tree.NodeKind.t -> TransList.t*StateSet.t -val add_trans : t -> State.t -> Utils.QNameSet.t -> SFormula.t -> unit +val add_trans : t -> State.t -> QNameSet.t -> SFormula.t -> unit val print : Format.formatter -> t -> unit val complete_transitions : t -> unit val cleanup_states : t -> unit diff --git a/src/auto.mlpack b/src/auto.mlpack deleted file mode 100644 index 3ec7d78..0000000 --- a/src/auto.mlpack +++ /dev/null @@ -1,6 +0,0 @@ -auto/Ata -auto/Formula -auto/Eval -auto/State -auto/StateSet -auto/Html diff --git a/src/utils/cache.ml b/src/cache.ml similarity index 100% rename from src/utils/cache.ml rename to src/cache.ml diff --git a/src/utils/cache.mli b/src/cache.mli similarity index 100% rename from src/utils/cache.mli rename to src/cache.mli diff --git a/src/utils/common_sig.ml b/src/common_sig.ml similarity index 100% rename from src/utils/common_sig.ml rename to src/common_sig.ml diff --git a/src/auto/eval.ml b/src/eval.ml similarity index 97% rename from src/auto/eval.ml rename to src/eval.ml index 4a27fa5..206debe 100644 --- a/src/auto/eval.ml +++ b/src/eval.ml @@ -14,14 +14,13 @@ (***********************************************************************) (* - Time-stamp: + Time-stamp: *) INCLUDE "utils.ml" open Format -open Utils -module Make (T : Tree.Sig.S) : +module Make (T : Tree.S) : sig val eval : Ata.t -> T.t -> T.node -> T.node list end diff --git a/src/utils/finiteCofinite.ml b/src/finiteCofinite.ml similarity index 100% rename from src/utils/finiteCofinite.ml rename to src/finiteCofinite.ml diff --git a/src/utils/finiteCofinite.mli b/src/finiteCofinite.mli similarity index 100% rename from src/utils/finiteCofinite.mli rename to src/finiteCofinite.mli diff --git a/src/utils/finiteCofinite_sig.ml b/src/finiteCofinite_sig.ml similarity index 100% rename from src/utils/finiteCofinite_sig.ml rename to src/finiteCofinite_sig.ml diff --git a/src/auto/formula.ml b/src/formula.ml similarity index 98% rename from src/auto/formula.ml rename to src/formula.ml index 097114e..7d37e5b 100644 --- a/src/auto/formula.ml +++ b/src/formula.ml @@ -14,13 +14,12 @@ (***********************************************************************) (* - Time-stamp: + Time-stamp: *) INCLUDE "utils.ml" open Format -open Utils (* diff --git a/src/auto/formula.mli b/src/formula.mli similarity index 92% rename from src/auto/formula.mli rename to src/formula.mli index d708c2d..52e38b7 100644 --- a/src/auto/formula.mli +++ b/src/formula.mli @@ -14,15 +14,15 @@ (***********************************************************************) (* - Time-stamp: + Time-stamp: *) module type ATOM = sig type t val neg : t -> t - include Utils.Hcons.Abstract with type t := t - include Utils.Common_sig.Printable with type t := t + include Hcons.Abstract with type t := t + include Common_sig.Printable with type t := t end type ('formula,'atom) expr = @@ -44,7 +44,7 @@ sig val hash : t -> int (** Hash function for formulae *) - val uid : t -> Utils.Uid.t + val uid : t -> Uid.t (** Returns a unique ID for formulae *) val equal : t -> t -> bool diff --git a/src/utils/hcons.ml b/src/hcons.ml similarity index 100% rename from src/utils/hcons.ml rename to src/hcons.ml diff --git a/src/utils/hcons.mli b/src/hcons.mli similarity index 100% rename from src/utils/hcons.mli rename to src/hcons.mli diff --git a/src/utils/hcons_sig.ml b/src/hcons_sig.ml similarity index 100% rename from src/utils/hcons_sig.ml rename to src/hcons_sig.ml diff --git a/src/utils/hlist.ml b/src/hlist.ml similarity index 100% rename from src/utils/hlist.ml rename to src/hlist.ml diff --git a/src/utils/hlist.mli b/src/hlist.mli similarity index 100% rename from src/utils/hlist.mli rename to src/hlist.mli diff --git a/src/utils/hlist_sig.ml b/src/hlist_sig.ml similarity index 100% rename from src/utils/hlist_sig.ml rename to src/hlist_sig.ml diff --git a/src/auto/html.ml b/src/html.ml similarity index 100% rename from src/auto/html.ml rename to src/html.ml diff --git a/src/auto/html.mli b/src/html.mli similarity index 100% rename from src/auto/html.mli rename to src/html.mli diff --git a/src/utils/misc.ml b/src/misc.ml similarity index 100% rename from src/utils/misc.ml rename to src/misc.ml diff --git a/src/tree/naive.ml b/src/naive_tree.ml similarity index 94% rename from src/tree/naive.ml rename to src/naive_tree.ml index fa14d93..b7c0be6 100644 --- a/src/tree/naive.ml +++ b/src/naive_tree.ml @@ -14,14 +14,13 @@ (***********************************************************************) (* - Time-stamp: + Time-stamp: *) -open Utils type node = { tag : QName.t; preorder : int; - mutable kind : Common.NodeKind.t; + mutable kind : Tree.NodeKind.t; mutable data : string; mutable first_child : node; mutable next_sibling : node; @@ -32,7 +31,7 @@ type node = { let rec nil = { tag = QName.nil; - kind = Common.NodeKind.Element; + kind = Tree.NodeKind.Element; preorder = -1; data = ""; first_child = nil; @@ -43,7 +42,7 @@ let rec nil = { let dummy_tag = QName.of_string "#dummy" let rec dummy = { tag = dummy_tag; - kind = Common.NodeKind.Element; + kind = Tree.NodeKind.Element; preorder = -1; data = ""; first_child = dummy; @@ -117,7 +116,7 @@ struct do_text parser_ ctx; let parent = top ctx in let n = { tag = QName.of_string tag; - kind = Common.NodeKind.Element; + kind = Tree.NodeKind.Element; preorder = next ctx; data = ""; first_child = dummy; @@ -135,7 +134,7 @@ struct start_element_handler parser_ ctx att_tag []; let n = top ctx in n.data <- value; - n.kind <- Common.NodeKind.Attribute; + n.kind <- Tree.NodeKind.Attribute; end_element_handler parser_ ctx att_tag and consume_closing ctx n = @@ -158,7 +157,7 @@ struct start_element_handler parser_ ctx text_string []; let node = top ctx in node.data <- s; - node.kind <- Common.NodeKind.Text; + node.kind <- Tree.NodeKind.Text; end_element_handler parser_ ctx text_string and comment_handler parser_ ctx s = @@ -166,7 +165,7 @@ struct start_element_handler parser_ ctx comment_string []; let node = top ctx in node.data <- s; - node.kind <- Common.NodeKind.Comment; + node.kind <- Tree.NodeKind.Comment; end_element_handler parser_ ctx comment_string and processing_instruction_handler parser_ ctx tag data = @@ -177,7 +176,7 @@ struct start_element_handler parser_ ctx pi []; let node = top ctx in node.data <- data; - node.kind <- Common.NodeKind.ProcessingInstruction; + node.kind <- Tree.NodeKind.ProcessingInstruction; end_element_handler parser_ ctx pi @@ -198,7 +197,7 @@ struct (processing_instruction_handler psr ctx); push { tag = QName.document; preorder = next ctx; - kind = Common.NodeKind.Document; + kind = Tree.NodeKind.Document; data = ""; first_child = dummy; next_sibling = dummy; @@ -253,7 +252,7 @@ let output_escape_string out s = let rec print_attributes ?(sep=true) out tree_ node = - if (node.kind == Common.NodeKind.Attribute) then + if (node.kind == Tree.NodeKind.Attribute) then let tag = QName.to_string (QName.remove_prefix node.tag) in if sep then output_char out ' '; output_string out tag; @@ -267,7 +266,7 @@ let rec print_attributes ?(sep=true) out tree_ node = let rec print_xml out tree_ node = if node != nil then let () = - let open Common.NodeKind in + let open Tree.NodeKind in match node.kind with | Node -> () | Text -> output_escape_string out node.data diff --git a/src/tree/naive.mli b/src/naive_tree.mli similarity index 92% rename from src/tree/naive.mli rename to src/naive_tree.mli index 5e0a52e..2a11164 100644 --- a/src/tree/naive.mli +++ b/src/naive_tree.mli @@ -14,7 +14,7 @@ (***********************************************************************) (* - Time-stamp: + Time-stamp: *) -include Sig.S +include Tree.S diff --git a/src/utils/pretty.ml b/src/pretty.ml similarity index 100% rename from src/utils/pretty.ml rename to src/pretty.ml diff --git a/src/utils/pretty.mli b/src/pretty.mli similarity index 100% rename from src/utils/pretty.mli rename to src/pretty.mli diff --git a/src/utils/ptset.ml b/src/ptset.ml similarity index 100% rename from src/utils/ptset.ml rename to src/ptset.ml diff --git a/src/utils/ptset.mli b/src/ptset.mli similarity index 100% rename from src/utils/ptset.mli rename to src/ptset.mli diff --git a/src/utils/ptset_sig.ml b/src/ptset_sig.ml similarity index 100% rename from src/utils/ptset_sig.ml rename to src/ptset_sig.ml diff --git a/src/utils/qName.ml b/src/qName.ml similarity index 100% rename from src/utils/qName.ml rename to src/qName.ml diff --git a/src/utils/qName.mli b/src/qName.mli similarity index 100% rename from src/utils/qName.mli rename to src/qName.mli diff --git a/src/utils/qNameSet.ml b/src/qNameSet.ml similarity index 100% rename from src/utils/qNameSet.ml rename to src/qNameSet.ml diff --git a/src/utils/qNameSet.mli b/src/qNameSet.mli similarity index 100% rename from src/utils/qNameSet.mli rename to src/qNameSet.mli diff --git a/src/auto/state.ml b/src/state.ml similarity index 94% rename from src/auto/state.ml rename to src/state.ml index 83ad4b4..bb7a063 100644 --- a/src/auto/state.ml +++ b/src/state.ml @@ -14,11 +14,10 @@ (***********************************************************************) (* - Time-stamp: + Time-stamp: *) open Format -open Utils type t = int let make = diff --git a/src/auto/state.mli b/src/state.mli similarity index 100% rename from src/auto/state.mli rename to src/state.mli diff --git a/src/auto/stateSet.ml b/src/stateSet.ml similarity index 93% rename from src/auto/stateSet.ml rename to src/stateSet.ml index e99cd5e..2fec234 100644 --- a/src/auto/stateSet.ml +++ b/src/stateSet.ml @@ -14,11 +14,10 @@ (***********************************************************************) (* - Time-stamp: + Time-stamp: *) open Format -open Utils include Ptset.Make (Hcons.PosInt) diff --git a/src/auto/stateSet.mli b/src/stateSet.mli similarity index 91% rename from src/auto/stateSet.mli rename to src/stateSet.mli index 96b5b6d..1a9c237 100644 --- a/src/auto/stateSet.mli +++ b/src/stateSet.mli @@ -14,11 +14,11 @@ (***********************************************************************) (* - Time-stamp: + Time-stamp: *) (** Implementation of sets of states *) -include Utils.Ptset.S with type elt = int +include Ptset.S with type elt = int val print : Format.formatter -> t -> unit (** Pretty printer *) diff --git a/src/tatoo.ml b/src/tatoo.ml index d6a1986..1b8c17d 100644 --- a/src/tatoo.ml +++ b/src/tatoo.ml @@ -14,12 +14,12 @@ (***********************************************************************) (* - Time-stamp: + Time-stamp: *) let doc = let fd = open_in Sys.argv.(1) in - let d = Tree.Naive.load_xml_file fd in + let d = Naive_tree.load_xml_file fd in close_in fd; d @@ -34,16 +34,16 @@ open Format let () = fprintf err_formatter "Query: %a\n%!" Xpath.Ast.print_path query; - fprintf err_formatter "Automata: %a\n%!" Auto.Ata.print auto; + fprintf err_formatter "Automata: %a\n%!" Ata.print auto; fprintf err_formatter "Evaluating automaton:\n%!"; - let module Naive = Auto.Eval.Make(Tree.Naive) in + let module Naive = Eval.Make(Naive_tree) in let t1 = Unix.gettimeofday() in - let results = Naive.eval auto doc (Tree.Naive.root doc) in + let results = Naive.eval auto doc (Naive_tree.root doc) in let teval = (Unix.gettimeofday () -. t1) *. 1000. in let t1 = Unix.gettimeofday () in output_string stdout "\n"; List.iter (fun n -> - Tree.Naive.print_xml stdout doc n; + Naive_tree.print_xml stdout doc n; output_char stdout '\n' ) results; output_string stdout "\n"; diff --git a/src/tree/sig.ml b/src/tree.ml similarity index 80% rename from src/tree/sig.ml rename to src/tree.ml index e2db1d1..9ef78ce 100644 --- a/src/tree/sig.ml +++ b/src/tree.ml @@ -14,10 +14,35 @@ (***********************************************************************) (* - Time-stamp: + Time-stamp: *) -(** Implementation of documents as binary trees *) +(** The different kind of XML nodes and utility functions *) + +module NodeKind = + struct + type t = + Document | Element | Text | Comment | Attribute | ProcessingInstruction | Node + + let to_string = + function + Document -> "document" + | Element -> "element" + | Attribute -> "attribute" + | Text -> "text" + | Comment -> "comment" + | ProcessingInstruction -> "processing-instruction" + | Node -> "node" + + let print ppf k = Format.fprintf ppf "%s" (to_string k) + + + let is_a k1 k2 = + k1 == Node || k2 == Node || k1 == k2 +end + + +(** Signatures for trees *) module type S = sig @@ -69,7 +94,7 @@ sig Returns [nil] if [n == nil]. *) - val tag : t -> node -> Utils.QName.t + val tag : t -> node -> QName.t (** Returns the label of a given node *) val data : t -> node -> string @@ -78,7 +103,7 @@ sig QName.text, QName.cdata_section or QName.comment *) - val kind : t -> node -> Common.NodeKind.t + val kind : t -> node -> NodeKind.t (** Returns the kind of the given node *) val preorder : t -> node -> int diff --git a/src/tree.mlpack b/src/tree.mlpack deleted file mode 100644 index 6dd2e12..0000000 --- a/src/tree.mlpack +++ /dev/null @@ -1,3 +0,0 @@ -tree/Naive -tree/Sig -tree/Common diff --git a/src/tree/common.ml b/src/tree/common.ml deleted file mode 100644 index 099d751..0000000 --- a/src/tree/common.ml +++ /dev/null @@ -1,40 +0,0 @@ -(***********************************************************************) -(* *) -(* TAToo *) -(* *) -(* Kim Nguyen, LRI UMR8623 *) -(* Université Paris-Sud & CNRS *) -(* *) -(* Copyright 2010-2012 Université Paris-Sud and Centre National de la *) -(* Recherche Scientifique. All rights reserved. This file is *) -(* distributed under the terms of the GNU Lesser General Public *) -(* License, with the special exception on linking described in file *) -(* ../LICENSE. *) -(* *) -(***********************************************************************) - -(* - Time-stamp: -*) - -module NodeKind = - struct - type t = - Document | Element | Text | Comment | Attribute | ProcessingInstruction - | Node - - let to_string = - function - Document -> "document" - | Element -> "element" - | Attribute -> "attribute" - | Text -> "text" - | Comment -> "comment" - | ProcessingInstruction -> "processing-instruction" - | Node -> "node" - let print ppf k = Format.fprintf ppf "%s" (to_string k) - - - let is_a k1 k2 = - k1 == Node || k2 == Node || k1 == k2 -end diff --git a/src/utils/uid.ml b/src/uid.ml similarity index 100% rename from src/utils/uid.ml rename to src/uid.ml diff --git a/src/utils/uid.mli b/src/uid.mli similarity index 100% rename from src/utils/uid.mli rename to src/uid.mli diff --git a/src/utils.mlpack b/src/utils.mlpack deleted file mode 100644 index 755f521..0000000 --- a/src/utils.mlpack +++ /dev/null @@ -1,15 +0,0 @@ -utils/Cache -utils/Common_sig -utils/FiniteCofinite -utils/FiniteCofinite_sig -utils/Hcons -utils/Hcons_sig -utils/Hlist -utils/Hlist_sig -utils/Misc -utils/Pretty -utils/Ptset -utils/Ptset_sig -utils/QName -utils/QNameSet -utils/Uid diff --git a/src/xpath/ast.ml b/src/xpath/ast.ml index 64c6c8d..a90a41b 100644 --- a/src/xpath/ast.ml +++ b/src/xpath/ast.ml @@ -14,10 +14,9 @@ (***********************************************************************) (* - Time-stamp: + Time-stamp: *) -open Utils type path = single_path list and single_path = Absolute of step list | Relative of step list @@ -30,7 +29,7 @@ and axis = Self | Attribute | Child | PrecedingSibling | Preceding | Following -and test = QNameSet.t * Tree.Common.NodeKind.t +and test = QNameSet.t * Tree.NodeKind.t and binop = Eq | Neq | Lt | Gt | Lte | Gte | Or | And | Add | Sub | Mult | Div | Mod and unop = Neg @@ -128,7 +127,7 @@ and print_axis fmt a = pp fmt "%s" begin end and print_test fmt (ts,kind) = - let open Tree.Common.NodeKind in + let open Tree.NodeKind in match kind with Text -> pp fmt "%s" "text()" | Element | Attribute -> diff --git a/src/xpath/ast.mli b/src/xpath/ast.mli index 0fc63d4..78dd7bb 100644 --- a/src/xpath/ast.mli +++ b/src/xpath/ast.mli @@ -14,7 +14,7 @@ (***********************************************************************) (* - Time-stamp: + Time-stamp: *) type path = single_path list @@ -28,21 +28,21 @@ and axis = Self | Attribute | Child | PrecedingSibling | Preceding | Following -and test = Utils.QNameSet.t * Tree.Common.NodeKind.t +and test = QNameSet.t * Tree.NodeKind.t and binop = Eq | Neq | Lt | Gt | Lte | Gte | Or | And | Add | Sub | Mult | Div | Mod and unop = Neg and expr = | Number of [ `Int of int | `Float of float ] | String of string - | Fun_call of Utils.QName.t * expr list + | Fun_call of QName.t * expr list | Path of path | Binop of expr * binop * expr | Unop of unop * expr type t = path -val text : Utils.QNameSet.t -val node : Utils.QNameSet.t -val star : Utils.QNameSet.t +val text : QNameSet.t +val node : QNameSet.t +val star : QNameSet.t val print_binop : Format.formatter -> binop -> unit val print_unop : Format.formatter -> unop -> unit val print_path : Format.formatter -> path -> unit diff --git a/src/xpath/compile.ml b/src/xpath/compile.ml index 0038506..e62b918 100644 --- a/src/xpath/compile.ml +++ b/src/xpath/compile.ml @@ -14,12 +14,10 @@ (***********************************************************************) (* - Time-stamp: + Time-stamp: *) open Ast -open Auto -open Utils let ( => ) a b = (a, b) @@ -48,7 +46,7 @@ let root_set = QNameSet.singleton QName.document let compile_axis_test axis (test,kind) phi trans states = let q = State.make () in let phi = match kind with - Tree.Common.NodeKind.Node -> phi + Tree.NodeKind.Node -> phi | _ -> phi %% F.mk_kind kind in let phi', trans', states' = @@ -145,7 +143,7 @@ and compile_single_path p trans states = match p with | Absolute steps -> (Ancestor false, (QNameSet.singleton QName.document, - Tree.Common.NodeKind.Node), []) + Tree.NodeKind.Node), []) :: steps | Relative steps -> steps in @@ -181,7 +179,7 @@ let compile_top_level_step_list l trans states = | (axis, (test,kind), elist) :: ll -> let phi0, trans0, states0 = compile_axis_test (invert_axis axis) - (QNameSet.any, Tree.Common.NodeKind.Node) + (QNameSet.any, Tree.NodeKind.Node) phi_above trans states in (* Only select attribute nodes if the previous axis @@ -219,7 +217,7 @@ let compile_top_level_step_list l trans states = let phi0, trans0, states0 = compile_axis_test Self - (QNameSet.singleton QName.document, Tree.Common.NodeKind.Node) + (QNameSet.singleton QName.document, Tree.NodeKind.Node) Ata.SFormula.true_ trans states diff --git a/src/xpath/compile.mli b/src/xpath/compile.mli index 6f50f11..a326992 100644 --- a/src/xpath/compile.mli +++ b/src/xpath/compile.mli @@ -14,7 +14,7 @@ (***********************************************************************) (* - Time-stamp: + Time-stamp: *) -val path : Ast.path -> Auto.Ata.t +val path : Ast.path -> Ata.t diff --git a/src/xpath/xpath_internal_parser.mly b/src/xpath/xpath_internal_parser.mly index 9830e76..2a861aa 100644 --- a/src/xpath/xpath_internal_parser.mly +++ b/src/xpath/xpath_internal_parser.mly @@ -15,11 +15,11 @@ (***********************************************************************) (* - Time-stamp: + Time-stamp: *) open Ast - open Tree.Common + open Tree %} %token TAG @@ -103,12 +103,12 @@ step: axis_test: AXIS COLONCOLON test { let a, (t,k) = $1, $3 in match a with - Attribute when Utils.QNameSet.is_finite t -> - [ a, ((Utils.QNameSet.fold + Attribute when QNameSet.is_finite t -> + [ a, ((QNameSet.fold (fun t a -> - Utils.QNameSet.add - (Utils.QName.attribute t) a) - t Utils.QNameSet.empty), k) ] + QNameSet.add + (QName.attribute t) a) + t QNameSet.empty), k) ] | Preceding|Following -> [ (Descendant true, (t,k)); if a == Preceding then @@ -124,10 +124,10 @@ axis_test: let _ = Format.flush_str_formatter () in let () = Format.fprintf Format.str_formatter "%a" Ast.print_axis $1 in let a = Format.flush_str_formatter () in - [Child, (Utils.QNameSet.singleton (Utils.QName.of_string a),NodeKind.Element)] + [Child, (QNameSet.singleton (QName.of_string a),NodeKind.Element)] } | ATTNAME { [(Attribute, - (Utils.QNameSet.singleton (Utils.QName.of_string $1), + (QNameSet.singleton (QName.of_string $1), NodeKind.Attribute))] } ; @@ -135,16 +135,16 @@ test: NODE { node, NodeKind.Node } | TEXT { text, NodeKind.Text } | STAR { star, NodeKind.Element } -| COMMENT { Utils.QNameSet.singleton(Utils.QName.comment), +| COMMENT { QNameSet.singleton(QName.comment), NodeKind.Comment } | PI { (if $1 = "" then star - else Utils.QNameSet.singleton( - Utils.QName.processing_instruction ( - Utils.QName.of_string $1) + else QNameSet.singleton( + QName.processing_instruction ( + QName.of_string $1) )), NodeKind.ProcessingInstruction } -| TAG { Utils.QNameSet.singleton(Utils.QName.of_string $1), +| TAG { QNameSet.singleton(QName.of_string $1), NodeKind.Element } ; @@ -176,7 +176,7 @@ expr: | expr LTE expr { Binop($1, Lte, $3) } | expr GT expr { Binop($1, Gt, $3) } | expr GTE expr { Binop($1, Gte, $3) } -| TAG LP arg_list RP { Fun_call(Utils.QName.of_string $1, $3) } +| TAG LP arg_list RP { Fun_call(QName.of_string $1, $3) } | LP expr RP { $2 } | path { Path $1 } ; -- 2.17.1