@@ -668,6 +668,9 @@ end = struct (* {{{ *)
668668 | Replace s :: rest ->
669669 if r.insertion <> None then duplicate_err " insertion" ;
670670 aux_attrs { r with insertion = Some (Replace s) } rest
671+ | Remove s :: rest ->
672+ if r.insertion <> None then duplicate_err " insertion" ;
673+ aux_attrs { r with insertion = Some (Remove s) } rest
671674 | If s :: rest ->
672675 if r.ifexpr <> None then duplicate_err " if" ;
673676 aux_attrs { r with ifexpr = Some s } rest
@@ -693,7 +696,7 @@ end = struct (* {{{ *)
693696 | If s :: rest ->
694697 if r.cifexpr <> None then duplicate_err " if" ;
695698 aux_chr { r with cifexpr = Some s } rest
696- | (Before _ | After _ | Replace _ | External | Index _ ) as a :: _ -> illegal_err a
699+ | (Before _ | After _ | Replace _ | Remove _ | External | Index _ ) as a :: _ -> illegal_err a
697700 in
698701 let cid = Loc. show loc in
699702 { c with Chr. attributes = aux_chr { cid; cifexpr = None } attributes }
@@ -724,7 +727,7 @@ end = struct (* {{{ *)
724727 | Some (Structured. Index _ ) -> duplicate_err " index"
725728 | Some _ -> error ~loc " external predicates cannot be indexed"
726729 end
727- | (Before _ | After _ | Replace _ | Name _ | If _ ) as a :: _ -> illegal_err a
730+ | (Before _ | After _ | Replace _ | Remove _ | Name _ | If _ ) as a :: _ -> illegal_err a
728731 in
729732 let attributes = aux_tatt None attributes in
730733 let attributes =
@@ -2080,7 +2083,7 @@ module Assemble : sig
20802083end = struct (* {{{ *)
20812084
20822085let compile_clause_attributes ({ Ast.Clause. attributes = { Ast.Structured. id } } as c ) =
2083- { c with Ast.Clause. attributes = { Assembled. id }}
2086+ { c with attributes = { Assembled. id }}
20842087
20852088 let sort_insertion ~old_rev ~extra :l =
20862089 let add s { Ast.Clause. attributes = { Assembled. id } ; loc } =
@@ -2096,18 +2099,19 @@ let compile_clause_attributes ({ Ast.Clause.attributes = { Ast.Structured.id }}
20962099 match l, loc_name with
20972100 | [] ,_ -> error ~loc: c.Ast.Clause. loc (" unable to graft this clause: no clause named " ^
20982101 match loc_name with
2099- | Ast.Structured. Replace x -> x
2100- | Ast.Structured. After x -> x
2101- | Ast.Structured. Before x -> x)
2102- | { Ast.Clause. attributes = { Assembled. id = Some n }} :: xs,
2103- Ast.Structured. Replace name when n = name ->
2104- c :: xs
2105- | { Ast.Clause. attributes = { Assembled. id = Some n }} as x :: xs,
2102+ | Replace x | After x | Before x | Remove x -> x)
2103+ | { Ast.Clause. attributes = { Assembled. id = Some n }} as x :: xs, (* AFTER *)
21062104 Ast.Structured. After name when n = name ->
21072105 c :: x :: xs
2108- | { Ast.Clause. attributes = { Assembled. id = Some n }} as x :: xs,
2109- Ast.Structured. Before name when n = name ->
2106+ | { attributes = { Assembled. id = Some n }} as x :: xs, (* BEFORE *)
2107+ Before name when n = name ->
21102108 x :: c :: xs
2109+ | { attributes = { id = Some n }} :: xs, (* REPLACE *)
2110+ Replace name when n = name ->
2111+ c :: xs
2112+ | { attributes = { id = Some n }} :: xs, (* REMOVE *)
2113+ Remove name when n = name ->
2114+ c :: xs
21112115 | x :: xs , _ -> x :: insert loc_name c xs in
21122116 let rec aux_sort seen acc = function
21132117 | [] -> acc
@@ -2264,7 +2268,7 @@ let rec constants_of acc = function
22642268let w_symbol_table s f x =
22652269 let table = Symbols. compile_table @@ State. get Symbols. table s in
22662270 let pp_ctx = { table; uv_names = ref (IntMap. empty,0 ) } in
2267- Util. set_spaghetti_printer Util. pp_const (R.Pp. pp_constant ~pp_ctx );
2271+ Util. set_spaghetti_printer pp_const (R.Pp. pp_constant ~pp_ctx );
22682272 f x
22692273
22702274(* Compiler passes *)
0 commit comments