diff options
author | Ralph Amissah <ralph@amissah.com> | 2017-01-14 09:42:04 -0500 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2019-04-10 15:14:14 -0400 |
commit | 4b12f27165efb0c7b38ae9338c6ec3cc42b4f6b5 (patch) | |
tree | 8b9b6e3b6b53ac4fad0b8ab9e9ceb38425576df9 /src | |
parent | 0.11.0 improved message passing, using templates (diff) |
insert file list: gather & make available a list of insert files (if any)
Diffstat (limited to 'src')
-rwxr-xr-x | src/sdp.d | 5 | ||||
-rw-r--r-- | src/sdp/ao_read_source_files.d | 23 |
2 files changed, 23 insertions, 5 deletions
@@ -210,6 +210,7 @@ void main(string[] args) { auto header_and_body_tuple = raw.sourceContentSplitIntoHeaderAndBody(read_in_file_string, fn_src); auto header = header_and_body_tuple[0]; auto content_body = header_and_body_tuple[1]; + auto _file_insert_list = header_and_body_tuple[2]; debug(header_and_body) { writeln(header); writeln(header_and_body_tuple.length); @@ -283,6 +284,10 @@ void main(string[] args) { string _k = fn_src; return _k; } + auto file_insert_list() { + string[] _k = _file_insert_list; + return _k; + } auto opt_action_bool() { bool[string] _k = _opt_action_bool; return _k; 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; } } } |