Fixed format of syntax error messages.
This commit is contained in:
parent
ffb3d05864
commit
1ccf6f247d
@ -3,7 +3,7 @@ open Cli_expect
|
|||||||
let%expect_test _ =
|
let%expect_test _ =
|
||||||
run_ligo_bad [ "compile-contract" ; "../../test/contracts/negative/gitlab_111.religo" ; "main" ] ;
|
run_ligo_bad [ "compile-contract" ; "../../test/contracts/negative/gitlab_111.religo" ; "main" ] ;
|
||||||
[%expect {|
|
[%expect {|
|
||||||
ligo: : Parse error in file "gitlab_111.religo", line 2, characters 0-3, after "=" and before "let":
|
ligo: : Parse error in file "gitlab_111.religo", line 2, characters 0-3 at "let", after "=":
|
||||||
This is an incorrect let binding.
|
This is an incorrect let binding.
|
||||||
-
|
-
|
||||||
Examples of correct let bindings:
|
Examples of correct let bindings:
|
||||||
@ -23,7 +23,7 @@ let%expect_test _ =
|
|||||||
|
|
||||||
run_ligo_bad [ "compile-contract" ; "../../test/contracts/negative/missing_rpar.religo" ; "main" ] ;
|
run_ligo_bad [ "compile-contract" ; "../../test/contracts/negative/missing_rpar.religo" ; "main" ] ;
|
||||||
[%expect {|
|
[%expect {|
|
||||||
ligo: : Parse error in file "missing_rpar.religo", line 5, characters 0-3, after "m" and before "let":
|
ligo: : Parse error in file "missing_rpar.religo", line 5, characters 0-3 at "let", after "m":
|
||||||
Missing `)`.
|
Missing `)`.
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ open Cli_expect
|
|||||||
let%expect_test _ =
|
let%expect_test _ =
|
||||||
run_ligo_bad [ "compile-contract" ; "../../test/contracts/negative/error_syntax.ligo" ; "main" ] ;
|
run_ligo_bad [ "compile-contract" ; "../../test/contracts/negative/error_syntax.ligo" ; "main" ] ;
|
||||||
[%expect {|
|
[%expect {|
|
||||||
ligo: : Parse error in file "error_syntax.ligo", line 1, characters 16-17, after "bar" and before "-":
|
ligo: : Parse error in file "error_syntax.ligo", line 1, characters 16-17 at "-", after "bar":
|
||||||
15: <syntax error> {}
|
15: <syntax error> {}
|
||||||
|
|
||||||
|
|
||||||
|
@ -77,8 +77,8 @@
|
|||||||
; (targets error.messages)
|
; (targets error.messages)
|
||||||
; (deps Parser.mly ParToken.mly error.messages.checked-in)
|
; (deps Parser.mly ParToken.mly error.messages.checked-in)
|
||||||
; (action
|
; (action
|
||||||
; (with-stdout-to %{targets}
|
; (with-stdout-to %{targets}
|
||||||
; (bash
|
; (bash
|
||||||
; "menhir \
|
; "menhir \
|
||||||
; --unused-tokens \
|
; --unused-tokens \
|
||||||
; --list-errors \
|
; --list-errors \
|
||||||
@ -97,11 +97,11 @@
|
|||||||
(targets error.messages)
|
(targets error.messages)
|
||||||
(deps Parser.mly ParToken.mly error.messages.checked-in LexToken.mli)
|
(deps Parser.mly ParToken.mly error.messages.checked-in LexToken.mli)
|
||||||
(action
|
(action
|
||||||
(with-stdout-to %{targets}
|
(with-stdout-to %{targets}
|
||||||
(run
|
(run
|
||||||
menhir
|
menhir
|
||||||
--unused-tokens
|
--unused-tokens
|
||||||
--update-errors error.messages.checked-in
|
--update-errors error.messages.checked-in
|
||||||
--table
|
--table
|
||||||
--strict
|
--strict
|
||||||
--external-tokens LexToken.mli
|
--external-tokens LexToken.mli
|
||||||
@ -115,8 +115,8 @@
|
|||||||
(rule
|
(rule
|
||||||
(target error.messages.new)
|
(target error.messages.new)
|
||||||
(action
|
(action
|
||||||
(with-stdout-to %{target}
|
(with-stdout-to %{target}
|
||||||
(run
|
(run
|
||||||
menhir
|
menhir
|
||||||
--unused-tokens
|
--unused-tokens
|
||||||
--list-errors
|
--list-errors
|
||||||
@ -135,7 +135,7 @@
|
|||||||
(name runtest)
|
(name runtest)
|
||||||
(deps error.messages error.messages.new)
|
(deps error.messages error.messages.new)
|
||||||
(action
|
(action
|
||||||
(run
|
(run
|
||||||
menhir
|
menhir
|
||||||
--unused-tokens
|
--unused-tokens
|
||||||
--table
|
--table
|
||||||
@ -156,8 +156,8 @@
|
|||||||
(targets ParErr.ml)
|
(targets ParErr.ml)
|
||||||
(deps Parser.mly ParToken.mly error.messages.checked-in LexToken.mli)
|
(deps Parser.mly ParToken.mly error.messages.checked-in LexToken.mli)
|
||||||
(action
|
(action
|
||||||
(with-stdout-to %{targets}
|
(with-stdout-to %{targets}
|
||||||
(run
|
(run
|
||||||
menhir
|
menhir
|
||||||
--unused-tokens
|
--unused-tokens
|
||||||
--table
|
--table
|
||||||
|
@ -103,11 +103,12 @@ module Make (IO: IO)
|
|||||||
Printf.sprintf ", at \"%s\"" invalid_lexeme
|
Printf.sprintf ", at \"%s\"" invalid_lexeme
|
||||||
| Some valid ->
|
| Some valid ->
|
||||||
let valid_lexeme = Lexer.Token.to_lexeme valid in
|
let valid_lexeme = Lexer.Token.to_lexeme valid in
|
||||||
let valid = Printf.sprintf ", after \"%s\"" valid_lexeme in
|
if Lexer.Token.is_eof invalid then
|
||||||
if Lexer.Token.is_eof invalid then valid
|
Printf.sprintf ", after \"%s\"" valid_lexeme
|
||||||
else
|
else
|
||||||
let invalid_lexeme = Lexer.Token.to_lexeme invalid in
|
let invalid_lexeme = Lexer.Token.to_lexeme invalid in
|
||||||
Printf.sprintf "at \"%s\", before %s" invalid_lexeme valid in
|
Printf.sprintf " at \"%s\", after \"%s\""
|
||||||
|
invalid_lexeme valid_lexeme in
|
||||||
let header = header ^ trailer in
|
let header = header ^ trailer in
|
||||||
let msg =
|
let msg =
|
||||||
header ^ (if msg = "" then ".\n" else ":\n" ^ msg)
|
header ^ (if msg = "" then ".\n" else ":\n" ^ msg)
|
||||||
|
Loading…
Reference in New Issue
Block a user