Made big_map a keyword, like map.

This commit is contained in:
Christian Rinderknecht 2019-10-08 12:22:22 +02:00
parent be88b546a4
commit 1362fbae9e
4 changed files with 16 additions and 4 deletions

View File

@ -72,6 +72,7 @@ type t =
| And of Region.t (* "and" *)
| Begin of Region.t (* "begin" *)
| BigMap of Region.t (* "big_map" *)
| Block of Region.t (* "block" *)
| Case of Region.t (* "case" *)
| Const of Region.t (* "const" *)

View File

@ -70,6 +70,7 @@ type t =
| And of Region.t (* "and" *)
| Begin of Region.t (* "begin" *)
| BigMap of Region.t (* "big_map" *)
| Block of Region.t (* "block" *)
| Case of Region.t (* "case" *)
| Const of Region.t (* "const" *)
@ -201,6 +202,7 @@ let proj_token = function
| And region -> region, "And"
| Begin region -> region, "Begin"
| BigMap region -> region, "BigMap"
| Block region -> region, "Block"
| Case region -> region, "Case"
| Const region -> region, "Const"
@ -293,6 +295,7 @@ let to_lexeme = function
| And _ -> "and"
| Begin _ -> "begin"
| BigMap _ -> "big_map"
| Block _ -> "block"
| Case _ -> "case"
| Const _ -> "const"
@ -353,6 +356,7 @@ let to_region token = proj_token token |> fst
let keywords = [
(fun reg -> And reg);
(fun reg -> Begin reg);
(fun reg -> BigMap reg);
(fun reg -> Block reg);
(fun reg -> Case reg);
(fun reg -> Const reg);
@ -569,6 +573,7 @@ let is_ident = function
let is_kwd = function
And _
| Begin _
| BigMap _
| Block _
| Case _
| Const _

View File

@ -46,6 +46,7 @@
%token <Region.t> And (* "and" *)
%token <Region.t> Begin (* "begin" *)
%token <Region.t> BigMap (* "big_map" *)
%token <Region.t> Block (* "block" *)
%token <Region.t> Case (* "case" *)
%token <Region.t> Const (* "const" *)

View File

@ -168,6 +168,11 @@ core_type:
let type_constr = {value="map"; region=$1}
in TApp {region; value = type_constr, $2}
}
| BigMap type_tuple {
let region = cover $1 $2.region in
let type_constr = {value="big_map"; region=$1}
in TApp {region; value = type_constr, $2}
}
| Set par(type_expr) {
let total = cover $1 $2.region in
let type_constr = {value="set"; region=$1} in