mirror of
https://github.com/CatalaLang/catala.git
synced 2024-11-08 07:51:43 +03:00
Fix formatting of syntax error messages
This commit is contained in:
parent
1efdf4262d
commit
1cf34d9123
@ -79,7 +79,7 @@ let raise_parser_error
|
||||
| None -> "Error token", error_loc
|
||||
| Some last_good_loc -> "Last good token", last_good_loc);
|
||||
]
|
||||
"Syntax error at %a@\n%t"
|
||||
"@[<hov>Syntax error at %a:@ %t@]"
|
||||
(fun ppf string -> Format.fprintf ppf "@{<yellow>\"%s\"@}" string)
|
||||
token msg
|
||||
|
||||
@ -131,10 +131,11 @@ module ParserAux (LocalisedLexer : Lexer_common.LocalisedLexer) = struct
|
||||
(match Parser_errors.message (state env) with
|
||||
| exception Not_found -> Format.fprintf ppf "@{<yellow>unexpected token@}"
|
||||
| msg ->
|
||||
Format.fprintf ppf "@{<yellow>@<1>»@} @[<hov>%a@]" Format.pp_print_text
|
||||
Format.fprintf ppf "@{<yellow>@<1>%s@} @[<hov>%a@]" "»"
|
||||
Format.pp_print_text
|
||||
(String.trim (String.uncapitalize_ascii msg)));
|
||||
if acceptable_tokens <> [] then
|
||||
Format.fprintf ppf "@,@[<hov>Those are valid at this point:@ %a@]"
|
||||
Format.fprintf ppf "@\n@[<hov>Those are valid at this point:@ %a@]"
|
||||
(Format.pp_print_list
|
||||
~pp_sep:(fun ppf () -> Format.fprintf ppf ",@ ")
|
||||
(fun ppf string -> Format.fprintf ppf "@{<yellow>\"%s\"@}" string))
|
||||
|
@ -13,7 +13,7 @@ scope A:
|
||||
$ catala test-scope A
|
||||
┌─[ERROR]─
|
||||
│
|
||||
│ Syntax error at "="
|
||||
│ Syntax error at "=":
|
||||
│ » expected 'under condition' followed by a condition, 'equals' followed by
|
||||
│ the definition body, or the rest of the variable qualified name
|
||||
│ Those are valid at this point: "of", "state", "equals", "under condition",
|
||||
|
Loading…
Reference in New Issue
Block a user