Small refactoring of the AST.

This commit is contained in:
Christian Rinderknecht 2019-03-20 09:26:24 +01:00
parent 8eaf1a90ec
commit 60c23850bd
No known key found for this signature in database
GPG Key ID: 9446816CFD267040
3 changed files with 21 additions and 21 deletions

22
AST.ml
View File

@ -445,16 +445,16 @@ and expr =
| ParExpr of expr par reg
and map_expr =
MapLookUp of map_lookup reg
MapLookUp of map_lookup reg
and map_lookup = {
map_path : map_path;
index : expr brackets reg
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

12
AST.mli
View File

@ -429,16 +429,16 @@ and expr =
| ParExpr of expr par reg
and map_expr =
MapLookUp of map_lookup reg
MapLookUp of map_lookup reg
and map_lookup = {
map_path : map_path;
index : expr brackets reg
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

View File

@ -773,15 +773,15 @@ map_selection:
map_name brackets(expr) {
let region = cover $1.region $2.region in
let value = {
map_path = Map $1;
index = $2}
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;
index = $2}
path = RecordPath $1;
index = $2}
in {region; value}
}