Skip to content

Commit

Permalink
[fix] opatop: ignore package directives instead of failing
Browse files Browse the repository at this point in the history
  • Loading branch information
François-Régis Sinot committed Sep 29, 2011
1 parent cd0c3f8 commit 152be35
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
9 changes: 9 additions & 0 deletions opalang/opaToQml.ml
Expand Up @@ -838,6 +838,15 @@ struct
with
(* An error message has been printed by the parseOpa function. *)
| exn -> raise (Exception (Printexc.to_string exn)) in
let opa_code =
List.filter
(function
| (SA.Package _, _) as c ->
(try OManager.error "Ignoring package directive %a@\n" OpaPrint.string_and_pos#code_elt c
with _ -> false)
| _ -> true)
opa_code
in
let _, qml_code =
try NonuidOpaToQml.code ~options opa_code
with exn -> raise (Exception (Printexc.to_string exn)) in
Expand Down
7 changes: 5 additions & 2 deletions opatop/opaTopParser.ml
Expand Up @@ -22,5 +22,8 @@ type contents = string
(* TODO: OpaToQml should use OManager, and this module can be removed *)

let parse ?filename contents =
try OpaToQml.Parser.of_string ?filename contents
with OpaToQml.Parser.Exception s -> OManager.error "OpaToQml: %s@\n" s
try
OpaToQml.Parser.of_string ?filename contents
with
| OpaToQml.Parser.Exception s -> OManager.error "OpaToQml: %s@\n" s
| (Assert_failure _ | _) as e-> OManager.error "OpaToQml: %s@\n" (Printexc.to_string e)

0 comments on commit 152be35

Please sign in to comment.