remove option(recursive) in Parser.mly; parse error still

This commit is contained in:
Pierre-Emmanuel Wulfman 2020-02-21 11:41:36 +01:00
parent b438f065b5
commit 68b6e6d3b0

View File

@ -237,10 +237,21 @@ field_decl:
fun_expr:
ioption ("recursive") "function" parameters ":" type_expr "is" expr {
| "function" parameters ":" type_expr "is" expr {
let stop = expr_to_region $6 in
let region = cover $1 stop
and value = {kwd_recursive= None;
kwd_function = $1;
param = $2;
colon = $3;
ret_type = $4;
kwd_is = $5;
return = $6}
in {region; value} }
| "recursive" "function" parameters ":" type_expr "is" expr {
let stop = expr_to_region $7 in
let region = cover $2 stop
and value = {kwd_recursive= $1;
and value = {kwd_recursive= Some($1);
kwd_function = $2;
param = $3;
colon = $4;
@ -252,12 +263,46 @@ fun_expr:
(* Function declarations *)
open_fun_decl:
ioption("recursive") "function" fun_name parameters ":" type_expr "is"
"function" fun_name parameters ":" type_expr "is"
block "with" expr {
Scoping.check_reserved_name $2;
let stop = expr_to_region $9 in
let region = cover $1 stop
and value = {kwd_recursive= None;
kwd_function = $1;
fun_name = $2;
param = $3;
colon = $4;
ret_type = $5;
kwd_is = $6;
block_with = Some ($7, $8);
return = $9;
terminator = None;
attributes = None}
in {region; value}
}
| "function" fun_name parameters ":" type_expr "is" expr {
Scoping.check_reserved_name $2;
let stop = expr_to_region $7 in
let region = cover $1 stop
and value = {kwd_recursive= None;
kwd_function = $1;
fun_name = $2;
param = $3;
colon = $4;
ret_type = $5;
kwd_is = $6;
block_with = None;
return = $7;
terminator = None;
attributes = None}
in {region; value} }
| "recursive" "function" fun_name parameters ":" type_expr "is"
block "with" expr {
Scoping.check_reserved_name $3;
let stop = expr_to_region $10 in
let region = cover $2 stop
and value = {kwd_recursive= $1;
and value = {kwd_recursive= Some($1);
kwd_function = $2;
fun_name = $3;
param = $4;
@ -270,11 +315,11 @@ open_fun_decl:
attributes = None}
in {region; value}
}
| ioption ("recursive") "function" fun_name parameters ":" type_expr "is" expr {
| "recursive" "function" fun_name parameters ":" type_expr "is" expr {
Scoping.check_reserved_name $3;
let stop = expr_to_region $8 in
let region = cover $2 stop
and value = {kwd_recursive= $1;
and value = {kwd_recursive= Some($1);
kwd_function = $2;
fun_name = $3;
param = $4;