Merged first changes towards handling comments. Refactoring.

This commit is contained in:
Christian Rinderknecht 2020-06-23 11:52:39 +02:00
parent 3ec21a8762
commit d34b345edc
10 changed files with 441 additions and 372 deletions

View File

@ -142,7 +142,9 @@ type_decl:
terminator = $5}
in {region; value} }
type_expr_colon: ":" type_expr { $1,$2 }
type_annot:
":" type_expr { $1,$2 }
type_expr:
fun_type | sum_type | record_type { $1 }
@ -240,7 +242,7 @@ field_decl:
fun_expr:
"function" parameters type_expr_colon? "is" expr {
"function" parameters type_annot? "is" expr {
let stop = expr_to_region $5 in
let region = cover $1 stop
and value = {kwd_function = $1;
@ -253,7 +255,7 @@ fun_expr:
(* Function declarations *)
open_fun_decl:
ioption ("recursive") "function" fun_name parameters type_expr_colon? "is"
ioption ("recursive") "function" fun_name parameters type_annot? "is"
block "with" expr {
Scoping.check_reserved_name $3;
let stop = expr_to_region $9 in
@ -270,7 +272,7 @@ open_fun_decl:
attributes = None}
in {region; value}
}
| ioption ("recursive") "function" fun_name parameters type_expr_colon? "is"
| ioption ("recursive") "function" fun_name parameters type_annot? "is"
expr {
Scoping.check_reserved_name $3;
let stop = expr_to_region $7 in
@ -372,7 +374,7 @@ open_var_decl:
in {region; value} }
unqualified_decl(OP):
var type_expr_colon? OP expr {
var type_annot? OP expr {
Scoping.check_reserved_name $1;
let region = expr_to_region $4
in $1, $2, $3, $4, region }
@ -610,28 +612,17 @@ while_loop:
in While {region; value} }
for_loop:
"for" var ":=" expr "to" expr block {
let region = cover $1 $7.region in
let value = {kwd_for = $1;
binder = $2;
assign = $3;
init = $4;
kwd_to = $5;
bound = $6;
step = None;
block = $7}
in For (ForInt {region; value})
}
| "for" var ":=" expr "to" expr "step" expr block {
let region = cover $1 $9.region in
let value = {kwd_for = $1;
binder = $2;
assign = $3;
init = $4;
kwd_to = $5;
bound = $6;
step = Some ($7, $8);
block = $9}
"for" var ":=" expr "to" expr step_clause? block {
Scoping.check_reserved_name $2;
let region = cover $1 $8.region in
let value = {kwd_for = $1;
binder = $2;
assign = $3;
init = $4;
kwd_to = $5;
bound = $6;
step = $7;
block = $8}
in For (ForInt {region; value})
}
| "for" var arrow_clause? "in" collection expr block {
@ -646,6 +637,9 @@ for_loop:
block = $7}
in For (ForCollect {region; value}) }
step_clause:
"step" expr { $1,$2 }
collection:
"map" { Map $1 }
| "set" { Set $1 }

View File

@ -64,7 +64,7 @@ let print_sepseq :
None -> ()
| Some seq -> print_nsepseq state sep print seq
let print_option : state -> (state -> 'a -> unit ) -> 'a option -> unit =
let print_option : state -> (state -> 'a -> unit) -> 'a option -> unit =
fun state print -> function
None -> ()
| Some opt -> print state opt
@ -141,7 +141,7 @@ and print_const_decl state {value; _} =
equal; init; terminator; _} = value in
print_token state kwd_const "const";
print_var state name;
print_option state print_colon_type_expr const_type;
print_option state print_type_annot const_type;
print_token state equal "=";
print_expr state init;
print_terminator state terminator
@ -165,7 +165,7 @@ and print_type_expr state = function
| TVar type_var -> print_var state type_var
| TString str -> print_string state str
and print_colon_type_expr state (colon, type_expr) =
and print_type_annot state (colon, type_expr) =
print_token state colon ":";
print_type_expr state type_expr;
@ -223,7 +223,7 @@ and print_fun_decl state {value; _} =
print_token state kwd_function "function";
print_var state fun_name;
print_parameters state param;
print_option state print_colon_type_expr ret_type;
print_option state print_type_annot ret_type;
print_token state kwd_is "is";
(match block_with with
None -> ()
@ -238,7 +238,7 @@ and print_fun_expr state {value; _} =
ret_type; kwd_is; return} : fun_expr = value in
print_token state kwd_function "function";
print_parameters state param;
print_option state print_colon_type_expr ret_type;
print_option state print_type_annot ret_type;
print_token state kwd_is "is";
print_expr state return
@ -254,9 +254,9 @@ and print_code_inj state {value; _} =
and print_parameters state {value; _} =
let {lpar; inside; rpar} = value in
print_token state lpar "(";
print_token state lpar "(";
print_nsepseq state ";" print_param_decl inside;
print_token state rpar ")"
print_token state rpar ")"
and print_param_decl state = function
ParamConst param_const -> print_param_const state param_const
@ -264,15 +264,15 @@ and print_param_decl state = function
and print_param_const state {value; _} =
let {kwd_const; var; param_type} = value in
print_token state kwd_const "const";
print_var state var;
print_option state print_colon_type_expr param_type
print_token state kwd_const "const";
print_var state var;
print_option state print_type_annot param_type
and print_param_var state {value; _} =
let {kwd_var; var; param_type} = value in
print_token state kwd_var "var";
print_var state var;
print_option state print_colon_type_expr param_type
print_option state print_type_annot param_type
and print_block state block =
let {enclosing; statements; terminator} = block.value in
@ -299,7 +299,7 @@ and print_var_decl state {value; _} =
assign; init; terminator} = value in
print_token state kwd_var "var";
print_var state name;
print_option state print_colon_type_expr var_type;
print_option state print_type_annot var_type;
print_token state assign ":=";
print_expr state init;
print_terminator state terminator
@ -917,43 +917,59 @@ and pp_declaration state = function
and pp_attr_decl state = pp_ne_injection pp_string state
and pp_fun_decl state decl =
let arity, start =
let kwd_recursive = if decl.kwd_recursive = None then 0 else 1 in
let ret_type = if decl.ret_type = None then 0 else 1 in
let block_with = if decl.block_with = None then 0 else 1 in
let arity = kwd_recursive + ret_type + block_with + 3 in
let index = 0 in
let index =
match decl.kwd_recursive with
None -> 5,0
| Some _ ->
let state = state#pad 6 0 in
let () = pp_node state "recursive"
in 6,1 in
let () =
let state = state#pad arity start in
pp_ident state decl.fun_name in
let () =
let state = state#pad arity (start + 1) in
None -> index
| Some _ -> let state = state#pad arity index in
pp_node state "recursive";
index + 1 in
let index =
let state = state#pad arity index in
pp_ident state decl.fun_name;
index + 1 in
let index =
let state = state#pad arity index in
pp_node state "<parameters>";
pp_parameters state decl.param in
pp_parameters state decl.param;
index + 1 in
let index =
match decl.ret_type with
None -> index
| Some (_, t_expr) ->
let state = state#pad arity index in
pp_node state "<return type>";
pp_type_expr (state#pad 1 0) t_expr;
index+1 in
let index =
match decl.block_with with
None -> index
| Some (block,_) ->
let statements = block.value.statements in
let state = state#pad arity index in
pp_node state "<body>";
pp_statements state statements;
index+1 in
let () =
let state = state#pad arity (start + 2) in
pp_node state "<return type>";
print_option (state#pad 1 0) pp_type_expr @@ Option.map snd decl.ret_type in
let () =
let state = state#pad arity (start + 3) in
pp_node state "<body>";
let statements =
match decl.block_with with
Some (block,_) -> block.value.statements
| None -> Instr (Skip Region.ghost), [] in
pp_statements state statements in
let () =
let state = state#pad arity (start + 4) in
let state = state#pad arity index in
pp_node state "<return>";
pp_expr (state#pad 1 0) decl.return
in ()
and pp_const_decl state decl =
let arity = 3 in
pp_ident (state#pad arity 0) decl.name;
print_option (state#pad arity 1) pp_type_expr @@ Option.map snd decl.const_type;
pp_expr (state#pad arity 2) decl.init
let arity = if decl.const_type = None then 2 else 3 in
let index = 0 in
let index =
pp_ident (state#pad arity 0) decl.name; index+1 in
let index =
pp_type_annot (state#pad arity index) index decl.const_type in
let () =
pp_expr (state#pad arity index) decl.init
in ()
and pp_type_expr state = function
TProd cartesian ->
@ -1014,16 +1030,23 @@ and pp_type_tuple state {value; _} =
in List.iteri (List.length components |> apply) components
and pp_fun_expr state (expr: fun_expr) =
let () =
let state = state#pad 3 0 in
let arity = if expr.ret_type = None then 2 else 3 in
let index = 0 in
let index =
let state = state#pad arity index in
pp_node state "<parameters>";
pp_parameters state expr.param in
pp_parameters state expr.param;
index + 1 in
let index =
match expr.ret_type with
None -> index
| Some (_, t_expr) ->
let state = state#pad arity index in
pp_node state "<return type>";
pp_type_expr (state#pad 1 0) t_expr;
index + 1 in
let () =
let state = state#pad 3 1 in
pp_node state "<return type>";
print_option (state#pad 1 0) pp_type_expr @@ Option.map snd expr.ret_type in
let () =
let state = state#pad 3 2 in
let state = state#pad arity index in
pp_node state "<return>";
pp_expr (state#pad 1 0) expr.return
in ()
@ -1047,13 +1070,15 @@ and pp_parameters state {value; _} =
and pp_param_decl state = function
ParamConst {value; region} ->
let arity = if value.param_type = None then 1 else 2 in
pp_loc_node state "ParamConst" region;
pp_ident (state#pad 2 0) value.var;
print_option (state#pad 2 1) pp_type_expr @@ Option.map snd value.param_type
pp_ident (state#pad arity 0) value.var;
ignore (pp_type_annot (state#pad arity 1) 1 value.param_type)
| ParamVar {value; region} ->
let arity = if value.param_type = None then 1 else 2 in
pp_loc_node state "ParamVar" region;
pp_ident (state#pad 2 0) value.var;
print_option (state#pad 2 1) pp_type_expr @@ Option.map snd value.param_type
ignore (pp_type_annot (state#pad arity 1) 1 value.param_type)
and pp_statements state statements =
let statements = Utils.nsepseq_to_list statements in
@ -1454,9 +1479,11 @@ and pp_data_decl state = function
pp_fun_decl state value
and pp_var_decl state decl =
pp_ident (state#pad 3 0) decl.name;
print_option (state#pad 3 1) pp_type_expr @@ Option.map snd decl.var_type;
pp_expr (state#pad 3 2) decl.init
let arity = if decl.var_type = None then 2 else 3 in
let index = 0 in
let index = pp_ident (state#pad arity index) decl.name; index+1 in
let index = pp_type_annot (state#pad arity index) index decl.var_type
in pp_expr (state#pad arity index) decl.init
and pp_expr state = function
ECase {value; region} ->
@ -1653,3 +1680,7 @@ and pp_bin_op node region state op =
pp_loc_node state node region;
pp_expr (state#pad 2 0) op.arg1;
pp_expr (state#pad 2 1) op.arg2
and pp_type_annot state index = function
None -> index
| Some (_, e) -> pp_type_expr state e; index+1

View File

@ -39,12 +39,16 @@ and pp_attr_decl decl = pp_ne_injection pp_string decl
and pp_const_decl {value; _} =
let {name; const_type; init; attributes; _} = value in
let attr = match attributes with
None -> empty
| Some a -> hardline ^^ pp_attr_decl a in
let start = string ("const " ^ name.value) in
let t_expr = const_type in
let attr = match attributes with
None -> empty
| Some a -> hardline ^^ pp_attr_decl a in
group (start ^/^ pp_option (fun (_, d) -> nest 2 (string ": " ^^ pp_type_expr d)) t_expr)
let start =
match const_type with
None -> start
| Some (_, e) ->
group (start ^/^ nest 2 (string ": " ^^ pp_type_expr e)) in
start
^^ group (break 1 ^^ nest 2 (string "= " ^^ pp_expr init))
^^ attr
@ -126,35 +130,47 @@ and pp_type_tuple {value; _} =
and pp_fun_expr {value; _} =
let {param; ret_type; return; _} : fun_expr = value in
let start = string "function" in
let start = string "function" in
let parameters = pp_par pp_parameters param in
let expr = pp_expr return in
let t_annot =
match ret_type with
None -> empty
| Some (_, e) ->
group (break 1 ^^ nest 2 (string ": " ^^ pp_type_expr e)) in
group (start ^^ nest 2 (break 1 ^^ parameters))
^^ pp_option (fun (_,d) -> group (break 1 ^^ nest 2 (string ": " ^^ pp_type_expr d))) ret_type
^^ string " is" ^^ group (nest 4 (break 1 ^^ expr))
^^ t_annot
^^ string " is" ^^ group (nest 4 (break 1 ^^ pp_expr return))
and pp_fun_decl {value; _} =
let {kwd_recursive; fun_name; param;
ret_type; block_with; return; attributes; _} = value in
let {kwd_recursive; fun_name; param; ret_type;
block_with; return; attributes; _} = value in
let start =
match kwd_recursive with
None -> string "function"
| Some _ -> string "recursive" ^/^ string "function" in
let start = start ^^ group (break 1 ^^ nest 2 (pp_ident fun_name)) in
let parameters = pp_par pp_parameters param in
let expr = pp_expr return in
let body =
let start = start ^^ group (break 1 ^^ nest 2 (pp_ident fun_name))
and parameters = pp_par pp_parameters param
and t_annot_is =
match ret_type with
None -> string " is"
| Some (_, e) ->
let ret_type = pp_type_expr e in
group (nest 2 (break 1 ^^ string ": " ^^ nest 2 ret_type
^^ string " is"))
and body =
let expr = pp_expr return in
match block_with with
None -> group (nest 2 (break 1 ^^ expr))
| Some (b,_) -> hardline ^^ pp_block b ^^ string " with"
^^ group (nest 4 (break 1 ^^ expr))
and attr =
match attributes with
None -> empty
None -> empty
| Some a -> hardline ^^ pp_attr_decl a in
prefix 2 1 start parameters
^^ group (nest 2 (pp_option (fun (_, d) -> break 1 ^^ string ": " ^^ nest 2 (pp_type_expr d)) ret_type ^^ string " is"))
^^ body ^^ attr
^^ t_annot_is
^^ body
^^ attr
and pp_parameters p = pp_nsepseq ";" pp_param_decl p
@ -164,13 +180,19 @@ and pp_param_decl = function
and pp_param_const {value; _} =
let {var; param_type; _} : param_const = value in
let name = string ("const " ^ var.value)
in prefix 2 1 name @@ pp_option (fun (_,d) -> string ": " ^^ pp_type_expr d) param_type
let name = string ("const " ^ var.value) in
match param_type with
None -> name
| Some (_, e) ->
prefix 2 1 (name ^^ string " :") (pp_type_expr e)
and pp_param_var {value; _} =
let {var; param_type; _} : param_var = value in
let name = string ("var " ^ var.value)
in prefix 2 1 name @@ pp_option (fun (_,d) -> string ": " ^^ pp_type_expr d) param_type
let name = string ("var " ^ var.value) in
match param_type with
None -> name
| Some (_, e) ->
prefix 2 1 (name ^^ string " :") (pp_type_expr e)
and pp_block {value; _} =
string "block {"
@ -192,7 +214,12 @@ and pp_data_decl = function
and pp_var_decl {value; _} =
let {name; var_type; init; _} = value in
let start = string ("var " ^ name.value) in
group (start ^/^ pp_option (fun (_,d) -> nest 2 (string ": " ^^ pp_type_expr d)) var_type)
let start =
match const_type with
None -> start
| Some (_, e) ->
group (start ^/^ nest 2 (string ": " ^^ pp_type_expr e)) in
start
^^ group (break 1 ^^ nest 2 (string ":= " ^^ pp_expr init))
and pp_instruction = function

View File

@ -703,10 +703,10 @@ interactive_expr: Function LPAR Const Ident RPAR COLON Ident VBAR
##
## Ends in an error in state: 116.
##
## fun_expr -> Function parameters option(type_expr_colon) . Is expr [ VBAR Type To Then Step SEMI Recursive RPAR RBRACKET RBRACE Of Function From End Else EOF Const COMMA Block Begin Attributes ARROW ]
## fun_expr -> Function parameters option(type_annot) . Is expr [ VBAR Type To Then Step SEMI Recursive RPAR RBRACKET RBRACE Of Function From End Else EOF Const COMMA Block Begin Attributes ARROW ]
##
## The known suffix of the stack is as follows:
## Function parameters option(type_expr_colon)
## Function parameters option(type_annot)
##
## WARNING: This example involves spurious reductions.
## This implies that, although the LR(1) items shown above provide an
@ -716,8 +716,8 @@ interactive_expr: Function LPAR Const Ident RPAR COLON Ident VBAR
## In state 30, spurious reduction of production cartesian -> core_type
## In state 36, spurious reduction of production fun_type -> cartesian
## In state 44, spurious reduction of production type_expr -> fun_type
## In state 88, spurious reduction of production type_expr_colon -> COLON type_expr
## In state 89, spurious reduction of production option(type_expr_colon) -> type_expr_colon
## In state 88, spurious reduction of production type_annot -> COLON type_expr
## In state 89, spurious reduction of production option(type_annot) -> type_annot
##
<YOUR SYNTAX ERROR MESSAGE HERE>
@ -726,10 +726,10 @@ interactive_expr: Function LPAR Const Ident RPAR Is With
##
## Ends in an error in state: 117.
##
## fun_expr -> Function parameters option(type_expr_colon) Is . expr [ VBAR Type To Then Step SEMI Recursive RPAR RBRACKET RBRACE Of Function From End Else EOF Const COMMA Block Begin Attributes ARROW ]
## fun_expr -> Function parameters option(type_annot) Is . expr [ VBAR Type To Then Step SEMI Recursive RPAR RBRACKET RBRACE Of Function From End Else EOF Const COMMA Block Begin Attributes ARROW ]
##
## The known suffix of the stack is as follows:
## Function parameters option(type_expr_colon) Is
## Function parameters option(type_annot) Is
##
<YOUR SYNTAX ERROR MESSAGE HERE>
@ -738,7 +738,7 @@ interactive_expr: Function LPAR Const Ident RPAR With
##
## Ends in an error in state: 115.
##
## fun_expr -> Function parameters . option(type_expr_colon) Is expr [ VBAR Type To Then Step SEMI Recursive RPAR RBRACKET RBRACE Of Function From End Else EOF Const COMMA Block Begin Attributes ARROW ]
## fun_expr -> Function parameters . option(type_annot) Is expr [ VBAR Type To Then Step SEMI Recursive RPAR RBRACKET RBRACE Of Function From End Else EOF Const COMMA Block Begin Attributes ARROW ]
##
## The known suffix of the stack is as follows:
## Function parameters
@ -857,7 +857,7 @@ interactive_expr: Function With
##
## Ends in an error in state: 114.
##
## fun_expr -> Function . parameters option(type_expr_colon) Is expr [ VBAR Type To Then Step SEMI Recursive RPAR RBRACKET RBRACE Of Function From End Else EOF Const COMMA Block Begin Attributes ARROW ]
## fun_expr -> Function . parameters option(type_annot) Is expr [ VBAR Type To Then Step SEMI Recursive RPAR RBRACKET RBRACE Of Function From End Else EOF Const COMMA Block Begin Attributes ARROW ]
##
## The known suffix of the stack is as follows:
## Function
@ -2515,7 +2515,7 @@ interactive_expr: Verbatim TIMES With
interactive_expr: Verbatim VBAR
##
## Ends in an error in state: 601.
## Ends in an error in state: 602.
##
## interactive_expr -> expr . EOF [ # ]
##
@ -2555,7 +2555,7 @@ interactive_expr: Verbatim With
interactive_expr: With
##
## Ends in an error in state: 599.
## Ends in an error in state: 600.
##
## interactive_expr' -> . interactive_expr [ # ]
##
@ -2567,7 +2567,7 @@ interactive_expr: With
contract: Attributes LBRACKET String End
##
## Ends in an error in state: 545.
## Ends in an error in state: 546.
##
## ne_injection(Attributes,String) -> Attributes LBRACKET sep_or_term_list(String,SEMI) . RBRACKET [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
##
@ -2578,15 +2578,15 @@ contract: Attributes LBRACKET String End
## This implies that, although the LR(1) items shown above provide an
## accurate view of the past (what has been recognized so far), they
## may provide an INCOMPLETE view of the future (what was expected next).
## In state 537, spurious reduction of production nsepseq(String,SEMI) -> String
## In state 548, spurious reduction of production sep_or_term_list(String,SEMI) -> nsepseq(String,SEMI)
## In state 538, spurious reduction of production nsepseq(String,SEMI) -> String
## In state 549, spurious reduction of production sep_or_term_list(String,SEMI) -> nsepseq(String,SEMI)
##
<YOUR SYNTAX ERROR MESSAGE HERE>
contract: Attributes LBRACKET With
##
## Ends in an error in state: 544.
## Ends in an error in state: 545.
##
## ne_injection(Attributes,String) -> Attributes LBRACKET . sep_or_term_list(String,SEMI) RBRACKET [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
##
@ -2598,7 +2598,7 @@ contract: Attributes LBRACKET With
contract: Attributes String End Attributes String End SEMI With
##
## Ends in an error in state: 594.
## Ends in an error in state: 595.
##
## seq(declaration) -> declaration . seq(declaration) [ EOF ]
##
@ -2610,7 +2610,7 @@ contract: Attributes String End Attributes String End SEMI With
contract: Attributes String End SEMI With
##
## Ends in an error in state: 592.
## Ends in an error in state: 593.
##
## nseq(declaration) -> declaration . seq(declaration) [ EOF ]
##
@ -2622,7 +2622,7 @@ contract: Attributes String End SEMI With
contract: Attributes String End With
##
## Ends in an error in state: 587.
## Ends in an error in state: 588.
##
## attr_decl -> open_attr_decl . option(SEMI) [ Type Recursive Function EOF Const Attributes ]
##
@ -2634,7 +2634,7 @@ contract: Attributes String End With
contract: Attributes String RBRACKET
##
## Ends in an error in state: 549.
## Ends in an error in state: 550.
##
## ne_injection(Attributes,String) -> Attributes sep_or_term_list(String,SEMI) . End [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
##
@ -2645,15 +2645,15 @@ contract: Attributes String RBRACKET
## This implies that, although the LR(1) items shown above provide an
## accurate view of the past (what has been recognized so far), they
## may provide an INCOMPLETE view of the future (what was expected next).
## In state 537, spurious reduction of production nsepseq(String,SEMI) -> String
## In state 548, spurious reduction of production sep_or_term_list(String,SEMI) -> nsepseq(String,SEMI)
## In state 538, spurious reduction of production nsepseq(String,SEMI) -> String
## In state 549, spurious reduction of production sep_or_term_list(String,SEMI) -> nsepseq(String,SEMI)
##
<YOUR SYNTAX ERROR MESSAGE HERE>
contract: Attributes String SEMI String SEMI With
##
## Ends in an error in state: 540.
## Ends in an error in state: 541.
##
## nsepseq(String,SEMI) -> String SEMI . nsepseq(String,SEMI) [ RBRACKET End ]
## seq(__anonymous_0(String,SEMI)) -> String SEMI . seq(__anonymous_0(String,SEMI)) [ RBRACKET End ]
@ -2666,7 +2666,7 @@ contract: Attributes String SEMI String SEMI With
contract: Attributes String SEMI String With
##
## Ends in an error in state: 539.
## Ends in an error in state: 540.
##
## nsepseq(String,SEMI) -> String . [ RBRACKET End ]
## nsepseq(String,SEMI) -> String . SEMI nsepseq(String,SEMI) [ RBRACKET End ]
@ -2680,7 +2680,7 @@ contract: Attributes String SEMI String With
contract: Attributes String SEMI With
##
## Ends in an error in state: 538.
## Ends in an error in state: 539.
##
## nsepseq(String,SEMI) -> String SEMI . nsepseq(String,SEMI) [ RBRACKET End ]
## nseq(__anonymous_0(String,SEMI)) -> String SEMI . seq(__anonymous_0(String,SEMI)) [ RBRACKET End ]
@ -2693,7 +2693,7 @@ contract: Attributes String SEMI With
contract: Attributes String With
##
## Ends in an error in state: 537.
## Ends in an error in state: 538.
##
## nsepseq(String,SEMI) -> String . [ RBRACKET End ]
## nsepseq(String,SEMI) -> String . SEMI nsepseq(String,SEMI) [ RBRACKET End ]
@ -2707,7 +2707,7 @@ contract: Attributes String With
contract: Attributes With
##
## Ends in an error in state: 536.
## Ends in an error in state: 537.
##
## ne_injection(Attributes,String) -> Attributes . sep_or_term_list(String,SEMI) End [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
## ne_injection(Attributes,String) -> Attributes . LBRACKET sep_or_term_list(String,SEMI) RBRACKET [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
@ -2720,12 +2720,12 @@ contract: Attributes With
contract: Const Ident COLON Ident VBAR
##
## Ends in an error in state: 491.
## Ends in an error in state: 492.
##
## unqualified_decl(EQ) -> Ident option(type_expr_colon) . EQ expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
## unqualified_decl(EQ) -> Ident option(type_annot) . EQ expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
##
## The known suffix of the stack is as follows:
## Ident option(type_expr_colon)
## Ident option(type_annot)
##
## WARNING: This example involves spurious reductions.
## This implies that, although the LR(1) items shown above provide an
@ -2735,8 +2735,8 @@ contract: Const Ident COLON Ident VBAR
## In state 30, spurious reduction of production cartesian -> core_type
## In state 36, spurious reduction of production fun_type -> cartesian
## In state 44, spurious reduction of production type_expr -> fun_type
## In state 88, spurious reduction of production type_expr_colon -> COLON type_expr
## In state 89, spurious reduction of production option(type_expr_colon) -> type_expr_colon
## In state 88, spurious reduction of production type_annot -> COLON type_expr
## In state 89, spurious reduction of production option(type_annot) -> type_annot
##
<YOUR SYNTAX ERROR MESSAGE HERE>
@ -2745,7 +2745,7 @@ contract: Const Ident COLON With
##
## Ends in an error in state: 87.
##
## type_expr_colon -> COLON . type_expr [ Is EQ ASS ]
## type_annot -> COLON . type_expr [ Is EQ ASS ]
##
## The known suffix of the stack is as follows:
## COLON
@ -2755,7 +2755,7 @@ contract: Const Ident COLON With
contract: Const Ident EQ Bytes VBAR
##
## Ends in an error in state: 585.
## Ends in an error in state: 586.
##
## const_decl -> open_const_decl . option(SEMI) [ Type Recursive Function EOF Const Attributes ]
##
@ -2776,29 +2776,29 @@ contract: Const Ident EQ Bytes VBAR
## In state 147, spurious reduction of production conj_expr -> set_membership
## In state 228, spurious reduction of production disj_expr -> conj_expr
## In state 196, spurious reduction of production expr -> disj_expr
## In state 493, spurious reduction of production unqualified_decl(EQ) -> Ident option(type_expr_colon) EQ expr
## In state 494, spurious reduction of production open_const_decl -> Const unqualified_decl(EQ)
## In state 494, spurious reduction of production unqualified_decl(EQ) -> Ident option(type_annot) EQ expr
## In state 495, spurious reduction of production open_const_decl -> Const unqualified_decl(EQ)
##
<YOUR SYNTAX ERROR MESSAGE HERE>
contract: Const Ident EQ With
##
## Ends in an error in state: 492.
## Ends in an error in state: 493.
##
## unqualified_decl(EQ) -> Ident option(type_expr_colon) EQ . expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
## unqualified_decl(EQ) -> Ident option(type_annot) EQ . expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
##
## The known suffix of the stack is as follows:
## Ident option(type_expr_colon) EQ
## Ident option(type_annot) EQ
##
<YOUR SYNTAX ERROR MESSAGE HERE>
contract: Const Ident With
##
## Ends in an error in state: 490.
## Ends in an error in state: 491.
##
## unqualified_decl(EQ) -> Ident . option(type_expr_colon) EQ expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
## unqualified_decl(EQ) -> Ident . option(type_annot) EQ expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
##
## The known suffix of the stack is as follows:
## Ident
@ -2808,7 +2808,7 @@ contract: Const Ident With
contract: Const With
##
## Ends in an error in state: 489.
## Ends in an error in state: 490.
##
## open_const_decl -> Const . unqualified_decl(EQ) [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
##
@ -2822,11 +2822,11 @@ contract: Function Ident LPAR Const Ident RPAR COLON Ident VBAR
##
## Ends in an error in state: 461.
##
## open_fun_decl -> Function Ident parameters option(type_expr_colon) . Is block With expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
## open_fun_decl -> Function Ident parameters option(type_expr_colon) . Is expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
## open_fun_decl -> Function Ident parameters option(type_annot) . Is block With expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
## open_fun_decl -> Function Ident parameters option(type_annot) . Is expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
##
## The known suffix of the stack is as follows:
## Function Ident parameters option(type_expr_colon)
## Function Ident parameters option(type_annot)
##
## WARNING: This example involves spurious reductions.
## This implies that, although the LR(1) items shown above provide an
@ -2836,15 +2836,15 @@ contract: Function Ident LPAR Const Ident RPAR COLON Ident VBAR
## In state 30, spurious reduction of production cartesian -> core_type
## In state 36, spurious reduction of production fun_type -> cartesian
## In state 44, spurious reduction of production type_expr -> fun_type
## In state 88, spurious reduction of production type_expr_colon -> COLON type_expr
## In state 89, spurious reduction of production option(type_expr_colon) -> type_expr_colon
## In state 88, spurious reduction of production type_annot -> COLON type_expr
## In state 89, spurious reduction of production option(type_annot) -> type_annot
##
<YOUR SYNTAX ERROR MESSAGE HERE>
contract: Function Ident LPAR Const Ident RPAR Is Begin Case Verbatim Of LBRACKET VBAR Block
##
## Ends in an error in state: 499.
## Ends in an error in state: 500.
##
## case(if_clause) -> Case expr Of LBRACKET option(VBAR) . cases(if_clause) RBRACKET [ VBAR SEMI RBRACKET RBRACE End Else ]
##
@ -2856,7 +2856,7 @@ contract: Function Ident LPAR Const Ident RPAR Is Begin Case Verbatim Of LBRACKE
contract: Function Ident LPAR Const Ident RPAR Is Begin Case Verbatim Of LBRACKET WILD ARROW Skip End
##
## Ends in an error in state: 528.
## Ends in an error in state: 529.
##
## case(if_clause) -> Case expr Of LBRACKET option(VBAR) cases(if_clause) . RBRACKET [ VBAR SEMI RBRACKET RBRACE End Else ]
##
@ -2867,15 +2867,15 @@ contract: Function Ident LPAR Const Ident RPAR Is Begin Case Verbatim Of LBRACKE
## This implies that, although the LR(1) items shown above provide an
## accurate view of the past (what has been recognized so far), they
## may provide an INCOMPLETE view of the future (what was expected next).
## In state 530, spurious reduction of production nsepseq(case_clause(if_clause),VBAR) -> case_clause(if_clause)
## In state 527, spurious reduction of production cases(if_clause) -> nsepseq(case_clause(if_clause),VBAR)
## In state 531, spurious reduction of production nsepseq(case_clause(if_clause),VBAR) -> case_clause(if_clause)
## In state 528, spurious reduction of production cases(if_clause) -> nsepseq(case_clause(if_clause),VBAR)
##
<YOUR SYNTAX ERROR MESSAGE HERE>
contract: Function Ident LPAR Const Ident RPAR Is Begin Case Verbatim Of LBRACKET With
##
## Ends in an error in state: 498.
## Ends in an error in state: 499.
##
## case(if_clause) -> Case expr Of LBRACKET . option(VBAR) cases(if_clause) RBRACKET [ VBAR SEMI RBRACKET RBRACE End Else ]
##
@ -2887,7 +2887,7 @@ contract: Function Ident LPAR Const Ident RPAR Is Begin Case Verbatim Of LBRACKE
contract: Function Ident LPAR Const Ident RPAR Is Begin Case Verbatim Of VBAR Block
##
## Ends in an error in state: 533.
## Ends in an error in state: 534.
##
## case(if_clause) -> Case expr Of option(VBAR) . cases(if_clause) End [ VBAR SEMI RBRACKET RBRACE End Else ]
##
@ -2899,7 +2899,7 @@ contract: Function Ident LPAR Const Ident RPAR Is Begin Case Verbatim Of VBAR Bl
contract: Function Ident LPAR Const Ident RPAR Is Begin Case Verbatim Of WILD ARROW Skip RBRACKET
##
## Ends in an error in state: 534.
## Ends in an error in state: 535.
##
## case(if_clause) -> Case expr Of option(VBAR) cases(if_clause) . End [ VBAR SEMI RBRACKET RBRACE End Else ]
##
@ -2910,15 +2910,15 @@ contract: Function Ident LPAR Const Ident RPAR Is Begin Case Verbatim Of WILD AR
## This implies that, although the LR(1) items shown above provide an
## accurate view of the past (what has been recognized so far), they
## may provide an INCOMPLETE view of the future (what was expected next).
## In state 530, spurious reduction of production nsepseq(case_clause(if_clause),VBAR) -> case_clause(if_clause)
## In state 527, spurious reduction of production cases(if_clause) -> nsepseq(case_clause(if_clause),VBAR)
## In state 531, spurious reduction of production nsepseq(case_clause(if_clause),VBAR) -> case_clause(if_clause)
## In state 528, spurious reduction of production cases(if_clause) -> nsepseq(case_clause(if_clause),VBAR)
##
<YOUR SYNTAX ERROR MESSAGE HERE>
contract: Function Ident LPAR Const Ident RPAR Is Begin Case Verbatim Of WILD ARROW Skip VBAR With
##
## Ends in an error in state: 531.
## Ends in an error in state: 532.
##
## nsepseq(case_clause(if_clause),VBAR) -> case_clause(if_clause) VBAR . nsepseq(case_clause(if_clause),VBAR) [ RBRACKET End ]
##
@ -2930,7 +2930,7 @@ contract: Function Ident LPAR Const Ident RPAR Is Begin Case Verbatim Of WILD AR
contract: Function Ident LPAR Const Ident RPAR Is Begin Case Verbatim Of WILD ARROW Skip With
##
## Ends in an error in state: 530.
## Ends in an error in state: 531.
##
## nsepseq(case_clause(if_clause),VBAR) -> case_clause(if_clause) . [ RBRACKET End ]
## nsepseq(case_clause(if_clause),VBAR) -> case_clause(if_clause) . VBAR nsepseq(case_clause(if_clause),VBAR) [ RBRACKET End ]
@ -2943,7 +2943,7 @@ contract: Function Ident LPAR Const Ident RPAR Is Begin Case Verbatim Of WILD AR
contract: Function Ident LPAR Const Ident RPAR Is Begin Case Verbatim Of WILD ARROW With
##
## Ends in an error in state: 501.
## Ends in an error in state: 502.
##
## case_clause(if_clause) -> pattern ARROW . if_clause [ VBAR RBRACKET End ]
##
@ -2955,7 +2955,7 @@ contract: Function Ident LPAR Const Ident RPAR Is Begin Case Verbatim Of WILD AR
contract: Function Ident LPAR Const Ident RPAR Is Begin Case Verbatim Of WILD RPAR
##
## Ends in an error in state: 500.
## Ends in an error in state: 501.
##
## case_clause(if_clause) -> pattern . ARROW if_clause [ VBAR RBRACKET End ]
##
@ -2973,7 +2973,7 @@ contract: Function Ident LPAR Const Ident RPAR Is Begin Case Verbatim Of WILD RP
contract: Function Ident LPAR Const Ident RPAR Is Begin Case Verbatim Of With
##
## Ends in an error in state: 497.
## Ends in an error in state: 498.
##
## case(if_clause) -> Case expr Of . option(VBAR) cases(if_clause) End [ VBAR SEMI RBRACKET RBRACE End Else ]
## case(if_clause) -> Case expr Of . LBRACKET option(VBAR) cases(if_clause) RBRACKET [ VBAR SEMI RBRACKET RBRACE End Else ]
@ -2986,7 +2986,7 @@ contract: Function Ident LPAR Const Ident RPAR Is Begin Case Verbatim Of With
contract: Function Ident LPAR Const Ident RPAR Is Begin Case Verbatim VBAR
##
## Ends in an error in state: 496.
## Ends in an error in state: 497.
##
## case(if_clause) -> Case expr . Of option(VBAR) cases(if_clause) End [ VBAR SEMI RBRACKET RBRACE End Else ]
## case(if_clause) -> Case expr . Of LBRACKET option(VBAR) cases(if_clause) RBRACKET [ VBAR SEMI RBRACKET RBRACE End Else ]
@ -3014,7 +3014,7 @@ contract: Function Ident LPAR Const Ident RPAR Is Begin Case Verbatim VBAR
contract: Function Ident LPAR Const Ident RPAR Is Begin Case With
##
## Ends in an error in state: 495.
## Ends in an error in state: 496.
##
## case(if_clause) -> Case . expr Of option(VBAR) cases(if_clause) End [ VBAR SEMI RBRACKET RBRACE End Else ]
## case(if_clause) -> Case . expr Of LBRACKET option(VBAR) cases(if_clause) RBRACKET [ VBAR SEMI RBRACKET RBRACE End Else ]
@ -3027,7 +3027,7 @@ contract: Function Ident LPAR Const Ident RPAR Is Begin Case With
contract: Function Ident LPAR Const Ident RPAR Is Begin Constr DOT And With
##
## Ends in an error in state: 508.
## Ends in an error in state: 509.
##
## fun_call -> module_field . arguments [ VBAR SEMI RBRACKET RBRACE End Else ]
##
@ -3039,7 +3039,7 @@ contract: Function Ident LPAR Const Ident RPAR Is Begin Constr DOT And With
contract: Function Ident LPAR Const Ident RPAR Is Begin Constr With
##
## Ends in an error in state: 488.
## Ends in an error in state: 489.
##
## module_field -> Constr . DOT module_fun [ LPAR ]
## projection -> Constr . DOT Ident DOT nsepseq(selection,DOT) [ LBRACKET ASS ]
@ -3052,7 +3052,7 @@ contract: Function Ident LPAR Const Ident RPAR Is Begin Constr With
contract: Function Ident LPAR Const Ident RPAR Is Begin For Ident ARROW Ident With
##
## Ends in an error in state: 479.
## Ends in an error in state: 480.
##
## for_loop -> For Ident option(arrow_clause) . In collection expr block [ VBAR SEMI RBRACKET RBRACE End Else ]
##
@ -3064,7 +3064,7 @@ contract: Function Ident LPAR Const Ident RPAR Is Begin For Ident ARROW Ident Wi
contract: Function Ident LPAR Const Ident RPAR Is Begin For Ident ARROW With
##
## Ends in an error in state: 477.
## Ends in an error in state: 478.
##
## arrow_clause -> ARROW . Ident [ In ]
##
@ -3076,12 +3076,12 @@ contract: Function Ident LPAR Const Ident RPAR Is Begin For Ident ARROW With
contract: Function Ident LPAR Const Ident RPAR Is Begin For Ident ASS Verbatim To Verbatim Step Verbatim VBAR
##
## Ends in an error in state: 474.
## Ends in an error in state: 476.
##
## for_loop -> For Ident ASS expr To expr Step expr . block [ VBAR SEMI RBRACKET RBRACE End Else ]
## for_loop -> For Ident ASS expr To expr option(step_clause) . block [ VBAR SEMI RBRACKET RBRACE End Else ]
##
## The known suffix of the stack is as follows:
## For Ident ASS expr To expr Step expr
## For Ident ASS expr To expr option(step_clause)
##
## WARNING: This example involves spurious reductions.
## This implies that, although the LR(1) items shown above provide an
@ -3097,6 +3097,8 @@ contract: Function Ident LPAR Const Ident RPAR Is Begin For Ident ASS Verbatim T
## In state 147, spurious reduction of production conj_expr -> set_membership
## In state 228, spurious reduction of production disj_expr -> conj_expr
## In state 196, spurious reduction of production expr -> disj_expr
## In state 474, spurious reduction of production step_clause -> Step expr
## In state 475, spurious reduction of production option(step_clause) -> step_clause
##
<YOUR SYNTAX ERROR MESSAGE HERE>
@ -3105,10 +3107,10 @@ contract: Function Ident LPAR Const Ident RPAR Is Begin For Ident ASS Verbatim T
##
## Ends in an error in state: 473.
##
## for_loop -> For Ident ASS expr To expr Step . expr block [ VBAR SEMI RBRACKET RBRACE End Else ]
## step_clause -> Step . expr [ Block Begin ]
##
## The known suffix of the stack is as follows:
## For Ident ASS expr To expr Step
## Step
##
<YOUR SYNTAX ERROR MESSAGE HERE>
@ -3117,8 +3119,7 @@ contract: Function Ident LPAR Const Ident RPAR Is Begin For Ident ASS Verbatim T
##
## Ends in an error in state: 472.
##
## for_loop -> For Ident ASS expr To expr . block [ VBAR SEMI RBRACKET RBRACE End Else ]
## for_loop -> For Ident ASS expr To expr . Step expr block [ VBAR SEMI RBRACKET RBRACE End Else ]
## for_loop -> For Ident ASS expr To expr . option(step_clause) block [ VBAR SEMI RBRACKET RBRACE End Else ]
##
## The known suffix of the stack is as follows:
## For Ident ASS expr To expr
@ -3145,8 +3146,7 @@ contract: Function Ident LPAR Const Ident RPAR Is Begin For Ident ASS Verbatim T
##
## Ends in an error in state: 471.
##
## for_loop -> For Ident ASS expr To . expr block [ VBAR SEMI RBRACKET RBRACE End Else ]
## for_loop -> For Ident ASS expr To . expr Step expr block [ VBAR SEMI RBRACKET RBRACE End Else ]
## for_loop -> For Ident ASS expr To . expr option(step_clause) block [ VBAR SEMI RBRACKET RBRACE End Else ]
##
## The known suffix of the stack is as follows:
## For Ident ASS expr To
@ -3158,8 +3158,7 @@ contract: Function Ident LPAR Const Ident RPAR Is Begin For Ident ASS Verbatim V
##
## Ends in an error in state: 470.
##
## for_loop -> For Ident ASS expr . To expr block [ VBAR SEMI RBRACKET RBRACE End Else ]
## for_loop -> For Ident ASS expr . To expr Step expr block [ VBAR SEMI RBRACKET RBRACE End Else ]
## for_loop -> For Ident ASS expr . To expr option(step_clause) block [ VBAR SEMI RBRACKET RBRACE End Else ]
##
## The known suffix of the stack is as follows:
## For Ident ASS expr
@ -3186,8 +3185,7 @@ contract: Function Ident LPAR Const Ident RPAR Is Begin For Ident ASS With
##
## Ends in an error in state: 469.
##
## for_loop -> For Ident ASS . expr To expr block [ VBAR SEMI RBRACKET RBRACE End Else ]
## for_loop -> For Ident ASS . expr To expr Step expr block [ VBAR SEMI RBRACKET RBRACE End Else ]
## for_loop -> For Ident ASS . expr To expr option(step_clause) block [ VBAR SEMI RBRACKET RBRACE End Else ]
##
## The known suffix of the stack is as follows:
## For Ident ASS
@ -3197,7 +3195,7 @@ contract: Function Ident LPAR Const Ident RPAR Is Begin For Ident ASS With
contract: Function Ident LPAR Const Ident RPAR Is Begin For Ident In Set Verbatim VBAR
##
## Ends in an error in state: 485.
## Ends in an error in state: 486.
##
## for_loop -> For Ident option(arrow_clause) In collection expr . block [ VBAR SEMI RBRACKET RBRACE End Else ]
##
@ -3224,7 +3222,7 @@ contract: Function Ident LPAR Const Ident RPAR Is Begin For Ident In Set Verbati
contract: Function Ident LPAR Const Ident RPAR Is Begin For Ident In Set With
##
## Ends in an error in state: 484.
## Ends in an error in state: 485.
##
## for_loop -> For Ident option(arrow_clause) In collection . expr block [ VBAR SEMI RBRACKET RBRACE End Else ]
##
@ -3236,7 +3234,7 @@ contract: Function Ident LPAR Const Ident RPAR Is Begin For Ident In Set With
contract: Function Ident LPAR Const Ident RPAR Is Begin For Ident In With
##
## Ends in an error in state: 480.
## Ends in an error in state: 481.
##
## for_loop -> For Ident option(arrow_clause) In . collection expr block [ VBAR SEMI RBRACKET RBRACE End Else ]
##
@ -3250,8 +3248,7 @@ contract: Function Ident LPAR Const Ident RPAR Is Begin For Ident With
##
## Ends in an error in state: 468.
##
## for_loop -> For Ident . ASS expr To expr block [ VBAR SEMI RBRACKET RBRACE End Else ]
## for_loop -> For Ident . ASS expr To expr Step expr block [ VBAR SEMI RBRACKET RBRACE End Else ]
## for_loop -> For Ident . ASS expr To expr option(step_clause) block [ VBAR SEMI RBRACKET RBRACE End Else ]
## for_loop -> For Ident . option(arrow_clause) In collection expr block [ VBAR SEMI RBRACKET RBRACE End Else ]
##
## The known suffix of the stack is as follows:
@ -3264,8 +3261,7 @@ contract: Function Ident LPAR Const Ident RPAR Is Begin For With
##
## Ends in an error in state: 467.
##
## for_loop -> For . Ident ASS expr To expr block [ VBAR SEMI RBRACKET RBRACE End Else ]
## for_loop -> For . Ident ASS expr To expr Step expr block [ VBAR SEMI RBRACKET RBRACE End Else ]
## for_loop -> For . Ident ASS expr To expr option(step_clause) block [ VBAR SEMI RBRACKET RBRACE End Else ]
## for_loop -> For . Ident option(arrow_clause) In collection expr block [ VBAR SEMI RBRACKET RBRACE End Else ]
##
## The known suffix of the stack is as follows:
@ -3276,7 +3272,7 @@ contract: Function Ident LPAR Const Ident RPAR Is Begin For With
contract: Function Ident LPAR Const Ident RPAR Is Begin Ident ASS With
##
## Ends in an error in state: 514.
## Ends in an error in state: 515.
##
## assignment -> lhs ASS . rhs [ VBAR SEMI RBRACKET RBRACE End Else ]
##
@ -3288,7 +3284,7 @@ contract: Function Ident LPAR Const Ident RPAR Is Begin Ident ASS With
contract: Function Ident LPAR Const Ident RPAR Is Begin Ident DOT Ident With
##
## Ends in an error in state: 507.
## Ends in an error in state: 508.
##
## lhs -> path . [ ASS ]
## map_lookup -> path . brackets(expr) [ ASS ]
@ -3309,7 +3305,7 @@ contract: Function Ident LPAR Const Ident RPAR Is Begin Ident DOT Ident With
contract: Function Ident LPAR Const Ident RPAR Is Begin Ident LBRACKET Bytes RBRACKET With
##
## Ends in an error in state: 513.
## Ends in an error in state: 514.
##
## assignment -> lhs . ASS rhs [ VBAR SEMI RBRACKET RBRACE End Else ]
##
@ -3335,7 +3331,7 @@ contract: Function Ident LPAR Const Ident RPAR Is Begin Ident With
contract: Function Ident LPAR Const Ident RPAR Is Begin If Verbatim Then LBRACE Skip End
##
## Ends in an error in state: 565.
## Ends in an error in state: 566.
##
## clause_block -> LBRACE sep_or_term_list(statement,SEMI) . RBRACE [ VBAR SEMI RBRACKET RBRACE End Else ]
##
@ -3346,8 +3342,8 @@ contract: Function Ident LPAR Const Ident RPAR Is Begin If Verbatim Then LBRACE
## This implies that, although the LR(1) items shown above provide an
## accurate view of the past (what has been recognized so far), they
## may provide an INCOMPLETE view of the future (what was expected next).
## In state 551, spurious reduction of production nsepseq(statement,SEMI) -> statement
## In state 568, spurious reduction of production sep_or_term_list(statement,SEMI) -> nsepseq(statement,SEMI)
## In state 552, spurious reduction of production nsepseq(statement,SEMI) -> statement
## In state 569, spurious reduction of production sep_or_term_list(statement,SEMI) -> nsepseq(statement,SEMI)
##
<YOUR SYNTAX ERROR MESSAGE HERE>
@ -3366,7 +3362,7 @@ contract: Function Ident LPAR Const Ident RPAR Is Begin If Verbatim Then LBRACE
contract: Function Ident LPAR Const Ident RPAR Is Begin If Verbatim Then Skip Else With
##
## Ends in an error in state: 571.
## Ends in an error in state: 572.
##
## conditional -> If expr Then if_clause option(SEMI) Else . if_clause [ VBAR SEMI RBRACKET RBRACE End Else ]
##
@ -3378,7 +3374,7 @@ contract: Function Ident LPAR Const Ident RPAR Is Begin If Verbatim Then Skip El
contract: Function Ident LPAR Const Ident RPAR Is Begin If Verbatim Then Skip SEMI EQ
##
## Ends in an error in state: 570.
## Ends in an error in state: 571.
##
## conditional -> If expr Then if_clause option(SEMI) . Else if_clause [ VBAR SEMI RBRACKET RBRACE End Else ]
##
@ -3390,7 +3386,7 @@ contract: Function Ident LPAR Const Ident RPAR Is Begin If Verbatim Then Skip SE
contract: Function Ident LPAR Const Ident RPAR Is Begin If Verbatim Then Skip With
##
## Ends in an error in state: 569.
## Ends in an error in state: 570.
##
## conditional -> If expr Then if_clause . option(SEMI) Else if_clause [ VBAR SEMI RBRACKET RBRACE End Else ]
##
@ -3834,10 +3830,10 @@ contract: Function Ident LPAR Const Ident RPAR Is Begin Skip End While
##
## Ends in an error in state: 464.
##
## open_fun_decl -> Function Ident parameters option(type_expr_colon) Is block . With expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
## open_fun_decl -> Function Ident parameters option(type_annot) Is block . With expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
##
## The known suffix of the stack is as follows:
## Function Ident parameters option(type_expr_colon) Is block
## Function Ident parameters option(type_annot) Is block
##
<YOUR SYNTAX ERROR MESSAGE HERE>
@ -3846,17 +3842,17 @@ contract: Function Ident LPAR Const Ident RPAR Is Begin Skip End With With
##
## Ends in an error in state: 465.
##
## open_fun_decl -> Function Ident parameters option(type_expr_colon) Is block With . expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
## open_fun_decl -> Function Ident parameters option(type_annot) Is block With . expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
##
## The known suffix of the stack is as follows:
## Function Ident parameters option(type_expr_colon) Is block With
## Function Ident parameters option(type_annot) Is block With
##
<YOUR SYNTAX ERROR MESSAGE HERE>
contract: Function Ident LPAR Const Ident RPAR Is Begin Skip RBRACE
##
## Ends in an error in state: 573.
## Ends in an error in state: 574.
##
## block -> Begin sep_or_term_list(statement,SEMI) . End [ With VBAR SEMI RBRACKET RBRACE End Else ]
##
@ -3867,15 +3863,15 @@ contract: Function Ident LPAR Const Ident RPAR Is Begin Skip RBRACE
## This implies that, although the LR(1) items shown above provide an
## accurate view of the past (what has been recognized so far), they
## may provide an INCOMPLETE view of the future (what was expected next).
## In state 551, spurious reduction of production nsepseq(statement,SEMI) -> statement
## In state 568, spurious reduction of production sep_or_term_list(statement,SEMI) -> nsepseq(statement,SEMI)
## In state 552, spurious reduction of production nsepseq(statement,SEMI) -> statement
## In state 569, spurious reduction of production sep_or_term_list(statement,SEMI) -> nsepseq(statement,SEMI)
##
<YOUR SYNTAX ERROR MESSAGE HERE>
contract: Function Ident LPAR Const Ident RPAR Is Begin Skip SEMI Skip SEMI With
##
## Ends in an error in state: 554.
## Ends in an error in state: 555.
##
## nsepseq(statement,SEMI) -> statement SEMI . nsepseq(statement,SEMI) [ RBRACE End ]
## seq(__anonymous_0(statement,SEMI)) -> statement SEMI . seq(__anonymous_0(statement,SEMI)) [ RBRACE End ]
@ -3888,7 +3884,7 @@ contract: Function Ident LPAR Const Ident RPAR Is Begin Skip SEMI Skip SEMI With
contract: Function Ident LPAR Const Ident RPAR Is Begin Skip SEMI Skip With
##
## Ends in an error in state: 553.
## Ends in an error in state: 554.
##
## nsepseq(statement,SEMI) -> statement . [ RBRACE End ]
## nsepseq(statement,SEMI) -> statement . SEMI nsepseq(statement,SEMI) [ RBRACE End ]
@ -3902,7 +3898,7 @@ contract: Function Ident LPAR Const Ident RPAR Is Begin Skip SEMI Skip With
contract: Function Ident LPAR Const Ident RPAR Is Begin Skip SEMI With
##
## Ends in an error in state: 552.
## Ends in an error in state: 553.
##
## nsepseq(statement,SEMI) -> statement SEMI . nsepseq(statement,SEMI) [ RBRACE End ]
## nseq(__anonymous_0(statement,SEMI)) -> statement SEMI . seq(__anonymous_0(statement,SEMI)) [ RBRACE End ]
@ -3915,7 +3911,7 @@ contract: Function Ident LPAR Const Ident RPAR Is Begin Skip SEMI With
contract: Function Ident LPAR Const Ident RPAR Is Begin Skip With
##
## Ends in an error in state: 551.
## Ends in an error in state: 552.
##
## nsepseq(statement,SEMI) -> statement . [ RBRACE End ]
## nsepseq(statement,SEMI) -> statement . SEMI nsepseq(statement,SEMI) [ RBRACE End ]
@ -3931,10 +3927,10 @@ contract: Function Ident LPAR Const Ident RPAR Is Begin Var Ident ASS With
##
## Ends in an error in state: 418.
##
## unqualified_decl(ASS) -> Ident option(type_expr_colon) ASS . expr [ SEMI RBRACE End ]
## unqualified_decl(ASS) -> Ident option(type_annot) ASS . expr [ SEMI RBRACE End ]
##
## The known suffix of the stack is as follows:
## Ident option(type_expr_colon) ASS
## Ident option(type_annot) ASS
##
<YOUR SYNTAX ERROR MESSAGE HERE>
@ -3943,10 +3939,10 @@ contract: Function Ident LPAR Const Ident RPAR Is Begin Var Ident COLON Ident VB
##
## Ends in an error in state: 417.
##
## unqualified_decl(ASS) -> Ident option(type_expr_colon) . ASS expr [ SEMI RBRACE End ]
## unqualified_decl(ASS) -> Ident option(type_annot) . ASS expr [ SEMI RBRACE End ]
##
## The known suffix of the stack is as follows:
## Ident option(type_expr_colon)
## Ident option(type_annot)
##
## WARNING: This example involves spurious reductions.
## This implies that, although the LR(1) items shown above provide an
@ -3956,8 +3952,8 @@ contract: Function Ident LPAR Const Ident RPAR Is Begin Var Ident COLON Ident VB
## In state 30, spurious reduction of production cartesian -> core_type
## In state 36, spurious reduction of production fun_type -> cartesian
## In state 44, spurious reduction of production type_expr -> fun_type
## In state 88, spurious reduction of production type_expr_colon -> COLON type_expr
## In state 89, spurious reduction of production option(type_expr_colon) -> type_expr_colon
## In state 88, spurious reduction of production type_annot -> COLON type_expr
## In state 89, spurious reduction of production option(type_annot) -> type_annot
##
<YOUR SYNTAX ERROR MESSAGE HERE>
@ -3966,7 +3962,7 @@ contract: Function Ident LPAR Const Ident RPAR Is Begin Var Ident With
##
## Ends in an error in state: 416.
##
## unqualified_decl(ASS) -> Ident . option(type_expr_colon) ASS expr [ SEMI RBRACE End ]
## unqualified_decl(ASS) -> Ident . option(type_annot) ASS expr [ SEMI RBRACE End ]
##
## The known suffix of the stack is as follows:
## Ident
@ -4039,7 +4035,7 @@ contract: Function Ident LPAR Const Ident RPAR Is Begin With
contract: Function Ident LPAR Const Ident RPAR Is Block LBRACE Skip End
##
## Ends in an error in state: 576.
## Ends in an error in state: 577.
##
## block -> Block LBRACE sep_or_term_list(statement,SEMI) . RBRACE [ With VBAR SEMI RBRACKET RBRACE End Else ]
##
@ -4050,8 +4046,8 @@ contract: Function Ident LPAR Const Ident RPAR Is Block LBRACE Skip End
## This implies that, although the LR(1) items shown above provide an
## accurate view of the past (what has been recognized so far), they
## may provide an INCOMPLETE view of the future (what was expected next).
## In state 551, spurious reduction of production nsepseq(statement,SEMI) -> statement
## In state 568, spurious reduction of production sep_or_term_list(statement,SEMI) -> nsepseq(statement,SEMI)
## In state 552, spurious reduction of production nsepseq(statement,SEMI) -> statement
## In state 569, spurious reduction of production sep_or_term_list(statement,SEMI) -> nsepseq(statement,SEMI)
##
<YOUR SYNTAX ERROR MESSAGE HERE>
@ -4082,7 +4078,7 @@ contract: Function Ident LPAR Const Ident RPAR Is Block With
contract: Function Ident LPAR Const Ident RPAR Is Bytes VBAR
##
## Ends in an error in state: 583.
## Ends in an error in state: 584.
##
## fun_decl -> open_fun_decl . option(SEMI) [ Type Recursive Function EOF Const Attributes ]
##
@ -4103,7 +4099,7 @@ contract: Function Ident LPAR Const Ident RPAR Is Bytes VBAR
## In state 147, spurious reduction of production conj_expr -> set_membership
## In state 228, spurious reduction of production disj_expr -> conj_expr
## In state 196, spurious reduction of production expr -> disj_expr
## In state 463, spurious reduction of production open_fun_decl -> Function Ident parameters option(type_expr_colon) Is expr
## In state 463, spurious reduction of production open_fun_decl -> Function Ident parameters option(type_annot) Is expr
##
<YOUR SYNTAX ERROR MESSAGE HERE>
@ -4112,11 +4108,11 @@ contract: Function Ident LPAR Const Ident RPAR Is With
##
## Ends in an error in state: 462.
##
## open_fun_decl -> Function Ident parameters option(type_expr_colon) Is . block With expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
## open_fun_decl -> Function Ident parameters option(type_expr_colon) Is . expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
## open_fun_decl -> Function Ident parameters option(type_annot) Is . block With expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
## open_fun_decl -> Function Ident parameters option(type_annot) Is . expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
##
## The known suffix of the stack is as follows:
## Function Ident parameters option(type_expr_colon) Is
## Function Ident parameters option(type_annot) Is
##
<YOUR SYNTAX ERROR MESSAGE HERE>
@ -4125,8 +4121,8 @@ contract: Function Ident LPAR Const Ident RPAR With
##
## Ends in an error in state: 460.
##
## open_fun_decl -> Function Ident parameters . option(type_expr_colon) Is block With expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
## open_fun_decl -> Function Ident parameters . option(type_expr_colon) Is expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
## open_fun_decl -> Function Ident parameters . option(type_annot) Is block With expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
## open_fun_decl -> Function Ident parameters . option(type_annot) Is expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
##
## The known suffix of the stack is as follows:
## Function Ident parameters
@ -4138,8 +4134,8 @@ contract: Function Ident With
##
## Ends in an error in state: 459.
##
## open_fun_decl -> Function Ident . parameters option(type_expr_colon) Is block With expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
## open_fun_decl -> Function Ident . parameters option(type_expr_colon) Is expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
## open_fun_decl -> Function Ident . parameters option(type_annot) Is block With expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
## open_fun_decl -> Function Ident . parameters option(type_annot) Is expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
##
## The known suffix of the stack is as follows:
## Function Ident
@ -4151,8 +4147,8 @@ contract: Function With
##
## Ends in an error in state: 458.
##
## open_fun_decl -> Function . Ident parameters option(type_expr_colon) Is block With expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
## open_fun_decl -> Function . Ident parameters option(type_expr_colon) Is expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
## open_fun_decl -> Function . Ident parameters option(type_annot) Is block With expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
## open_fun_decl -> Function . Ident parameters option(type_annot) Is expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
##
## The known suffix of the stack is as follows:
## Function
@ -4164,11 +4160,11 @@ contract: Recursive Function Ident LPAR Const Ident RPAR COLON String VBAR
##
## Ends in an error in state: 90.
##
## open_fun_decl -> Recursive Function Ident parameters option(type_expr_colon) . Is block With expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
## open_fun_decl -> Recursive Function Ident parameters option(type_expr_colon) . Is expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
## open_fun_decl -> Recursive Function Ident parameters option(type_annot) . Is block With expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
## open_fun_decl -> Recursive Function Ident parameters option(type_annot) . Is expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
##
## The known suffix of the stack is as follows:
## Recursive Function Ident parameters option(type_expr_colon)
## Recursive Function Ident parameters option(type_annot)
##
## WARNING: This example involves spurious reductions.
## This implies that, although the LR(1) items shown above provide an
@ -4177,32 +4173,32 @@ contract: Recursive Function Ident LPAR Const Ident RPAR COLON String VBAR
## In state 30, spurious reduction of production cartesian -> core_type
## In state 36, spurious reduction of production fun_type -> cartesian
## In state 44, spurious reduction of production type_expr -> fun_type
## In state 88, spurious reduction of production type_expr_colon -> COLON type_expr
## In state 89, spurious reduction of production option(type_expr_colon) -> type_expr_colon
## In state 88, spurious reduction of production type_annot -> COLON type_expr
## In state 89, spurious reduction of production option(type_annot) -> type_annot
##
<YOUR SYNTAX ERROR MESSAGE HERE>
contract: Recursive Function Ident LPAR Const Ident RPAR Is Begin Skip End While
##
## Ends in an error in state: 579.
## Ends in an error in state: 580.
##
## open_fun_decl -> Recursive Function Ident parameters option(type_expr_colon) Is block . With expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
## open_fun_decl -> Recursive Function Ident parameters option(type_annot) Is block . With expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
##
## The known suffix of the stack is as follows:
## Recursive Function Ident parameters option(type_expr_colon) Is block
## Recursive Function Ident parameters option(type_annot) Is block
##
<YOUR SYNTAX ERROR MESSAGE HERE>
contract: Recursive Function Ident LPAR Const Ident RPAR Is Begin Skip End With With
##
## Ends in an error in state: 580.
## Ends in an error in state: 581.
##
## open_fun_decl -> Recursive Function Ident parameters option(type_expr_colon) Is block With . expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
## open_fun_decl -> Recursive Function Ident parameters option(type_annot) Is block With . expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
##
## The known suffix of the stack is as follows:
## Recursive Function Ident parameters option(type_expr_colon) Is block With
## Recursive Function Ident parameters option(type_annot) Is block With
##
<YOUR SYNTAX ERROR MESSAGE HERE>
@ -4211,11 +4207,11 @@ contract: Recursive Function Ident LPAR Const Ident RPAR Is With
##
## Ends in an error in state: 91.
##
## open_fun_decl -> Recursive Function Ident parameters option(type_expr_colon) Is . block With expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
## open_fun_decl -> Recursive Function Ident parameters option(type_expr_colon) Is . expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
## open_fun_decl -> Recursive Function Ident parameters option(type_annot) Is . block With expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
## open_fun_decl -> Recursive Function Ident parameters option(type_annot) Is . expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
##
## The known suffix of the stack is as follows:
## Recursive Function Ident parameters option(type_expr_colon) Is
## Recursive Function Ident parameters option(type_annot) Is
##
<YOUR SYNTAX ERROR MESSAGE HERE>
@ -4224,8 +4220,8 @@ contract: Recursive Function Ident LPAR Const Ident RPAR With
##
## Ends in an error in state: 86.
##
## open_fun_decl -> Recursive Function Ident parameters . option(type_expr_colon) Is block With expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
## open_fun_decl -> Recursive Function Ident parameters . option(type_expr_colon) Is expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
## open_fun_decl -> Recursive Function Ident parameters . option(type_annot) Is block With expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
## open_fun_decl -> Recursive Function Ident parameters . option(type_annot) Is expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
##
## The known suffix of the stack is as follows:
## Recursive Function Ident parameters
@ -4237,8 +4233,8 @@ contract: Recursive Function Ident With
##
## Ends in an error in state: 70.
##
## open_fun_decl -> Recursive Function Ident . parameters option(type_expr_colon) Is block With expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
## open_fun_decl -> Recursive Function Ident . parameters option(type_expr_colon) Is expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
## open_fun_decl -> Recursive Function Ident . parameters option(type_annot) Is block With expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
## open_fun_decl -> Recursive Function Ident . parameters option(type_annot) Is expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
##
## The known suffix of the stack is as follows:
## Recursive Function Ident
@ -4250,8 +4246,8 @@ contract: Recursive Function With
##
## Ends in an error in state: 69.
##
## open_fun_decl -> Recursive Function . Ident parameters option(type_expr_colon) Is block With expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
## open_fun_decl -> Recursive Function . Ident parameters option(type_expr_colon) Is expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
## open_fun_decl -> Recursive Function . Ident parameters option(type_annot) Is block With expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
## open_fun_decl -> Recursive Function . Ident parameters option(type_annot) Is expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
##
## The known suffix of the stack is as follows:
## Recursive Function
@ -4263,8 +4259,8 @@ contract: Recursive With
##
## Ends in an error in state: 68.
##
## open_fun_decl -> Recursive . Function Ident parameters option(type_expr_colon) Is block With expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
## open_fun_decl -> Recursive . Function Ident parameters option(type_expr_colon) Is expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
## open_fun_decl -> Recursive . Function Ident parameters option(type_annot) Is block With expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
## open_fun_decl -> Recursive . Function Ident parameters option(type_annot) Is expr [ Type SEMI Recursive RBRACE Function End EOF Const Attributes ]
##
## The known suffix of the stack is as follows:
## Recursive

View File

@ -438,13 +438,13 @@ and scan state = parse
(* String *)
| '"' { let opening, _, state = state#sync lexbuf in
let thread = LexerLib.mk_thread opening "" in
scan_string thread state lexbuf |> mk_string }
| '"' { let opening, _, state = state#sync lexbuf in
let thread = LexerLib.mk_thread opening in
scan_string thread state lexbuf |> mk_string }
| "{|" { let opening, _, state = state#sync lexbuf in
let thread = LexerLib.mk_thread opening "" in
scan_verbatim thread state lexbuf |> mk_verbatim }
let thread = LexerLib.mk_thread opening in
scan_verbatim thread state lexbuf |> mk_verbatim }
(* Comments *)
@ -453,33 +453,28 @@ and scan state = parse
match state#block with
Some block when block#opening = lexeme ->
let opening, _, state = state#sync lexbuf in
let thread = LexerLib.mk_thread opening lexeme in
let thread, state = scan_block block thread state lexbuf in
let state = state#push_block thread
in scan state lexbuf
| Some _ | None ->
let n = String.length lexeme in
begin
LexerLib.rollback lexbuf;
assert (n > 0);
scan (scan_n_sym n state lexbuf) lexbuf
end }
let thread = LexerLib.mk_thread opening in
let thread = thread#push_string lexeme in
let thread, state = scan_block block thread state lexbuf
in scan (state#push_block thread) lexbuf
| Some _ | None -> (* Not a comment for this LIGO syntax *)
let n = String.length lexeme in
let () = LexerLib.rollback lexbuf in
scan (scan_n_sym n state lexbuf) lexbuf }
| line_comments {
let lexeme = Lexing.lexeme lexbuf in
match state#line with
Some line when line = lexeme ->
let opening, _, state = state#sync lexbuf in
let thread = LexerLib.mk_thread opening lexeme in
let thread, state = scan_line thread state lexbuf in
let state = state#push_line thread
in scan state lexbuf
| Some _ | None ->
let n = String.length lexeme in
begin
LexerLib.rollback lexbuf;
scan (scan_n_sym n state lexbuf) lexbuf
end }
let thread = LexerLib.mk_thread opening in
let thread = thread#push_string lexeme in
let thread, state = scan_line thread state lexbuf
in scan (state#push_line thread) lexbuf
| Some _ | None -> (* Not a comment for this LIGO syntax *)
let n = String.length lexeme in
let () = LexerLib.rollback lexbuf in
scan (scan_n_sym n state lexbuf) lexbuf }
| _ as c { let region, _, _ = state#sync lexbuf
in fail region (Unexpected_character c) }
@ -488,8 +483,7 @@ and scan state = parse
and scan_n_sym n state = parse
symbol { let state = mk_sym state lexbuf in
if n = 1 then state
else scan_n_sym (n-1) state lexbuf }
if n = 1 then state else scan_n_sym (n-1) state lexbuf }
(* Scanning #include flag *)
@ -552,7 +546,6 @@ and scan_block block thread state = parse
in scan_block block thread state lexbuf
else let () = LexerLib.rollback lexbuf in
let n = String.length lexeme in
let () = assert (n > 0) in
let state = scan_n_sym n state lexbuf
in scan_block block thread state lexbuf }
@ -563,7 +556,6 @@ and scan_block block thread state = parse
in thread#push_string lexeme, state
else let () = LexerLib.rollback lexbuf in
let n = String.length lexeme in
let () = assert (n > 0) in
let state = scan_n_sym n state lexbuf
in scan_block block thread state lexbuf }
@ -588,27 +580,6 @@ and scan_block block thread state = parse
let region = Region.make ~start:state#pos ~stop:pos
in fail region error }
(* Finishing a line comment *)
and scan_line thread state = parse
nl as nl { let () = Lexing.new_line lexbuf
and thread = thread#push_string nl
and state = state#set_pos (state#pos#new_line nl)
in thread, state }
| eof { thread, state }
| _ { let () = LexerLib.rollback lexbuf in
let len = thread#length in
let thread,
status = scan_utf8_inline thread state lexbuf in
let delta = thread#length - len in
let pos = state#pos#shift_one_uchar delta in
match status with
Stdlib.Ok () ->
scan_line thread (state#set_pos pos) lexbuf
| Error error ->
let region = Region.make ~start:state#pos ~stop:pos
in fail region error }
and scan_utf8 block thread state = parse
eof { let err = Unterminated_comment block#closing
in fail thread#opening err }
@ -621,6 +592,27 @@ and scan_utf8 block thread state = parse
| `Await -> scan_utf8 block thread state lexbuf
| `End -> assert false }
(* Finishing a line comment *)
and scan_line thread state = parse
nl as nl { let () = Lexing.new_line lexbuf
and thread = thread#push_string nl
and state = state#set_pos (state#pos#new_line nl)
in thread, state }
| eof { thread, state }
| _ { let () = LexerLib.rollback lexbuf in
let len = thread#length in
let thread,
status = scan_utf8_inline thread state lexbuf in
let delta = thread#length - len in
let pos = state#pos#shift_one_uchar delta in
match status with
Stdlib.Ok () ->
scan_line thread (state#set_pos pos) lexbuf
| Error error ->
let region = Region.make ~start:state#pos ~stop:pos
in fail region error }
and scan_utf8_inline thread state = parse
eof { thread, Stdlib.Ok () }
| _ as c { let thread = thread#push_char c in

View File

@ -69,7 +69,7 @@ type thread = <
set_opening : Region.t -> thread
>
let mk_thread region lexeme : thread =
let mk_thread region : thread =
(* The call [explode s a] is the list made by pushing the characters
in the string [s] on top of [a], in reverse order. For example,
[explode "ba" ['c';'d'] = ['a'; 'b'; 'c'; 'd']]. *)
@ -83,10 +83,10 @@ let mk_thread region lexeme : thread =
val opening = region
method opening = opening
val length = String.length lexeme
val length = 0
method length = length
val acc = explode lexeme []
val acc = []
method acc = acc
method set_opening opening = {< opening; length; acc >}
@ -100,10 +100,10 @@ let mk_thread region lexeme : thread =
acc = explode str acc >}
(* The value of [thread#to_string] is a string of length
[thread#length] containing the [thread#length] characters in
the list [thread#acc], in reverse order. For instance,
[thread#to_string = "abc"] if [thread#length = 3] and
[thread#acc = ['c';'b';'a']]. *)
[thread#length] containing the characters in the list
[thread#acc], in reverse order. For instance, [thread#to_string
= "abc"] if [thread#length = 3] and [thread#acc =
['c';'b';'a']]. *)
method to_string =
let bytes = Bytes.make length ' ' in
@ -159,15 +159,16 @@ type 'token window =
| Two of 'token * 'token
type 'token state = <
units : (Markup.t list * 'token) FQueue.t;
markup : Markup.t list;
window : 'token window;
last : Region.t;
pos : Pos.t;
decoder : Uutf.decoder;
supply : Bytes.t -> int -> int -> unit;
block : EvalOpt.block_comment option;
line : EvalOpt.line_comment option;
units : (Markup.t list * 'token) FQueue.t;
markup : Markup.t list;
comments : Markup.comment FQueue.t;
window : 'token window;
last : Region.t;
pos : Pos.t;
decoder : Uutf.decoder;
supply : Bytes.t -> int -> int -> unit;
block : EvalOpt.block_comment option;
line : EvalOpt.line_comment option;
enqueue : 'token -> 'token state;
set_units : (Markup.t list * 'token) FQueue.t -> 'token state;
@ -184,25 +185,28 @@ type 'token state = <
push_tabs : Lexing.lexbuf -> 'token state;
push_bom : Lexing.lexbuf -> 'token state;
push_markup : Markup.t -> 'token state;
push_comment : Markup.comment -> 'token state
>
let mk_state ~units ~markup ~window ~last ~pos ~decoder ~supply
let mk_state ~units ~markup ~comments ~window ~last ~pos ~decoder ~supply
?block ?line () : _ state =
object (self)
val units = units
method units = units
val markup = markup
method markup = markup
val window = window
method window = window
val last = last
method last = last
val pos = pos
method pos = pos
method decoder = decoder
method supply = supply
method block = block
method line = line
val units = units
method units = units
val markup = markup
method markup = markup
val comments = comments
method comments = comments
val window = window
method window = window
val last = last
method last = last
val pos = pos
method pos = pos
method decoder = decoder
method supply = supply
method block = block
method line = line
method enqueue token =
{< units = FQueue.enq (markup, token) units;
@ -229,6 +233,9 @@ let mk_state ~units ~markup ~window ~last ~pos ~decoder ~supply
(* Committing markup to the current logical state *)
method push_comment comment =
{< comments = FQueue.enq comment comments >}
method push_markup unit = {< markup = unit :: markup >}
method push_newline buffer =
@ -238,21 +245,23 @@ let mk_state ~units ~markup ~window ~last ~pos ~decoder ~supply
let stop = start#new_line value in
let region = Region.make ~start ~stop in
let unit = Markup.Newline Region.{region; value}
in {< pos = stop; markup = unit::markup >}
in (self#push_markup unit)#set_pos stop
method push_line thread =
let start = thread#opening#start in
let region = Region.make ~start ~stop:self#pos
and value = thread#to_string in
let unit = Markup.LineCom Region.{region; value}
in {< markup = unit::markup >}
let reg = Region.{region; value} in
let unit = Markup.LineCom reg
in (self#push_markup unit)#push_comment (Markup.Line reg)
method push_block thread =
let start = thread#opening#start in
let region = Region.make ~start ~stop:self#pos
and value = thread#to_string in
let unit = Markup.BlockCom Region.{region; value}
in {< markup = unit::markup >}
let reg = Region.{region; value} in
let unit = Markup.BlockCom reg
in (self#push_markup unit)#push_comment (Markup.Block reg)
method push_space buffer =
let region, lex, state = self#sync buffer in
@ -283,14 +292,15 @@ type input =
type 'token logger = Markup.t list -> 'token -> unit
type 'token instance = {
input : input;
read : log:('token logger) -> Lexing.lexbuf -> 'token;
buffer : Lexing.lexbuf;
get_win : unit -> 'token window;
get_pos : unit -> Pos.t;
get_last : unit -> Region.t;
get_file : unit -> file_path;
close : unit -> unit
input : input;
read : log:('token logger) -> Lexing.lexbuf -> 'token;
buffer : Lexing.lexbuf;
close : unit -> unit;
get_win : unit -> 'token window;
get_pos : unit -> Pos.t;
get_last : unit -> Region.t;
get_file : unit -> file_path;
get_comments : unit -> Markup.comment FQueue.t
}
type open_err = File_opening of string
@ -329,15 +339,18 @@ let open_token_stream ?line ?block ~scan
~window:Nil
~pos
~markup:[]
~comments:FQueue.empty
~decoder
~supply
?block
?line
()) in
let get_pos () = !state#pos
and get_last () = !state#last
and get_win () = !state#window
and get_file () = file_path in
let get_pos () = !state#pos
and get_last () = !state#last
and get_win () = !state#window
and get_comments () = !state#comments
and get_file () = file_path in
let patch_buffer (start, stop) buffer =
let open Lexing in
@ -368,8 +381,8 @@ let open_token_stream ?line ?block ~scan
| Some (units, (left_mark, token)) ->
log left_mark token;
state := ((!state#set_units units)
#set_last (token_to_region token))
#slide_token token;
#set_last (token_to_region token))
#slide_token token;
style token (next_token scan) buffer;
patch_buffer (token_to_region token)#byte_pos buffer;
token in
@ -382,6 +395,7 @@ let open_token_stream ?line ?block ~scan
| _ -> () in
let instance = {
read = read scan ~token_to_region ~style;
input; buffer; get_win; get_pos; get_last; get_file; close}
input; buffer; close;
get_win; get_pos; get_last; get_file; get_comments}
in Ok instance
| Error _ as e -> e

View File

@ -39,7 +39,7 @@ type thread = <
set_opening : Region.t -> thread
>
val mk_thread : Region.t -> lexeme -> thread
val mk_thread : Region.t -> thread
(* STATE *)
@ -108,15 +108,16 @@ type 'token window =
| Two of 'token * 'token
type 'token state = <
units : (Markup.t list * 'token) FQueue.t;
markup : Markup.t list;
window : 'token window;
last : Region.t;
pos : Pos.t;
decoder : Uutf.decoder;
supply : Bytes.t -> int -> int -> unit;
block : EvalOpt.block_comment option;
line : EvalOpt.line_comment option;
units : (Markup.t list * 'token) FQueue.t;
markup : Markup.t list;
comments : Markup.comment FQueue.t;
window : 'token window;
last : Region.t;
pos : Pos.t;
decoder : Uutf.decoder;
supply : Bytes.t -> int -> int -> unit;
block : EvalOpt.block_comment option;
line : EvalOpt.line_comment option;
enqueue : 'token -> 'token state;
set_units : (Markup.t list * 'token) FQueue.t -> 'token state;
@ -133,6 +134,7 @@ type 'token state = <
push_tabs : Lexing.lexbuf -> 'token state;
push_bom : Lexing.lexbuf -> 'token state;
push_markup : Markup.t -> 'token state;
push_comment : Markup.comment -> 'token state
>
(* LEXER INSTANCE *)
@ -178,11 +180,12 @@ type 'token instance = {
input : input;
read : log:('token logger) -> Lexing.lexbuf -> 'token;
buffer : Lexing.lexbuf;
close : unit -> unit;
get_win : unit -> 'token window;
get_pos : unit -> Pos.t;
get_last : unit -> Region.t;
get_file : unit -> file_path;
close : unit -> unit
get_comments : unit -> Markup.comment FQueue.t
}
type open_err = File_opening of string

View File

@ -42,3 +42,9 @@ let to_string markup ?(offsets=true) mode =
region, sprintf "BOM \"%s\"" (String.escaped value) in
let reg_str = region#compact ~offsets mode
in sprintf "%s: %s" reg_str val_str
(* Comments *)
type comment =
Line of lexeme Region.reg
| Block of lexeme Region.reg

View File

@ -1,11 +1,12 @@
(** This module defines the sorts of markup recognised by the LIGO
(* This module defines the sorts of markup recognised by the LIGO
lexer *)
module Region = Simple_utils.Region
(** A lexeme is piece of concrete syntax belonging to a token. In
(* A lexeme is piece of concrete syntax belonging to a token. In
algebraic terms, a token is also a piece of abstract lexical
syntax. Lexical units emcompass both markup and lexemes. *)
type lexeme = string
type t =
@ -18,7 +19,7 @@ type t =
type markup = t
(** Pretty-printing of markup
(* Pretty-printing of markup
The difference between [to_lexeme] and [to_string] is that the
former builds the corresponding concrete syntax (the lexeme),
@ -31,3 +32,9 @@ type markup = t
val to_lexeme : t -> lexeme
val to_string : t -> ?offsets:bool -> [`Byte | `Point] -> string
(* Comments *)
type comment =
Line of lexeme Region.reg
| Block of lexeme Region.reg

View File

@ -569,7 +569,6 @@ let rec compile_instruction : ?next: AST.expression -> CST.instruction -> _ resu
let%bind (_, var, path) = compile_path mlu.path in
let%bind index = compile_expression @@ mlu.index.value.inside in
ok @@ (var, path @ [Access_map index])
in
match instruction with
Cond c ->
@ -725,8 +724,8 @@ and compile_block : ?next:AST.expression -> CST.block CST.reg -> _ result = fun
let (block', _loc) = r_split block in
let statements = npseq_to_list block'.statements in
let aux (next,attr) statement =
let%bind (statement, attr) = compile_statement ?next attr statement in
return (statement,attr)
let%bind (statement, attr) = compile_statement ?next attr statement
in return (statement,attr)
in
let%bind (block', _) = bind_fold_right_list aux (next,None) statements in
match block' with