(* $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 *)
type dependency =
| IncludeDep of string
- | BaseuriDep of string
| UriDep of UriManager.uri
let pp_dependency = function
| IncludeDep str -> "include \"" ^ str ^ "\""
- | BaseuriDep str -> "set \"baseuri\" \"" ^ str ^ "\""
| UriDep uri -> "uri \"" ^ UriManager.string_of_uri uri ^ "\""
let parse_dependencies lexbuf =
parse (UriDep (UriManager.uri_of_string u) :: acc)
| [< '("IDENT", "include"); '("QSTRING", fname) >] ->
parse (IncludeDep fname :: acc)
- | [< '("IDENT", "set"); '("QSTRING", "baseuri"); '("QSTRING", baseuri) >] ->
- parse (BaseuriDep baseuri :: acc)
| [< '("EOI", _) >] -> acc
| [< 'tok >] -> parse acc
| [< >] -> acc) tok_stream
in
List.rev (parse [])
+let deps_of_file ma_file =
+ try
+ let ic = open_in ma_file in
+ let istream = Ulexing.from_utf8_channel ic in
+ let dependencies = parse_dependencies istream in
+ close_in ic;
+ dependencies
+ with End_of_file -> []
+;;