Made big_map a keyword, like map.
This commit is contained in:
parent
be88b546a4
commit
1362fbae9e
@ -72,6 +72,7 @@ type t =
|
|||||||
|
|
||||||
| And of Region.t (* "and" *)
|
| And of Region.t (* "and" *)
|
||||||
| Begin of Region.t (* "begin" *)
|
| Begin of Region.t (* "begin" *)
|
||||||
|
| BigMap of Region.t (* "big_map" *)
|
||||||
| Block of Region.t (* "block" *)
|
| Block of Region.t (* "block" *)
|
||||||
| Case of Region.t (* "case" *)
|
| Case of Region.t (* "case" *)
|
||||||
| Const of Region.t (* "const" *)
|
| Const of Region.t (* "const" *)
|
||||||
@ -141,7 +142,7 @@ type int_err =
|
|||||||
|
|
||||||
type ident_err = Reserved_name
|
type ident_err = Reserved_name
|
||||||
|
|
||||||
type invalid_natural =
|
type invalid_natural =
|
||||||
| Invalid_natural
|
| Invalid_natural
|
||||||
| Non_canonical_zero_nat
|
| Non_canonical_zero_nat
|
||||||
|
|
||||||
|
@ -70,6 +70,7 @@ type t =
|
|||||||
|
|
||||||
| And of Region.t (* "and" *)
|
| And of Region.t (* "and" *)
|
||||||
| Begin of Region.t (* "begin" *)
|
| Begin of Region.t (* "begin" *)
|
||||||
|
| BigMap of Region.t (* "big_map" *)
|
||||||
| Block of Region.t (* "block" *)
|
| Block of Region.t (* "block" *)
|
||||||
| Case of Region.t (* "case" *)
|
| Case of Region.t (* "case" *)
|
||||||
| Const of Region.t (* "const" *)
|
| Const of Region.t (* "const" *)
|
||||||
@ -201,6 +202,7 @@ let proj_token = function
|
|||||||
|
|
||||||
| And region -> region, "And"
|
| And region -> region, "And"
|
||||||
| Begin region -> region, "Begin"
|
| Begin region -> region, "Begin"
|
||||||
|
| BigMap region -> region, "BigMap"
|
||||||
| Block region -> region, "Block"
|
| Block region -> region, "Block"
|
||||||
| Case region -> region, "Case"
|
| Case region -> region, "Case"
|
||||||
| Const region -> region, "Const"
|
| Const region -> region, "Const"
|
||||||
@ -293,6 +295,7 @@ let to_lexeme = function
|
|||||||
|
|
||||||
| And _ -> "and"
|
| And _ -> "and"
|
||||||
| Begin _ -> "begin"
|
| Begin _ -> "begin"
|
||||||
|
| BigMap _ -> "big_map"
|
||||||
| Block _ -> "block"
|
| Block _ -> "block"
|
||||||
| Case _ -> "case"
|
| Case _ -> "case"
|
||||||
| Const _ -> "const"
|
| Const _ -> "const"
|
||||||
@ -353,6 +356,7 @@ let to_region token = proj_token token |> fst
|
|||||||
let keywords = [
|
let keywords = [
|
||||||
(fun reg -> And reg);
|
(fun reg -> And reg);
|
||||||
(fun reg -> Begin reg);
|
(fun reg -> Begin reg);
|
||||||
|
(fun reg -> BigMap reg);
|
||||||
(fun reg -> Block reg);
|
(fun reg -> Block reg);
|
||||||
(fun reg -> Case reg);
|
(fun reg -> Case reg);
|
||||||
(fun reg -> Const reg);
|
(fun reg -> Const reg);
|
||||||
@ -476,14 +480,14 @@ let mk_int lexeme region =
|
|||||||
then Error Non_canonical_zero
|
then Error Non_canonical_zero
|
||||||
else Ok (Int Region.{region; value = lexeme, z})
|
else Ok (Int Region.{region; value = lexeme, z})
|
||||||
|
|
||||||
type invalid_natural =
|
type invalid_natural =
|
||||||
| Invalid_natural
|
| Invalid_natural
|
||||||
| Non_canonical_zero_nat
|
| Non_canonical_zero_nat
|
||||||
|
|
||||||
let mk_nat lexeme region =
|
let mk_nat lexeme region =
|
||||||
match (String.index_opt lexeme 'n') with
|
match (String.index_opt lexeme 'n') with
|
||||||
| None -> Error Invalid_natural
|
| None -> Error Invalid_natural
|
||||||
| Some _ -> (
|
| Some _ -> (
|
||||||
let z =
|
let z =
|
||||||
Str.(global_replace (regexp "_") "" lexeme) |>
|
Str.(global_replace (regexp "_") "" lexeme) |>
|
||||||
Str.(global_replace (regexp "n") "") |>
|
Str.(global_replace (regexp "n") "") |>
|
||||||
@ -569,6 +573,7 @@ let is_ident = function
|
|||||||
let is_kwd = function
|
let is_kwd = function
|
||||||
And _
|
And _
|
||||||
| Begin _
|
| Begin _
|
||||||
|
| BigMap _
|
||||||
| Block _
|
| Block _
|
||||||
| Case _
|
| Case _
|
||||||
| Const _
|
| Const _
|
||||||
|
@ -46,6 +46,7 @@
|
|||||||
|
|
||||||
%token <Region.t> And (* "and" *)
|
%token <Region.t> And (* "and" *)
|
||||||
%token <Region.t> Begin (* "begin" *)
|
%token <Region.t> Begin (* "begin" *)
|
||||||
|
%token <Region.t> BigMap (* "big_map" *)
|
||||||
%token <Region.t> Block (* "block" *)
|
%token <Region.t> Block (* "block" *)
|
||||||
%token <Region.t> Case (* "case" *)
|
%token <Region.t> Case (* "case" *)
|
||||||
%token <Region.t> Const (* "const" *)
|
%token <Region.t> Const (* "const" *)
|
||||||
|
@ -168,6 +168,11 @@ core_type:
|
|||||||
let type_constr = {value="map"; region=$1}
|
let type_constr = {value="map"; region=$1}
|
||||||
in TApp {region; value = type_constr, $2}
|
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) {
|
| Set par(type_expr) {
|
||||||
let total = cover $1 $2.region in
|
let total = cover $1 $2.region in
|
||||||
let type_constr = {value="set"; region=$1} in
|
let type_constr = {value="set"; region=$1} in
|
||||||
|
Loading…
Reference in New Issue
Block a user