From f6d28b62f0e02b8a88a1832589e203c7a613f45b Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 25 Nov 2022 22:06:40 -0500 Subject: regex review, match speed & compile time, ctregex - improve match time - add interim fontface identifier marker - improve compile time - remove unused regexs - separate out some specialized output matches --- org/in_source_files.org | 79 +++++++++++++++++++++++++++---------------------- 1 file changed, 43 insertions(+), 36 deletions(-) (limited to 'org/in_source_files.org') diff --git a/org/in_source_files.org b/org/in_source_files.org index ba6a578..be6b84c 100644 --- a/org/in_source_files.org +++ b/org/in_source_files.org @@ -17,23 +17,6 @@ - [[./doc-reform.org][doc-reform.org]] [[./][org/]] -* imports -** std - -#+NAME: imports_std -#+BEGIN_SRC d -std.file, -std.path -#+END_SRC - -** spine - -#+NAME: imports_spine -#+BEGIN_SRC d -doc_reform.meta, -doc_reform.io_in.paths_source -#+END_SRC - * A. get _config file_, read in (.readText) [#A] ** _module template_ :module:config_files: @@ -48,8 +31,12 @@ doc_reform.io_in.paths_source +/ module doc_reform.io_in.read_config_files; import - <>, - <>, + std.file, + std.path; +import + doc_reform.meta, + doc_reform.io_in.paths_source, + doc_reform.meta.rgx_files, doc_reform.meta.rgx; <> <> @@ -200,12 +187,18 @@ webserv: #+BEGIN_SRC d static template readConfigDoc() { import - <>, - <>, + std.file, + std.path; + import + doc_reform.meta, + doc_reform.io_in.paths_source, + doc_reform.meta.rgx_files, doc_reform.meta.rgx; @system final auto readConfigDoc(M,E)(M _manifested, E _env) { mixin spineRgxIn; static auto rgx = RgxI(); + mixin spineRgxFiles; + static auto rgx_files = RgxFiles(); string config_file_str; string conf_filename = "NONE"; auto _conf_file_details = configFilePaths!()(_manifested, _env); @@ -257,8 +250,13 @@ static template readConfigDoc() { #+BEGIN_SRC d static template configReadSiteYAML() { import - <>, - <>; + std.file, + std.path; + import + doc_reform.meta, + doc_reform.io_in.paths_source, + doc_reform.meta.rgx_files, + doc_reform.meta.rgx; @safe final YAMLDocument configReadSiteYAML(M,E)(M _manifested, E _env) { string _configuration = configReadInSiteYAML!()(_manifested, _env); auto _conf_file_details = configFilePaths!()(_manifested, _env); @@ -269,8 +267,11 @@ static template configReadSiteYAML() { } static template configReadDocYAML() { import - <>, - <>; + std.file, + std.path; + import + doc_reform.meta, + doc_reform.io_in.paths_source; @safe final YAMLDocument configReadDocYAML(M,E)(M _manifested, E _env) { string _configuration = configReadInDocYAML!()(_manifested, _env); auto _conf_file_details = configFilePaths!()(_manifested, _env); @@ -296,11 +297,17 @@ static template configReadDocYAML() { module doc_reform.io_in.read_source_files; template spineRawMarkupContent() { import - <>, - <>, + std.file, + std.path; + import + doc_reform.meta, + doc_reform.io_in.paths_source, + doc_reform.meta.rgx_files, doc_reform.meta.rgx; mixin spineRgxIn; static auto rgx = RgxI(); + mixin spineRgxFiles; + static auto rgx_files = RgxFiles(); string[] _images=[]; @safe string[] _extract_images(S)(S content_block) { string[] images_; @@ -346,7 +353,7 @@ template spineRawMarkupContent() { = raw.markupSourceHeaderContentRawLineTupleArray(source_txt_str); char[] header_raw = t.header; char[][] sourcefile_body_content = t.src_txt; - if (fn_src.match(rgx.src_fn_master)) { // filename with path needed if master file (.ssm) not otherwise + if (fn_src.match(rgx_files.src_fn_master)) { // filename with path needed if master file (.ssm) not otherwise auto ins = Inserts(); ContentsInsertsImages tu = ins.scan_master_src_for_insert_files_and_import_content(_opt_action, sourcefile_body_content, fn_src); @@ -482,9 +489,9 @@ split is on first match of level A~ (which is required) #+NAME: meta_markup_source_raw_read_in_file #+BEGIN_SRC d @safe string markupSourceReadIn(in string fn_src) { - static auto rgx = RgxI(); + static auto rgx_files = RgxFiles(); enforce( - fn_src.match(rgx.src_pth_sst_or_ssm), + fn_src.match(rgx_files.src_pth_sst_or_ssm), "not a dr markup filename: «" ~ fn_src ~ "»" ); @@ -550,7 +557,7 @@ split is on first match of level A~ (which is required) char[][] contents_insert; int code_block_status = 0; enum codeBlock { off, curly, tic, } -auto fn_pth_full = fn_src.match(rgx.src_pth_sst_or_ssm); +auto fn_pth_full = fn_src.match(rgx_files.src_pth_sst_or_ssm); auto markup_src_file_path = fn_pth_full.captures[1]; #+END_SRC @@ -574,14 +581,14 @@ if (code_block_status == codeBlock.curly) { } else if (line.matchFirst(rgx.block_tic_code_open)) { code_block_status = codeBlock.tic; contents_insert ~= line; -} else if (auto m = line.match(rgx.insert_src_fn_ssi_or_sst)) { +} else if (auto m = line.match(rgx_files.insert_src_fn_ssi_or_sst)) { auto insert_fn = m.captures[2]; auto insert_sub_pth = m.captures[1]; auto fn_src_insert = chainPath(markup_src_file_path, insert_sub_pth ~ insert_fn).array; auto raw = MarkupRawUnit(); auto markup_sourcesubfile_insert_content - = raw.getInsertMarkupSourceContentRawLineArray(fn_src_insert, rgx.src_fn_find_inserts); + = raw.getInsertMarkupSourceContentRawLineArray(fn_src_insert, rgx_files.src_fn_find_inserts); debug(insert_file) { writeln(line); writeln(fn_src_insert); @@ -634,7 +641,7 @@ return t; char[][] contents; int code_block_status = 0; enum codeBlock { off, curly, tic, } -auto fn_pth_full = fn_src.match(rgx.src_pth_sst_or_ssm); +auto fn_pth_full = fn_src.match(rgx_files.src_pth_sst_or_ssm); auto markup_src_file_path = fn_pth_full.captures[1]; char[][] contents_insert; string[] _images =[]; @@ -661,7 +668,7 @@ if (code_block_status == codeBlock.curly) { } else if (line.matchFirst(rgx.block_tic_code_open)) { code_block_status = codeBlock.tic; contents ~= line; -} else if (auto m = line.match(rgx.insert_src_fn_ssi_or_sst)) { +} else if (auto m = line.match(rgx_files.insert_src_fn_ssi_or_sst)) { auto insert_fn = m.captures[2]; auto insert_sub_pth = m.captures[1]; auto fn_src_insert @@ -670,7 +677,7 @@ if (code_block_status == codeBlock.curly) { auto raw = MarkupRawUnit(); /+ TODO +/ auto markup_sourcefile_insert_content - = raw.getInsertMarkupSourceContentRawLineArray(fn_src_insert, rgx.src_fn_find_inserts); + = raw.getInsertMarkupSourceContentRawLineArray(fn_src_insert, rgx_files.src_fn_find_inserts); debug(insert_file) { writeln(line); writeln(fn_src_insert); -- cgit v1.2.3