diff options
author | Ralph Amissah <ralph@amissah.com> | 2017-03-07 09:11:09 -0500 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2019-04-10 15:14:14 -0400 |
commit | 5a4df097b2976c24c449c56cf035995edfb1261e (patch) | |
tree | 9112c6f32f1b9a8d7cdc7849754d6b8f602de0c5 /org/ao_read_source_files.org | |
parent | org files minor touches (diff) |
0.13.6 dlang function calls, syntax (ufcs related), logic should be retained
Diffstat (limited to 'org/ao_read_source_files.org')
-rw-r--r-- | org/ao_read_source_files.org | 49 |
1 files changed, 25 insertions, 24 deletions
diff --git a/org/ao_read_source_files.org b/org/ao_read_source_files.org index a870a57..fa3da1a 100644 --- a/org/ao_read_source_files.org +++ b/org/ao_read_source_files.org @@ -55,7 +55,7 @@ final string ConfigIn(C,E)(C conf_sdl, E env) { debug(configfile) { writeln(conf_file); } - config_file_str = readText(conf_file); + config_file_str = conf_file.readText; break; } } @@ -193,7 +193,7 @@ template SiSUrawMarkupContent() { 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 + if (fn_src.match(rgx.src_fn_master)) { // filename with path needed if master file (.ssm) not otherwise auto ins = Inserts(); auto tu = ins.scan_master_src_for_insert_files_and_import_content(sourcefile_body_content, fn_src); @@ -260,7 +260,7 @@ final private string readInMarkupSource(in char[] fn_src) { string source_txt_str; try { if (exists(fn_src)) { - source_txt_str = readText(fn_src); + source_txt_str = fn_src.readText; } } catch (ErrnoException ex) { @@ -292,12 +292,13 @@ split is on first match of level A~ (which is required) final private char[][] header0Content1(in string src_text) { /+ split string on _first_ match of "^:?A~\s" into [header, content] array/tuple +/ char[][] header_and_content; - auto m = matchFirst(cast(char[]) src_text, rgx.heading_a); + auto m = (cast(char[]) src_text).matchFirst(rgx.heading_a); header_and_content ~= m.pre; header_and_content ~= m.hit ~ m.post; assert(header_and_content.length == 2, - "document markup is broken, header body split == " ~ to!string(header_and_content.length) ~ - "; (header / body array split should == 2 (split is on level A~))" + "document markup is broken, header body split == " + ~ header_and_content.length.to!string + ~ "; (header / body array split should == 2 (split is on level A~))" ); return header_and_content; } @@ -309,7 +310,7 @@ final private char[][] header0Content1(in string src_text) { #+BEGIN_SRC d final private char[][] markupSourceLineArray(in char[] src_text) { char[][] source_line_arr = - split(cast(char[]) src_text, rgx.newline_eol_strip_preceding); + (cast(char[]) src_text).split(rgx.newline_eol_strip_preceding); return source_line_arr; } #+END_SRC @@ -325,7 +326,7 @@ final private char[][] markupSourceLineArray(in char[] src_text) { auto markupSourceReadIn(in string fn_src) { auto rgx = Rgx(); enforce( - match(fn_src, rgx.src_pth), + fn_src.match(rgx.src_pth), "not a sisu markup filename" ); auto source_txt_str = readInMarkupSource(fn_src); @@ -361,7 +362,7 @@ final char[][] getInsertMarkupSourceContentRawLineArray( Regex!(char) rgx_file ) { enforce( - match(fn_src, rgx_file), + fn_src.match(rgx_file), "not a sisu markup filename" ); auto source_txt_str = readInMarkupSource(fn_src); @@ -380,7 +381,7 @@ final char[][] getInsertMarkupSourceContentRawLineArray( #+BEGIN_SRC d char[][] contents_insert; auto type1 = flags_type_init; -auto fn_pth_full = match(fn_src, rgx.src_pth); +auto fn_pth_full = fn_src.match(rgx.src_pth); auto markup_src_file_path = fn_pth_full.captures[1]; #+END_SRC @@ -391,11 +392,11 @@ auto markup_src_file_path = fn_pth_full.captures[1]; if (type1["curly_code"] == 1) { type1["header_make"] = 0; type1["header_meta"] = 0; - if (matchFirst(line, rgx.block_curly_code_close)) { + if (line.matchFirst(rgx.block_curly_code_close)) { type1["curly_code"] = 0; } contents_insert ~= line; -} else if (matchFirst(line, rgx.block_curly_code_open)) { +} else if (line.matchFirst(rgx.block_curly_code_open)) { type1["curly_code"] = 1; type1["header_make"] = 0; type1["header_meta"] = 0; @@ -403,28 +404,28 @@ if (type1["curly_code"] == 1) { } else if (type1["tic_code"] == 1) { type1["header_make"] = 0; type1["header_meta"] = 0; - if (matchFirst(line, rgx.block_tic_close)) { + if (line.matchFirst(rgx.block_tic_close)) { type1["tic_code"] = 0; } contents_insert ~= line; -} else if (matchFirst(line, rgx.block_tic_code_open)) { +} else if (line.matchFirst(rgx.block_tic_code_open)) { type1["tic_code"] = 1; type1["header_make"] = 0; type1["header_meta"] = 0; contents_insert ~= line; } else if ( (type1["header_make"] == 1) - && matchFirst(line, rgx.native_header_sub) + && line.matchFirst(rgx.native_header_sub) ) { type1["header_make"] = 1; type1["header_meta"] = 0; } else if ( (type1["header_meta"] == 1) - && matchFirst(line, rgx.native_header_sub) + && line.matchFirst(rgx.native_header_sub) ) { type1["header_meta"] = 1; type1["header_make"] = 0; -} else if (auto m = match(line, rgx.insert_src_fn_ssi_or_sst)) { +} else if (auto m = line.match(rgx.insert_src_fn_ssi_or_sst)) { type1["header_make"] = 0; type1["header_meta"] = 0; auto insert_fn = m.captures[2]; @@ -474,7 +475,7 @@ return contents_insert; #+BEGIN_SRC d char[][] contents; auto type = flags_type_init; -auto fn_pth_full = match(fn_src, rgx.src_pth); +auto fn_pth_full = fn_src.match(rgx.src_pth); auto markup_src_file_path = fn_pth_full.captures[1]; string[] insert_file_list =[]; #+END_SRC @@ -484,22 +485,22 @@ string[] insert_file_list =[]; #+name: ao_master_doc_scan_for_insert_filenames_loop #+BEGIN_SRC d if (type["curly_code"] == 1) { - if (matchFirst(line, rgx.block_curly_code_close)) { + if (line.matchFirst(rgx.block_curly_code_close)) { type["curly_code"] = 0; } contents ~= line; -} else if (matchFirst(line, rgx.block_curly_code_open)) { +} else if (line.matchFirst(rgx.block_curly_code_open)) { type["curly_code"] = 1; contents ~= line; } else if (type["tic_code"] == 1) { - if (matchFirst(line, rgx.block_tic_close)) { + if (line.matchFirst(rgx.block_tic_close)) { type["tic_code"] = 0; } contents ~= line; -} else if (matchFirst(line, rgx.block_tic_code_open)) { +} else if (line.matchFirst(rgx.block_tic_code_open)) { type["tic_code"] = 1; contents ~= line; -} else if (auto m = match(line, rgx.insert_src_fn_ssi_or_sst)) { +} else if (auto m = line.match(rgx.insert_src_fn_ssi_or_sst)) { auto insert_fn = m.captures[2]; auto insert_sub_pth = m.captures[1]; auto fn_src_insert = @@ -507,7 +508,7 @@ if (type["curly_code"] == 1) { insert_file_list ~= to!string(fn_src_insert); auto raw = MarkupRawUnit(); /+ TODO +/ - if (auto ma = match(line, rgx.src_fn_text)) { + if (auto ma = line.match(rgx.src_fn_text)) { /+ .sst when inserted, not used: headers and heading level ^:?A~ so remove +/ writeln(__LINE__); writeln(ma); } |