From 4b12f27165efb0c7b38ae9338c6ec3cc42b4f6b5 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 14 Jan 2017 09:42:04 -0500 Subject: insert file list: gather & make available a list of insert files (if any) --- src/sdp/ao_read_source_files.d | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'src/sdp/ao_read_source_files.d') diff --git a/src/sdp/ao_read_source_files.d b/src/sdp/ao_read_source_files.d index a2bf75d..34aed22 100644 --- a/src/sdp/ao_read_source_files.d +++ b/src/sdp/ao_read_source_files.d @@ -23,20 +23,25 @@ template SiSUmarkupRaw() { } final auto sourceContentSplitIntoHeaderAndBody(in string source_txt_str, in string fn_src="") { auto raw = MarkupRawUnit(); + string[] insert_file_list; auto t = raw.markupSourceHeaderContentRawLineTupleArray(source_txt_str); auto header_raw = t[0]; auto sourcefile_body_content = t[1]; if (match(fn_src, rgx.src_fn_master)) { // filename with path needed if master file (.ssm) not otherwise auto ins = Inserts(); - sourcefile_body_content = + auto tu = ins.scan_master_src_for_insert_files_and_import_content(sourcefile_body_content, fn_src); + static assert(!isTypeTuple!(tu)); + sourcefile_body_content = tu[0]; + insert_file_list = tu[1].dup; } t = tuple( header_raw, - sourcefile_body_content + sourcefile_body_content, + insert_file_list ); - static assert(t.length==2); + static assert(t.length==3); return t; } } @@ -92,13 +97,15 @@ template SiSUmarkupRaw() { return source_txt_str; } auto markupSourceHeaderContentRawLineTupleArray(in string source_txt_str) { + string[] file_insert_list = []; auto hc = header0Content1(source_txt_str); auto header = hc[0]; char[] source_txt = hc[1]; auto source_line_arr = markupSourceLineArray(source_txt); auto t = tuple( header, - source_line_arr + source_line_arr, + file_insert_list ); return t; } @@ -209,6 +216,7 @@ template SiSUmarkupRaw() { auto type = flags_type_init; auto fn_pth_full = match(fn_src, rgx.src_pth); auto markup_src_file_path = fn_pth_full.captures[1]; + string[] insert_file_list =[]; foreach (line; sourcefile_body_content) { if (type["curly_code"] == 1) { if (matchFirst(line, rgx.block_curly_code_close)) { @@ -231,6 +239,7 @@ template SiSUmarkupRaw() { auto insert_sub_pth = m.captures[1]; auto fn_src_insert = chainPath(markup_src_file_path, insert_sub_pth ~ insert_fn).array; + insert_file_list ~= to!string(fn_src_insert); auto raw = MarkupRawUnit(); /+ TODO +/ if (auto ma = match(line, rgx.src_fn_text)) { @@ -270,7 +279,11 @@ template SiSUmarkupRaw() { writeln(__LINE__); writeln(contents.length); } - return contents; + auto t = tuple( + contents, + insert_file_list + ); + return t; } } } -- cgit v1.2.3