From 40625c16f7573398252ccf040ef49d398d64d5bd Mon Sep 17 00:00:00 2001 From: Alasdair Date: Thu, 13 Aug 2020 11:27:31 +0100 Subject: Preserve file structure through initial check Insert $file_start and $file_end pragmas in the AST, as well as $include_start and $include_end pragmas so we can reconstruct the original file structure later if needed, provided nothing like topological sorting has been done. Have the Lexer produce a list of comments whenever it parses a file, which can the be attached to the nearest nodes in the abstract syntax tree. --- src/process_file.mli | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/process_file.mli') diff --git a/src/process_file.mli b/src/process_file.mli index c9eb5e9e..3b23b1bd 100644 --- a/src/process_file.mli +++ b/src/process_file.mli @@ -50,13 +50,13 @@ (** Parse a file. The optional loc argument is the location of the $include directive that is importing the file, if applicable. *) -val parse_file : ?loc:Parse_ast.l -> string -> Parse_ast.defs +val parse_file : ?loc:Parse_ast.l -> string -> Lexer.comment list * Parse_ast.def list val clear_symbols : unit -> unit val have_symbol : string -> bool val add_symbol : string -> unit -val preprocess_ast : (Arg.key * Arg.spec * Arg.doc) list -> Parse_ast.defs -> Parse_ast.defs +val preprocess : (Arg.key * Arg.spec * Arg.doc) list -> Parse_ast.def list -> Parse_ast.def list val check_ast : Type_check.Env.t -> unit Ast.defs -> Type_check.tannot Ast.defs * Type_check.Env.t val rewrite_ast_initial : Type_check.Env.t -> Type_check.tannot Ast.defs -> Type_check.tannot Ast.defs * Type_check.Env.t val rewrite_ast_target : string -> Type_check.Env.t -> Type_check.tannot Ast.defs -> Type_check.tannot Ast.defs * Type_check.Env.t -- cgit v1.2.3