erro detalhado com ocamlyacc
No bisão, é suficiente adicionar
%verbose-error
ao arquivo para tornar os erros do analisador mais detalhados. Existe alguma maneira de obter funcionalidade semelhante com ocamlyacc?
Aqui é a resposta para uma pergunta semelhante, mas eu não pude fazer nada disso. É assim que eu chamo as funções lexer e parser:
let rec foo () =
try
let line = input_line stdin in
(try
let _ = (Parser.latexstatement lexer_token_safe (Lexing.from_string line)) in
print_string ("SUCCESS\n")
with
LexerException s -> print_string ("$L" ^ line ^ "\n")
| Parsing.Parse_error -> print_string ("$P" ^ line ^ "\n")
| _ -> print_string ("$S " ^ line ^ "\n"));
flush stdout;
foo ();
with
End_of_file -> ()
;;
foo ();;