X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=components%2Fgrafite_parser%2FdependenciesParser.ml;h=eb33e49b80d7b5f453dbadb433851f7de3e96556;hb=aa791b78493b604792383cf6326877d0d53e0458;hp=dee9511182333c36d1ff7412f3c6498103e1b475;hpb=918b39ec5f3477499230c7370d4798f20a65cd8d;p=helm.git diff --git a/components/grafite_parser/dependenciesParser.ml b/components/grafite_parser/dependenciesParser.ml index dee951118..eb33e49b8 100644 --- a/components/grafite_parser/dependenciesParser.ml +++ b/components/grafite_parser/dependenciesParser.ml @@ -25,6 +25,17 @@ (* $Id$ *) +(* FG + * From Cambridge dictionary + * Dependency: + * a country which is supported and governed by another country + * Dependence: + * when you need something or someone all the time, especially in order to + * continue existing or operating + * + * Fate vobis ... + *) + exception UnableToInclude of string (* statements meaningful for matitadep *) @@ -43,7 +54,14 @@ let parse_dependencies lexbuf = CicNotationLexer.level2_ast_lexer.Token.tok_func (Obj.magic lexbuf) in let rec parse acc = + try (parser + | [< '("QSTRING", s) >] -> + (* because of alias id qstring = qstring :-( *) + (try + parse (UriDep (UriManager.uri_of_string s) :: acc) + with + UriManager.IllFormedUri _ -> parse acc) | [< '("URI", u) >] -> parse (UriDep (UriManager.uri_of_string u) :: acc) | [< '("IDENT", "include"); '("QSTRING", fname) >] -> @@ -53,6 +71,9 @@ let parse_dependencies lexbuf = | [< '("EOI", _) >] -> acc | [< 'tok >] -> parse acc | [< >] -> acc) tok_stream + with + Stream.Error _ -> parse acc + | CicNotationLexer.Error _ -> parse acc in List.rev (parse []) @@ -62,7 +83,9 @@ let make_absolute paths path = | p :: tl -> let path = p ^ "/" ^ path in try - ignore (Unix.stat path); path + ignore (Unix.stat path); + HLog.debug ("Including "^path^" with path: " ^ p); + path with Unix.Unix_error _ -> aux tl in try @@ -83,10 +106,4 @@ let baseuri_of_script ~include_paths file = let uri = Http_getter_misc.strip_trailing_slash buri in if String.length uri < 5 || String.sub uri 0 5 <> "cic:/" then HLog.error (file ^ " sets an incorrect baseuri: " ^ buri); - (try - ignore(Http_getter.resolve ~writable:false uri) - with - | Http_getter_types.Unresolvable_URI _ -> - HLog.error (file ^ " sets an unresolvable baseuri: " ^ buri) - | Http_getter_types.Key_not_found _ -> ()); - uri + uri,file