Commit 100ffcad authored by Raphaël Cauderlier's avatar Raphaël Cauderlier
Browse files

Error handling

parent 50d9637e
......@@ -5,7 +5,8 @@ let print_pos lb =
let cnum = start.Lexing.pos_cnum - start.Lexing.pos_bol in
let tok = Lexing.lexeme lb in
Format.eprintf "File: %s, line: %d, column: %d, Token \"%s\"@\n@."
file line cnum tok
file line cnum tok;
exit 1
let rec lex_prog lb =
try
......@@ -13,8 +14,8 @@ let rec lex_prog lb =
let lines = lex_prog lb in
(pos, line) :: lines
with End_of_file -> []
| Parsing.Parse_error ->
print_pos lb; []
| Parser.Error ->
print_pos lb
let main () =
Arg.parse [] (fun file ->
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment