From 98618cfb6b326b70da29348bc5d212e41086f473 Mon Sep 17 00:00:00 2001 From: Pierre-Marie Pédrot Date: Sat, 15 Aug 2015 19:17:26 +0200 Subject: More parametric type for generalized XML. --- lib/richpp.ml | 2 +- lib/richpp.mli | 6 +++--- lib/xml_datatype.mli | 14 ++++++-------- 3 files changed, 10 insertions(+), 12 deletions(-) (limited to 'lib') diff --git a/lib/richpp.ml b/lib/richpp.ml index 45173ff307..087c247299 100644 --- a/lib/richpp.ml +++ b/lib/richpp.ml @@ -17,7 +17,7 @@ type 'annotation located = { type 'a stack = | Leaf -| Node of string * 'a located gxml list * int * 'a stack +| Node of string * (string, 'a located) gxml list * int * 'a stack type 'a context = { mutable stack : 'a stack; diff --git a/lib/richpp.mli b/lib/richpp.mli index 2c20197893..5eb0e7b3b0 100644 --- a/lib/richpp.mli +++ b/lib/richpp.mli @@ -23,13 +23,13 @@ type 'annotation located = { annotation. If this function returns [None], then no annotation is put. *) val rich_pp : (Pp.Tag.t -> 'annotation option) -> Pp.std_ppcmds -> - 'annotation located Xml_datatype.gxml + (string, 'annotation located) Xml_datatype.gxml (** [annotations_positions ssdoc] returns a list associating each annotations with its position in the string from which [ssdoc] is built. *) val annotations_positions : - 'annotation located Xml_datatype.gxml -> + ('a, 'annotation located) Xml_datatype.gxml -> ('annotation * (int * int)) list (** [xml_of_rich_pp ssdoc] returns an XML representation of the @@ -37,5 +37,5 @@ val annotations_positions : val xml_of_rich_pp : ('annotation -> string) -> ('annotation -> (string * string) list) -> - 'annotation located Xml_datatype.gxml -> + (string, 'annotation located) Xml_datatype.gxml -> Xml_datatype.xml diff --git a/lib/xml_datatype.mli b/lib/xml_datatype.mli index f61ba032a2..f822080a6d 100644 --- a/lib/xml_datatype.mli +++ b/lib/xml_datatype.mli @@ -7,13 +7,11 @@ (************************************************************************) (** ['a gxml] is the type for semi-structured documents. They generalize - XML by allowing any kind of attributes. *) -type 'a gxml = - | Element of (string * 'a * 'a gxml list) + XML by allowing any kind of tags and attributes. *) +type ('a, 'b) gxml = + | Element of ('a * 'b * ('a, 'b) gxml list) | PCData of string -(** [xml] is a semi-structured documents where attributes are association - lists from string to string. *) -type xml = (string * string) list gxml - - +(** [xml] is a semi-structured documents where tags are strings and attributes + are association lists from string to string. *) +type xml = (string, (string * string) list) gxml -- cgit v1.2.3