Added support for removal from sets.
Syntax: remove e from set s
This commit is contained in:
parent
f6dbd9d601
commit
98590b2e4a
19
AST.ml
19
AST.ml
@ -334,6 +334,15 @@ and single_instr =
|
||||
| RecordPatch of record_patch reg
|
||||
| MapPatch of map_patch reg
|
||||
| MapRemove of map_remove reg
|
||||
| SetRemove of set_remove reg
|
||||
|
||||
and set_remove = {
|
||||
kwd_remove : kwd_remove;
|
||||
element : expr;
|
||||
kwd_from : kwd_from;
|
||||
kwd_set : kwd_set;
|
||||
set : path
|
||||
}
|
||||
|
||||
and map_remove = {
|
||||
kwd_remove : kwd_remove;
|
||||
@ -713,6 +722,7 @@ let instr_to_region = function
|
||||
| Single RecordPatch {region; _}
|
||||
| Single MapPatch {region; _}
|
||||
| Single MapRemove {region; _}
|
||||
| Single SetRemove {region; _}
|
||||
| Block {region; _} -> region
|
||||
|
||||
let pattern_to_region = function
|
||||
@ -1010,6 +1020,7 @@ and print_single_instr = function
|
||||
| RecordPatch {value; _} -> print_record_patch value
|
||||
| MapPatch {value; _} -> print_map_patch value
|
||||
| MapRemove {value; _} -> print_map_remove value
|
||||
| SetRemove {value; _} -> print_set_remove value
|
||||
|
||||
and print_fail {kwd_fail; fail_expr} =
|
||||
print_token kwd_fail "fail";
|
||||
@ -1259,6 +1270,14 @@ and print_map_remove node =
|
||||
print_token kwd_map "map";
|
||||
print_path map
|
||||
|
||||
and print_set_remove node =
|
||||
let {kwd_remove; element; kwd_from; kwd_set; set} = node in
|
||||
print_token kwd_remove "remove";
|
||||
print_expr element;
|
||||
print_token kwd_from "from";
|
||||
print_token kwd_set "set";
|
||||
print_path set
|
||||
|
||||
and print_map_injection {value; _} =
|
||||
let {opening; bindings; terminator; close} = value in
|
||||
print_token opening "map";
|
||||
|
9
AST.mli
9
AST.mli
@ -318,6 +318,15 @@ and single_instr =
|
||||
| RecordPatch of record_patch reg
|
||||
| MapPatch of map_patch reg
|
||||
| MapRemove of map_remove reg
|
||||
| SetRemove of set_remove reg
|
||||
|
||||
and set_remove = {
|
||||
kwd_remove : kwd_remove;
|
||||
element : expr;
|
||||
kwd_from : kwd_from;
|
||||
kwd_set : kwd_set;
|
||||
set : path
|
||||
}
|
||||
|
||||
and map_remove = {
|
||||
kwd_remove : kwd_remove;
|
||||
|
13
Parser.mly
13
Parser.mly
@ -475,6 +475,19 @@ single_instr:
|
||||
| record_patch { RecordPatch $1 }
|
||||
| map_patch { MapPatch $1 }
|
||||
| map_remove { MapRemove $1 }
|
||||
| set_remove { SetRemove $1 }
|
||||
|
||||
set_remove:
|
||||
Remove expr From Set path {
|
||||
let region = cover $1 (path_to_region $5) in
|
||||
let value = {
|
||||
kwd_remove = $1;
|
||||
element = $2;
|
||||
kwd_from = $3;
|
||||
kwd_set = $4;
|
||||
set = $5}
|
||||
in {region; value}
|
||||
}
|
||||
|
||||
map_remove:
|
||||
Remove expr From Map path {
|
||||
|
Loading…
Reference in New Issue
Block a user