]> 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 6b0142bf12233a544c2dd2f34b3b18c3b064d366..16c2a2c69f288ea3bab9100c8a95a80e8998afcf 100644 (file)
@@ -40,7 +40,8 @@ let pp_dependency = function
 
 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 =
@@ -48,9 +49,11 @@ let parse_dependencies lexbuf =
       (parser
       | [< '("QSTRING", s) >] ->
           (* because of alias id qstring = qstring :-( *)
-          if String.sub s 0 5 <> "cic:/" then true,acc
-          else
-            true, (UriDep (NUri.uri_of_string s) :: acc)
+          (try
+            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 (NUri.uri_of_string u) :: acc)
       | [< '("IDENT", "include"); '("QSTRING", fname) >] ->