From: Claudio Sacerdoti Coen Date: Fri, 24 Jun 2005 08:06:59 +0000 (+0000) Subject: Small improvement in extracting suffixes. X-Git-Tag: INDEXING_NO_PROOFS~85 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=e741cbf7dfaea51173635b7c5c47c12e1e515b1b;p=helm.git Small improvement in extracting suffixes. --- diff --git a/helm/ocaml/urimanager/uriManager.ml b/helm/ocaml/urimanager/uriManager.ml index f701125ed..203093c7e 100644 --- a/helm/ocaml/urimanager/uriManager.ml +++ b/helm/ocaml/urimanager/uriManager.ml @@ -93,33 +93,32 @@ let strip_xpointer ((uri,_) as olduri) = with Not_found -> olduri -let clear_suffix uri ?(pat2="") pat1 = +let clear_suffix uri ?(pat2="",0) pat1 = try let index = String.rindex uri '.' in let index' = index + 1 in let suffix = String.sub uri index' (String.length uri - index') in - if pat1 = suffix || pat2 = suffix then + if fst pat1 = suffix || fst pat2 = suffix then String.sub uri 0 index else uri with Not_found -> assert false -let has_suffix uri pat = +let has_suffix uri (pat,n) = try - let index = String.rindex uri '.' + 1 in - let suffix = String.sub uri index (String.length uri - index) in + let suffix = String.sub uri (String.length uri - n) n in pat = suffix with Not_found -> assert false -let _types = "types" let _dottypes = ".types" -let _ann = "ann" +let _types = "types",5 +let _ann = "ann",3 let _dotann = ".ann" -let _var = "var" +let _var = "var",3 let _dotbody = ".body" -let _con = "con" +let _con = "con",3 let _xpointer = "#xpointer(1/" let cicuri_of_uri (uri, _) = uri_of_string (clear_suffix uri ~pat2:_types _ann)