]> matita.cs.unibo.it Git - helm.git/blobdiff - matita/components/grafite_parser/dependenciesParser.ml
big change in parsing, trying to make all functional
[helm.git] / matita / components / grafite_parser / dependenciesParser.ml
index 53fb7ab6d63b8cdf5f845f9fe7c68d0d0e72532c..16c2a2c69f288ea3bab9100c8a95a80e8998afcf 100644 (file)
@@ -30,17 +30,18 @@ exception UnableToInclude of string
   (* statements meaningful for matitadep *)
 type dependency =
   | IncludeDep of string
-  | UriDep of UriManager.uri
+  | UriDep of NUri.uri
   | InlineDep of string
 
 let pp_dependency = function
   | IncludeDep str -> "include \"" ^ str ^ "\""
-  | UriDep uri -> "uri \"" ^ UriManager.string_of_uri uri ^ "\""
+  | UriDep uri -> "uri \"" ^ NUri.string_of_uri uri ^ "\""
   | InlineDep str -> "inline \"" ^ str ^ "\"" 
 
 let parse_dependencies lexbuf = 
   let tok_stream,_ =
-    (CicNotationLexer.level2_ast_lexer ()).Token.tok_func (Obj.magic lexbuf)
+    let lexers = (CicNotationLexer.mk_lexers []) in
+    lexers.CicNotationLexer.level2_ast_lexer.Token.tok_func (Obj.magic lexbuf)
   in
   let rec parse acc = 
    let continue, acc =
@@ -49,11 +50,12 @@ let parse_dependencies lexbuf =
       | [< '("QSTRING", s) >] ->
           (* because of alias id qstring = qstring :-( *)
           (try
-            true, (UriDep (UriManager.uri_of_string s) :: acc)
-           with
-            UriManager.IllFormedUri _ -> true, acc)
+            if String.sub s 0 5 <> "cic:/" then true,acc
+            else
+              true, (UriDep (NUri.uri_of_string s) :: acc)
+           with Invalid_argument _ -> true,acc)
       | [< '("URI", u) >] ->
-          true, (UriDep (UriManager.uri_of_string u) :: acc)
+          true, (UriDep (NUri.uri_of_string u) :: acc)
       | [< '("IDENT", "include"); '("QSTRING", fname) >] ->
           true, (IncludeDep fname :: acc)
       | [< '("IDENT", "include"); '("IDENT", "source"); '("QSTRING", fname) >] ->