From b5a3fb9367e0c26739491eca7fcc8817b6dee4cf Mon Sep 17 00:00:00 2001 From: Christian Rinderknecht Date: Thu, 26 Mar 2020 19:32:48 +0100 Subject: [PATCH] The directive #include is now recursive. --- vendors/Preproc/Preproc.mll | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/vendors/Preproc/Preproc.mll b/vendors/Preproc/Preproc.mll index bf5341585..457d1a92e 100644 --- a/vendors/Preproc/Preproc.mll +++ b/vendors/Preproc/Preproc.mll @@ -465,8 +465,16 @@ rule scan state = parse match find dir incl_file state.opt#libs with Some channel -> channel | None -> stop (File_not_found incl_file) state reg in + let incl_buf = Lexing.from_channel incl_chan in + let () = + let open Lexing in + incl_buf.lex_curr_p <- + {incl_buf.lex_curr_p with pos_fname = incl_file} in let state = {state with incl = incl_chan::state.incl} in - cat state (Lexing.from_channel incl_chan); (* TODO *) + let state' = + {state with env=Env.empty; mode=Copy; trace=[]} in + let state' = scan state' incl_buf in + let state = {state with incl = state'.incl} in print state (sprintf "# %i \"%s\" 2" (line+1) base); scan state lexbuf | "if" ->