I added the patching of sets.
Syntax: patch s with set ... end
This commit is contained in:
parent
98590b2e4a
commit
c76ec00c9b
17
AST.ml
17
AST.ml
@ -333,6 +333,7 @@ and single_instr =
|
|||||||
| Skip of kwd_skip
|
| Skip of kwd_skip
|
||||||
| RecordPatch of record_patch reg
|
| RecordPatch of record_patch reg
|
||||||
| MapPatch of map_patch reg
|
| MapPatch of map_patch reg
|
||||||
|
| SetPatch of set_patch reg
|
||||||
| MapRemove of map_remove reg
|
| MapRemove of map_remove reg
|
||||||
| SetRemove of set_remove reg
|
| SetRemove of set_remove reg
|
||||||
|
|
||||||
@ -352,6 +353,13 @@ and map_remove = {
|
|||||||
map : path
|
map : path
|
||||||
}
|
}
|
||||||
|
|
||||||
|
and set_patch = {
|
||||||
|
kwd_patch : kwd_patch;
|
||||||
|
path : path;
|
||||||
|
kwd_with : kwd_with;
|
||||||
|
set_inj : set_injection reg
|
||||||
|
}
|
||||||
|
|
||||||
and map_patch = {
|
and map_patch = {
|
||||||
kwd_patch : kwd_patch;
|
kwd_patch : kwd_patch;
|
||||||
path : path;
|
path : path;
|
||||||
@ -721,6 +729,7 @@ let instr_to_region = function
|
|||||||
| Single Fail {region; _}
|
| Single Fail {region; _}
|
||||||
| Single RecordPatch {region; _}
|
| Single RecordPatch {region; _}
|
||||||
| Single MapPatch {region; _}
|
| Single MapPatch {region; _}
|
||||||
|
| Single SetPatch {region; _}
|
||||||
| Single MapRemove {region; _}
|
| Single MapRemove {region; _}
|
||||||
| Single SetRemove {region; _}
|
| Single SetRemove {region; _}
|
||||||
| Block {region; _} -> region
|
| Block {region; _} -> region
|
||||||
@ -1019,6 +1028,7 @@ and print_single_instr = function
|
|||||||
| Skip kwd_skip -> print_token kwd_skip "skip"
|
| Skip kwd_skip -> print_token kwd_skip "skip"
|
||||||
| RecordPatch {value; _} -> print_record_patch value
|
| RecordPatch {value; _} -> print_record_patch value
|
||||||
| MapPatch {value; _} -> print_map_patch value
|
| MapPatch {value; _} -> print_map_patch value
|
||||||
|
| SetPatch {value; _} -> print_set_patch value
|
||||||
| MapRemove {value; _} -> print_map_remove value
|
| MapRemove {value; _} -> print_map_remove value
|
||||||
| SetRemove {value; _} -> print_set_remove value
|
| SetRemove {value; _} -> print_set_remove value
|
||||||
|
|
||||||
@ -1255,6 +1265,13 @@ and print_record_patch node =
|
|||||||
print_token kwd_with "with";
|
print_token kwd_with "with";
|
||||||
print_record_injection record_inj
|
print_record_injection record_inj
|
||||||
|
|
||||||
|
and print_set_patch node =
|
||||||
|
let {kwd_patch; path; kwd_with; set_inj} = node in
|
||||||
|
print_token kwd_patch "patch";
|
||||||
|
print_path path;
|
||||||
|
print_token kwd_with "with";
|
||||||
|
print_set_injection set_inj
|
||||||
|
|
||||||
and print_map_patch node =
|
and print_map_patch node =
|
||||||
let {kwd_patch; path; kwd_with; map_inj} = node in
|
let {kwd_patch; path; kwd_with; map_inj} = node in
|
||||||
print_token kwd_patch "patch";
|
print_token kwd_patch "patch";
|
||||||
|
8
AST.mli
8
AST.mli
@ -317,6 +317,7 @@ and single_instr =
|
|||||||
| Skip of kwd_skip
|
| Skip of kwd_skip
|
||||||
| RecordPatch of record_patch reg
|
| RecordPatch of record_patch reg
|
||||||
| MapPatch of map_patch reg
|
| MapPatch of map_patch reg
|
||||||
|
| SetPatch of set_patch reg
|
||||||
| MapRemove of map_remove reg
|
| MapRemove of map_remove reg
|
||||||
| SetRemove of set_remove reg
|
| SetRemove of set_remove reg
|
||||||
|
|
||||||
@ -336,6 +337,13 @@ and map_remove = {
|
|||||||
map : path
|
map : path
|
||||||
}
|
}
|
||||||
|
|
||||||
|
and set_patch = {
|
||||||
|
kwd_patch : kwd_patch;
|
||||||
|
path : path;
|
||||||
|
kwd_with : kwd_with;
|
||||||
|
set_inj : set_injection reg
|
||||||
|
}
|
||||||
|
|
||||||
and map_patch = {
|
and map_patch = {
|
||||||
kwd_patch : kwd_patch;
|
kwd_patch : kwd_patch;
|
||||||
path : path;
|
path : path;
|
||||||
|
12
Parser.mly
12
Parser.mly
@ -474,6 +474,7 @@ single_instr:
|
|||||||
| Skip { Skip $1 }
|
| Skip { Skip $1 }
|
||||||
| record_patch { RecordPatch $1 }
|
| record_patch { RecordPatch $1 }
|
||||||
| map_patch { MapPatch $1 }
|
| map_patch { MapPatch $1 }
|
||||||
|
| set_patch { SetPatch $1 }
|
||||||
| map_remove { MapRemove $1 }
|
| map_remove { MapRemove $1 }
|
||||||
| set_remove { SetRemove $1 }
|
| set_remove { SetRemove $1 }
|
||||||
|
|
||||||
@ -501,6 +502,17 @@ map_remove:
|
|||||||
in {region; value}
|
in {region; value}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set_patch:
|
||||||
|
Patch path With set_injection {
|
||||||
|
let region = cover $1 $4.region in
|
||||||
|
let value = {
|
||||||
|
kwd_patch = $1;
|
||||||
|
path = $2;
|
||||||
|
kwd_with = $3;
|
||||||
|
set_inj = $4}
|
||||||
|
in {region; value}
|
||||||
|
}
|
||||||
|
|
||||||
map_patch:
|
map_patch:
|
||||||
Patch path With map_injection {
|
Patch path With map_injection {
|
||||||
let region = cover $1 $4.region in
|
let region = cover $1 $4.region in
|
||||||
|
Loading…
Reference in New Issue
Block a user