Preliminary support for the grammar.
[SXSI/xpathcomp.git] / src / grammar.ml
diff --git a/src/grammar.ml b/src/grammar.ml
new file mode 100644 (file)
index 0000000..6537cb2
--- /dev/null
@@ -0,0 +1,13 @@
+type t
+
+external load : Unix.file_descr -> bool -> t = "caml_grammar_load"
+
+let load filename bp =
+  let fd = Unix.openfile filename [ Unix.O_RDONLY ] 0o600 in
+  let g =
+    try load fd bp with
+    | e -> (Unix.close fd; raise e)
+  in
+  Unix.close fd;
+  g
+