diff --git a/compiler/surface/parser_driver.ml b/compiler/surface/parser_driver.ml index 4244ae1d..b1474823 100644 --- a/compiler/surface/parser_driver.ml +++ b/compiler/surface/parser_driver.ml @@ -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" + "@[Syntax error at %a:@ %t@]" (fun ppf string -> Format.fprintf ppf "@{\"%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 "@{unexpected token@}" | msg -> - Format.fprintf ppf "@{@<1>»@} @[%a@]" Format.pp_print_text + Format.fprintf ppf "@{@<1>%s@} @[%a@]" "»" + Format.pp_print_text (String.trim (String.uncapitalize_ascii msg))); if acceptable_tokens <> [] then - Format.fprintf ppf "@,@[Those are valid at this point:@ %a@]" + Format.fprintf ppf "@\n@[Those are valid at this point:@ %a@]" (Format.pp_print_list ~pp_sep:(fun ppf () -> Format.fprintf ppf ",@ ") (fun ppf string -> Format.fprintf ppf "@{\"%s\"@}" string)) diff --git a/tests/default/bad/typing_or_logical_error.catala_en b/tests/default/bad/typing_or_logical_error.catala_en index 699f337d..ea830470 100644 --- a/tests/default/bad/typing_or_logical_error.catala_en +++ b/tests/default/bad/typing_or_logical_error.catala_en @@ -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",