[Pkg-ocaml-maint-commits] r2328 - trunk/projects/ocaml-deblib

Stefano Zacchiroli zack at costa.debian.org
Mon Dec 26 20:08:09 UTC 2005


Author: zack
Date: 2005-12-26 20:08:08 +0000 (Mon, 26 Dec 2005)
New Revision: 2328

Modified:
   trunk/projects/ocaml-deblib/deblib_Utils.ml
   trunk/projects/ocaml-deblib/deblib_Utils.mli
Log:
- changed Deblib_Utils.parse822 so that it parser from Lexing.lexbuf
- added Deblib_Utils.parse822file to mimic old behaviour


Modified: trunk/projects/ocaml-deblib/deblib_Utils.ml
===================================================================
--- trunk/projects/ocaml-deblib/deblib_Utils.ml	2005-12-26 15:14:40 UTC (rev 2327)
+++ trunk/projects/ocaml-deblib/deblib_Utils.ml	2005-12-26 20:08:08 UTC (rev 2328)
@@ -17,15 +17,21 @@
   ]
 
 
-let parse822 file = 
+let parse822 lexbuf = Deblib_822Parser.main Deblib_822Lexer.next lexbuf
+
+let parse822file file = 
   let ic = open_in file in
   let lexbuf = Lexing.from_channel ic in
-    try Deblib_822Parser.main Deblib_822Lexer.next lexbuf
+  let res =
+    try parse822 lexbuf
     with Parsing.Parse_error ->
+      close_in ic;
       let msg = sprintf "Parse error while parsing: %s" file in
 	raise (Failure msg)
+  in
+  close_in ic;
+  res
 
-
 let pkg_re = Str.regexp "[ \t]*\\([a-z0-9+-.]+\\) *\\(\\[.*\\]\\)? *\\((\\(.*\\))\\)? *\\(\\[.*\\]\\)?";;
 let vers_re = Str.regexp " *\\(\\(<[<=]?\\)\\|\\(>[>=]?\\)\\|\\(=\\)\\)? *\\([^ ]*\\) *";;
 

Modified: trunk/projects/ocaml-deblib/deblib_Utils.mli
===================================================================
--- trunk/projects/ocaml-deblib/deblib_Utils.mli	2005-12-26 15:14:40 UTC (rev 2327)
+++ trunk/projects/ocaml-deblib/deblib_Utils.mli	2005-12-26 20:08:08 UTC (rev 2328)
@@ -1,7 +1,8 @@
 
 val release_archs : string list
 
-val parse822 : string -> (string, string) Hashtbl.t list
+val parse822file : string -> (string, string) Hashtbl.t list
+val parse822 : Lexing.lexbuf -> (string, string) Hashtbl.t list
 
 val bin_pkg_of_stanza :
   (string, string) Hashtbl.t -> Deblib_Types.binary_package




More information about the Pkg-ocaml-maint-commits mailing list