Skip to content
Browse files

[fix] opatop: ignore package directives instead of failing

  • Loading branch information...
1 parent cd0c3f8 commit 152be357756f2aa64500a3f6566f36acffecc6c4 François-Régis Sinot committed
Showing with 14 additions and 2 deletions.
  1. +9 −0 opalang/opaToQml.ml
  2. +5 −2 opatop/opaTopParser.ml
View
9 opalang/opaToQml.ml
@@ -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
View
7 opatop/opaTopParser.ml
@@ -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.
Something went wrong with that request. Please try again.