Skip to content

Commit

Permalink
Propagate attributes from Pack Statements
Browse files Browse the repository at this point in the history
  • Loading branch information
Gbury committed Jun 23, 2023
1 parent efafeec commit 95f6df0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/loop/parser.ml
Original file line number Diff line number Diff line change
Expand Up @@ -376,9 +376,13 @@ module Make(State : State.S) = struct

let expand st c =
let ret = match c with
| { S.descr = S.Pack l; _ } ->
| { S.descr = S.Pack l; attrs; _ } ->
let file = State.get State.logic_file st in
st, `Gen (merge, wrap_parser ~file (Gen.of_list l))
let g =
Gen.of_list l
|> Gen.map (S.add_attrs attrs)
in
st, `Gen (merge, wrap_parser ~file g)
(* TODO: filter the statements by passing some options *)
| { S.descr = S.Include file; _ } ->
let logic_file = State.get State.logic_file st in
Expand Down
3 changes: 3 additions & 0 deletions src/standard/statement.ml
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,9 @@ let annot = Term.apply
let mk ?id ?(loc=Loc.no_loc) ?(attrs=[]) descr =
{ id; descr; loc; attrs; }

let add_attrs attrs t =
{ t with attrs = attrs @ t.attrs; }

(* Pack *)
let pack ?id ?loc ?attrs l =
mk ?id ?loc ?attrs (Pack l)
Expand Down
3 changes: 3 additions & 0 deletions src/standard/statement.mli
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ include Dolmen_intf.Stmt.Logic

(** {2 Additional functions} *)

val add_attrs : term list -> t -> t
(** Add some attributes to a statement. *)

val mk_decls :
?loc:location -> ?attrs:term list -> recursive:bool -> decl list -> t
(** Create a group of declarations *)
Expand Down

0 comments on commit 95f6df0

Please sign in to comment.