summaryrefslogtreecommitdiff
path: root/src/splice.ml
diff options
context:
space:
mode:
authorAlasdair2020-08-13 11:27:31 +0100
committerAlasdair2020-08-13 15:47:21 +0100
commit40625c16f7573398252ccf040ef49d398d64d5bd (patch)
tree378aba617a045c866c53d8938ce13f92562e06cf /src/splice.ml
parent2736af39811331502c7f5bc7e2bd8f590f1f9b2a (diff)
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.
Diffstat (limited to 'src/splice.ml')
-rw-r--r--src/splice.ml4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/splice.ml b/src/splice.ml
index 90488c0a..8ebd5793 100644
--- a/src/splice.ml
+++ b/src/splice.ml
@@ -40,8 +40,8 @@ let filter_replacements spec_found (Defs defs) =
in List.filter not_found defs
let splice ast file =
- let parsed_ast = Process_file.parse_file file in
- let repl_ast = Initial_check.process_ast ~generate:false parsed_ast in
+ let parsed_ast = Process_file.parse_file file |> snd in
+ let repl_ast = Initial_check.process_ast ~generate:false (Parse_ast.Defs [(file, parsed_ast)]) in
let repl_ast = Rewrites.move_loop_measures repl_ast in
let repl_ast = map_defs_annot (fun (l,_) -> l,Type_check.empty_tannot) repl_ast in
let repl_ids, repl_specs = scan_defs repl_ast in