Incorrect function arguments message for ReasonLIGO.
This commit is contained in:
parent
09875cf1da
commit
52eff4e764
@ -23,6 +23,17 @@ let parse_file (source: string) : AST.t result =
|
|||||||
let Lexer.{read ; close ; _} =
|
let Lexer.{read ; close ; _} =
|
||||||
Lexer.open_token_stream None in
|
Lexer.open_token_stream None in
|
||||||
specific_try (function
|
specific_try (function
|
||||||
|
| SyntaxError.Error WrongFunctionArguments ->
|
||||||
|
let start = Lexing.lexeme_start_p lexbuf in
|
||||||
|
let end_ = Lexing.lexeme_end_p lexbuf in
|
||||||
|
let str = Format.sprintf
|
||||||
|
"Incorrect function arguments at \"%s\" from (%d, %d) to (%d, %d). In file \"%s|%s\"\n"
|
||||||
|
(Lexing.lexeme lexbuf)
|
||||||
|
start.pos_lnum (start.pos_cnum - start.pos_bol)
|
||||||
|
end_.pos_lnum (end_.pos_cnum - end_.pos_bol)
|
||||||
|
start.pos_fname source
|
||||||
|
in
|
||||||
|
simple_error str
|
||||||
| Parser.Error -> (
|
| Parser.Error -> (
|
||||||
let start = Lexing.lexeme_start_p lexbuf in
|
let start = Lexing.lexeme_start_p lexbuf in
|
||||||
let end_ = Lexing.lexeme_end_p lexbuf in
|
let end_ = Lexing.lexeme_end_p lexbuf in
|
||||||
|
@ -424,8 +424,8 @@ fun_expr:
|
|||||||
{p.value with inside = arg_to_pattern p.value.inside}
|
{p.value with inside = arg_to_pattern p.value.inside}
|
||||||
in PPar {p with value}
|
in PPar {p with value}
|
||||||
| EUnit u -> PUnit u
|
| EUnit u -> PUnit u
|
||||||
| _ -> failwith "Not supported" in (* TODO: raise a proper exception *)
|
| _ -> raise (SyntaxError.Error WrongFunctionArguments)
|
||||||
|
in
|
||||||
let fun_args_to_pattern = function
|
let fun_args_to_pattern = function
|
||||||
EAnnot {
|
EAnnot {
|
||||||
value = {
|
value = {
|
||||||
@ -453,8 +453,8 @@ fun_expr:
|
|||||||
in arg_to_pattern (fst fun_args), bindings
|
in arg_to_pattern (fst fun_args), bindings
|
||||||
| EUnit e ->
|
| EUnit e ->
|
||||||
arg_to_pattern (EUnit e), []
|
arg_to_pattern (EUnit e), []
|
||||||
| _ -> failwith "Not supported" in (* TODO: raise a proper exception *)
|
| _ -> raise (SyntaxError.Error WrongFunctionArguments)
|
||||||
|
in
|
||||||
let binders = fun_args_to_pattern $1 in
|
let binders = fun_args_to_pattern $1 in
|
||||||
let f = {kwd_fun;
|
let f = {kwd_fun;
|
||||||
binders;
|
binders;
|
||||||
|
4
src/passes/1-parser/shared/SyntaxError.ml
Normal file
4
src/passes/1-parser/shared/SyntaxError.ml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
type error =
|
||||||
|
| WrongFunctionArguments
|
||||||
|
|
||||||
|
exception Error of error
|
4
src/passes/1-parser/shared/SyntaxError.mli
Normal file
4
src/passes/1-parser/shared/SyntaxError.mli
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
type error =
|
||||||
|
| WrongFunctionArguments
|
||||||
|
|
||||||
|
exception Error of error
|
@ -18,6 +18,7 @@
|
|||||||
FQueue
|
FQueue
|
||||||
EvalOpt
|
EvalOpt
|
||||||
Version
|
Version
|
||||||
|
SyntaxError
|
||||||
)
|
)
|
||||||
(modules_without_implementation Error)
|
(modules_without_implementation Error)
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user