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/spine.org | 45 ++++++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 17 deletions(-) (limited to 'org/spine.org') diff --git a/org/spine.org b/org/spine.org index f9278ed..4588a5e 100644 --- a/org/spine.org +++ b/org/spine.org @@ -203,6 +203,8 @@ import doc_reform.meta.defaults, doc_reform.meta.doc_debugs, doc_reform.meta.rgx, + doc_reform.meta.rgx_yaml, + doc_reform.meta.rgx_files, doc_reform.io_in.paths_source, doc_reform.io_in.read_config_files, doc_reform.io_in.read_source_files, @@ -221,7 +223,6 @@ import doc_reform.meta.conf_make_meta_structs, doc_reform.meta.conf_make_meta_json, doc_reform.meta.defaults, - doc_reform.meta.rgx, doc_reform.io_in.paths_source, doc_reform.io_in.read_config_files, doc_reform.io_in.read_source_files, @@ -277,6 +278,14 @@ mixin CompileTimeInfo; #+NAME: spine_mixin #+BEGIN_SRC d mixin spineRgxIn; +mixin spineRgxYamlTags; +mixin spineRgxFiles; +mixin spineBiblio; +mixin outputHub; +#+END_SRC + +#+NAME: spine_metadoc_mixin +#+BEGIN_SRC d mixin spineBiblio; mixin outputHub; #+END_SRC @@ -296,6 +305,8 @@ string flag_action; string arg_unrecognized; enum dAM { abstraction, matters } static auto rgx = RgxI(); +static auto rgx_y = RgxYaml(); +static auto rgx_files = RgxFiles(); #+END_SRC *** scope (run complete) :scope: @@ -1123,7 +1134,7 @@ foreach(arg; args[1..$]) { } else if (_opt_action.require_processing_files) { /+ cli, assumed to be path to source files +/ auto _manifest_start = PodManifest!()(_opt_action, arg); if ( /+ pod files +/ - !(arg.match(rgx.src_pth_sst_or_ssm)) + !(arg.match(rgx_files.src_pth_sst_or_ssm)) && _manifest_start.pod_manifest_file_with_path && _opt_action.abstraction ) { @@ -1151,10 +1162,10 @@ foreach(arg; args[1..$]) { } if ("doc" in pod_manifest_yaml) { if (pod_manifest_yaml["doc"].type.mapping - && pod_manifest_yaml["doc"].tag.match(rgx.yaml_tag_is_map) + && pod_manifest_yaml["doc"].tag.match(rgx_y.yaml_tag_is_map) ) { if ("path" in pod_manifest_yaml["doc"]) { - if (pod_manifest_yaml["doc"]["path"].tag.match(rgx.yaml_tag_is_seq)) { + if (pod_manifest_yaml["doc"]["path"].tag.match(rgx_y.yaml_tag_is_seq)) { foreach (string _path; pod_manifest_yaml["doc"]["path"]) { markup_contents_location_ ~= _path ~ "\n"; pod_manifest_root_content_paths_to_markup_location_raw_ ~= @@ -1162,7 +1173,7 @@ foreach(arg; args[1..$]) { } } else if ( pod_manifest_yaml["doc"]["path"].type.string - && pod_manifest_yaml["doc"]["path"].tag.match(rgx.yaml_tag_is_str) + && pod_manifest_yaml["doc"]["path"].tag.match(rgx_y.yaml_tag_is_str) ) { markup_contents_location_ = pod_manifest_yaml["doc"]["path"].get!string; pod_manifest_root_content_paths_to_markup_location_raw_ = @@ -1170,17 +1181,17 @@ foreach(arg; args[1..$]) { } } if ("filename" in pod_manifest_yaml["doc"]) { - if (pod_manifest_yaml["doc"]["filename"].tag.match(rgx.yaml_tag_is_seq)) { + if (pod_manifest_yaml["doc"]["filename"].tag.match(rgx_y.yaml_tag_is_seq)) { foreach (string _filename; pod_manifest_yaml["doc"]["filename"]) { if ("language" in pod_manifest_yaml["doc"]) { - if (pod_manifest_yaml["doc"]["language"].tag.match(rgx.yaml_tag_is_seq)) { + if (pod_manifest_yaml["doc"]["language"].tag.match(rgx_y.yaml_tag_is_seq)) { foreach (string _lang; pod_manifest_yaml["doc"]["language"]) { markup_contents_location_ ~= "media/text/" ~ _lang ~ "/" ~ _filename ~ "\n"; } - } else if (pod_manifest_yaml["doc"]["language"].tag.match(rgx.yaml_tag_is_str) + } else if (pod_manifest_yaml["doc"]["language"].tag.match(rgx_y.yaml_tag_is_str) ) { markup_contents_location_ = "media/text/" @@ -1203,17 +1214,17 @@ foreach(arg; args[1..$]) { } } else if ( pod_manifest_yaml["doc"]["filename"].type.string - && pod_manifest_yaml["doc"]["filename"].tag.match(rgx.yaml_tag_is_str) + && pod_manifest_yaml["doc"]["filename"].tag.match(rgx_y.yaml_tag_is_str) ) { if ("language" in pod_manifest_yaml["doc"]) { - if (pod_manifest_yaml["doc"]["language"].tag.match(rgx.yaml_tag_is_seq)) { + if (pod_manifest_yaml["doc"]["language"].tag.match(rgx_y.yaml_tag_is_seq)) { foreach (string _lang; pod_manifest_yaml["doc"]["language"]) { markup_contents_location_ ~= "media/text/" ~ _lang ~ "/" ~ pod_manifest_yaml["doc"]["filename"].get!string ~ "\n"; } - } else if (pod_manifest_yaml["doc"]["language"].tag.match(rgx.yaml_tag_is_str)) { + } else if (pod_manifest_yaml["doc"]["language"].tag.match(rgx_y.yaml_tag_is_str)) { markup_contents_location_ = "media/text/" ~ pod_manifest_yaml["doc"]["language"].get!string @@ -1250,7 +1261,7 @@ foreach(arg; args[1..$]) { = (cast(char[]) markup_contents_location_).split; auto tmp_dir_ = (sisudoc_txt_).dirName.array; foreach (markup_contents_location; markup_contents_locations_arr) { - assert(markup_contents_location.match(rgx.src_pth_sst_or_ssm), + assert(markup_contents_location.match(rgx_files.src_pth_sst_or_ssm), "not a recognised file: «" ~ markup_contents_location ~ "»" ); @@ -1264,14 +1275,14 @@ foreach(arg; args[1..$]) { _manifests ~= _manifested; } } - } else if (arg.match(rgx.src_pth_sst_or_ssm)) { /+ markup txt files +/ + } else if (arg.match(rgx_files.src_pth_sst_or_ssm)) { /+ markup txt files +/ if (exists(arg)==0) { writeln("ERROR >> Processing Skipped! File not found: ", arg); } else { _manifested = PathMatters!()(_opt_action, _env, arg, arg); _manifests ~= _manifested; } - } else if (arg.match(rgx.src_pth_zip)) { + } else if (arg.match(rgx_files.src_pth_zip)) { // fns_src ~= arg; // gather input markup source file names for processing } else { // anything remaining, unused arg_unrecognized ~= " " ~ arg; @@ -1315,7 +1326,7 @@ scope(failure) { } } enforce( - manifest.src.filename.match(rgx.src_pth_types), + manifest.src.filename.match(rgx_files.src_pth_types), "not a sisu markup filename: «" ~ manifest.src.filename ~ "»" ); @@ -1501,14 +1512,14 @@ break; // terminate, stop #+HEADER: :tangle "../src/doc_reform/meta/metadoc.d" #+BEGIN_SRC d +<> module doc_reform.meta.metadoc; template spineAbstraction() { <> - <> + <> enum headBody { header, body_content, insert_file_list, image_list } enum makeMeta { make, meta } enum docAbst { doc_abstract_obj, doc_has } - static auto rgx = RgxI(); @system auto spineAbstraction(E,P,O,Cfg,M,S)( E _env, P program_info, -- cgit v1.2.3