Small refactoring of the AST.
This commit is contained in:
parent
8eaf1a90ec
commit
60c23850bd
18
AST.ml
18
AST.ml
@ -448,13 +448,13 @@ and map_expr =
|
||||
MapLookUp of map_lookup reg
|
||||
|
||||
and map_lookup = {
|
||||
map_path : map_path;
|
||||
path : path;
|
||||
index : expr brackets reg
|
||||
}
|
||||
|
||||
and map_path =
|
||||
Map of map_name
|
||||
| MapPath of record_projection reg
|
||||
and path =
|
||||
Name of variable
|
||||
| RecordPath of record_projection reg
|
||||
|
||||
and logic_expr =
|
||||
BoolExpr of bool_expr
|
||||
@ -1081,16 +1081,16 @@ and print_expr = function
|
||||
|
||||
and print_map_expr = function
|
||||
MapLookUp {value; _} ->
|
||||
let {map_path; index} = value in
|
||||
let {path; index} = value in
|
||||
let {lbracket; inside; rbracket} = index.value in
|
||||
print_map_path map_path;
|
||||
print_path path;
|
||||
print_token lbracket "[";
|
||||
print_expr inside;
|
||||
print_token rbracket "]"
|
||||
|
||||
and print_map_path = function
|
||||
Map map_name -> print_var map_name
|
||||
| MapPath path -> print_record_projection path
|
||||
and print_path = function
|
||||
Name var -> print_var var
|
||||
| RecordPath path -> print_record_projection path
|
||||
|
||||
and print_logic_expr = function
|
||||
BoolExpr e -> print_bool_expr e
|
||||
|
8
AST.mli
8
AST.mli
@ -432,13 +432,13 @@ and map_expr =
|
||||
MapLookUp of map_lookup reg
|
||||
|
||||
and map_lookup = {
|
||||
map_path : map_path;
|
||||
path : path;
|
||||
index : expr brackets reg
|
||||
}
|
||||
|
||||
and map_path =
|
||||
Map of map_name
|
||||
| MapPath of record_projection reg
|
||||
and path =
|
||||
Name of variable
|
||||
| RecordPath of record_projection reg
|
||||
|
||||
and logic_expr =
|
||||
BoolExpr of bool_expr
|
||||
|
@ -773,14 +773,14 @@ map_selection:
|
||||
map_name brackets(expr) {
|
||||
let region = cover $1.region $2.region in
|
||||
let value = {
|
||||
map_path = Map $1;
|
||||
path = Name $1;
|
||||
index = $2}
|
||||
in {region; value}
|
||||
}
|
||||
| record_projection brackets(expr) {
|
||||
let region = cover $1.region $2.region in
|
||||
let value = {
|
||||
map_path = MapPath $1;
|
||||
path = RecordPath $1;
|
||||
index = $2}
|
||||
in {region; value}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user