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