summaryrefslogtreecommitdiff
path: root/frontend/file_parser.ml
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/file_parser.ml')
-rw-r--r--frontend/file_parser.ml28
1 files changed, 14 insertions, 14 deletions
diff --git a/frontend/file_parser.ml b/frontend/file_parser.ml
index 0e975ce..672c695 100644
--- a/frontend/file_parser.ml
+++ b/frontend/file_parser.ml
@@ -3,17 +3,17 @@ open Ast_printer
open Lexing
let parse_file (filename : string) : prog =
- let f = open_in filename in
- let lex = from_channel f in
- try
- lex.lex_curr_p <- { lex.lex_curr_p with pos_fname = filename; };
- Parser.file Lexer.token lex
- with
- | Parser.Error ->
- Printf.eprintf "Parse error (invalid syntax) near %s\n"
- (string_of_position lex.lex_start_p);
- failwith "Parse error"
- | Failure "lexing: empty token" ->
- Printf.eprintf "Parse error (invalid token) near %s\n"
- (string_of_position lex.lex_start_p);
- failwith "Parse error"
+ let f = open_in filename in
+ let lex = from_channel f in
+ try
+ lex.lex_curr_p <- { lex.lex_curr_p with pos_fname = filename; };
+ Parser.file Lexer.token lex
+ with
+ | Parser.Error ->
+ Printf.eprintf "Parse error (invalid syntax) near %s\n"
+ (string_of_position lex.lex_start_p);
+ failwith "Parse error"
+ | Failure "lexing: empty token" ->
+ Printf.eprintf "Parse error (invalid token) near %s\n"
+ (string_of_position lex.lex_start_p);
+ failwith "Parse error"