diff options
Diffstat (limited to 'src/process_file.ml')
| -rw-r--r-- | src/process_file.ml | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/src/process_file.ml b/src/process_file.ml index 1749bc03..f176f198 100644 --- a/src/process_file.ml +++ b/src/process_file.ml @@ -59,20 +59,25 @@ let get_lexbuf f = lexbuf, in_chan let parse_file (f : string) : Parse_ast.defs = - let scanbuf, in_chan = get_lexbuf f in - let type_names = - try - Pre_parser.file Pre_lexer.token scanbuf - with + if not !opt_new_parser + then + let scanbuf, in_chan = get_lexbuf f in + let type_names = + try + Pre_parser.file Pre_lexer.token scanbuf + with | Parsing.Parse_error -> - let pos = Lexing.lexeme_start_p scanbuf in - raise (Reporting_basic.Fatal_error (Reporting_basic.Err_syntax (pos, "pre"))) + let pos = Lexing.lexeme_start_p scanbuf in + raise (Reporting_basic.Fatal_error (Reporting_basic.Err_syntax (pos, "pre"))) | Parse_ast.Parse_error_locn(l,m) -> - raise (Reporting_basic.Fatal_error (Reporting_basic.Err_syntax_locn (l, m))) + raise (Reporting_basic.Fatal_error (Reporting_basic.Err_syntax_locn (l, m))) | Lexer.LexError(s,p) -> - raise (Reporting_basic.Fatal_error (Reporting_basic.Err_lex (p, s))) in - let () = Lexer.custom_type_names := !Lexer.custom_type_names @ type_names in - close_in in_chan; + raise (Reporting_basic.Fatal_error (Reporting_basic.Err_lex (p, s))) + in + close_in in_chan; + Lexer.custom_type_names := !Lexer.custom_type_names @ type_names + else (); + let lexbuf, in_chan = get_lexbuf f in try let ast = |
