From 5a4df097b2976c24c449c56cf035995edfb1261e Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 7 Mar 2017 09:11:09 -0500 Subject: 0.13.6 dlang function calls, syntax (ufcs related), logic should be retained --- src/sdp/ao_conf_make_meta_native.d | 46 ++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 24 deletions(-) (limited to 'src/sdp/ao_conf_make_meta_native.d') diff --git a/src/sdp/ao_conf_make_meta_native.d b/src/sdp/ao_conf_make_meta_native.d index 08a7d9f..500be52 100644 --- a/src/sdp/ao_conf_make_meta_native.d +++ b/src/sdp/ao_conf_make_meta_native.d @@ -40,15 +40,13 @@ template SiSUheaderExtractNative() { destroy(dochead_meta); destroy(dochead_make); } - if (auto t = match(header, rgx.native_header_main)) { - char[][] header_obj_spl = split( - cast(char[]) header, - rgx.line_delimiter_ws_strip - ); + if (auto t = header.match(rgx.native_header_main)) { + char[][] header_obj_spl = + (cast(char[]) header).split(rgx.line_delimiter_ws_strip); auto hm = to!string(t.captures[1]); - if (match(hm, rgx.main_headers)) { + if (hm.match(rgx.main_headers)) { foreach (line; header_obj_spl) { - if (auto m = match(line, rgx.native_header_main)) { + if (auto m = line.match(rgx.native_header_main)) { if (!empty(m.captures[2])) { if (hm == "creator") { dochead_meta[hm]["author"] = @@ -68,7 +66,7 @@ template SiSUheaderExtractNative() { && (dochead_make[hm])) { switch (hm) { case "make": - if (match(hs, rgx.native_subhead_make)) { + if (hs.match(rgx.native_subhead_make)) { if (dochead_make[hm][hs]) { dochead_make[hm][hs] = to!string(s.captures[2]); } @@ -84,7 +82,7 @@ template SiSUheaderExtractNative() { } else if (dochead_meta[hm]) { switch (hm) { case "creator": - if (match(hs, rgx.native_subhead_creator)) { + if (hs.match(rgx.native_subhead_creator)) { if (dochead_meta[hm][hs]) { dochead_meta[hm][hs] = to!string(s.captures[2]); @@ -96,7 +94,7 @@ template SiSUheaderExtractNative() { } break; case "title": - if (match(hs, rgx.native_subhead_title)) { + if (hs.match(rgx.native_subhead_title)) { if ((hs == "subtitle") && (dochead_meta[hm]["sub"])) { dochead_meta[hm]["sub"] = @@ -112,7 +110,7 @@ template SiSUheaderExtractNative() { } break; case "rights": - if (match(hs, rgx.native_subhead_rights)) { + if (hs.match(rgx.native_subhead_rights)) { if (dochead_meta[hm][hs]) { dochead_meta[hm][hs] = to!string(s.captures[2]); @@ -124,7 +122,7 @@ template SiSUheaderExtractNative() { } break; case "date": - if (match(hs, rgx.native_subhead_date)) { + if (hs.match(rgx.native_subhead_date)) { if (dochead_meta[hm][hs]) { dochead_meta[hm][hs] = to!string(s.captures[2]); @@ -136,7 +134,7 @@ template SiSUheaderExtractNative() { } break; case "original": - if (match(hs, rgx.native_subhead_original)) { + if (hs.match(rgx.native_subhead_original)) { if (dochead_meta[hm][hs]) { dochead_meta[hm][hs] = to!string(s.captures[2]); @@ -148,7 +146,7 @@ template SiSUheaderExtractNative() { } break; case "classify": - if (match(hs, rgx.native_subhead_classify)) { + if (hs.match(rgx.native_subhead_classify)) { if (dochead_meta[hm][hs]) { dochead_meta[hm][hs] = to!string(s.captures[2]); @@ -160,7 +158,7 @@ template SiSUheaderExtractNative() { } break; case "identifier": - if (match(hs, rgx.native_subhead_identifier)) { + if (hs.match(rgx.native_subhead_identifier)) { if (dochead_meta[hm][hs]) { dochead_meta[hm][hs] = to!string(s.captures[2]); @@ -172,7 +170,7 @@ template SiSUheaderExtractNative() { } break; case "notes": - if (match(hs, rgx.native_subhead_notes)) { + if (hs.match(rgx.native_subhead_notes)) { if (dochead_meta[hm][hs]) { dochead_meta[hm][hs] = to!string(s.captures[2]); @@ -184,7 +182,7 @@ template SiSUheaderExtractNative() { } break; case "publisher": - if (match(hs, rgx.native_subhead_publisher)) { + if (hs.match(rgx.native_subhead_publisher)) { if (dochead_meta[hm][hs]) { dochead_meta[hm][hs] = to!string(s.captures[2]); @@ -226,14 +224,14 @@ template SiSUheaderExtractNative() { static assert(is(typeof(an_object) == string[string])); static assert(is(typeof(type) == int[string])); } - if (matchFirst(line, rgx.native_header_make)) { /+ matched header_make +/ + if (line.matchFirst(rgx.native_header_make)) { /+ matched header_make +/ debug(header1) { /+ writeln(line); +/ } type["header"] = State.on; type["header_make"] = State.on; type["header_meta"] = State.off; ++line_occur["header_make"]; an_object["body_nugget"] ~= line ~= "\n"; - } else if (matchFirst(line, rgx.native_header)) { /+ matched header_metadata +/ + } else if (line.matchFirst(rgx.native_header)) { /+ matched header_metadata +/ /+ (generic header match and not previously caught by header_make) +/ debug(header1) { /+ writeln(line); +/ } type["header"] = State.on; @@ -243,14 +241,14 @@ template SiSUheaderExtractNative() { an_object["body_nugget"] ~= line ~= "\n"; } else if (type["header_make"] == State.on && (line_occur["header_make"] > State.off)) { /+ header_make flag set +/ - if (matchFirst(line, rgx.native_header_sub)) { /+ sub-header +/ + if (line.matchFirst(rgx.native_header_sub)) { /+ sub-header +/ debug(header1) { /+ writeln(line); +/ } ++line_occur["header_make"]; an_object["body_nugget"] ~= line ~= "\n"; } } else if (type["header_meta"] == State.on && (line_occur["header_meta"] > State.off)) { /+ header_metadata flag set +/ - if (matchFirst(line, rgx.native_header_sub)) { /+ sub-header +/ + if (line.matchFirst(rgx.native_header_sub)) { /+ sub-header +/ debug(header1) { /+ writeln(line); +/ } ++line_occur["header_meta"]; an_object["body_nugget"] ~= line ~= "\n"; @@ -291,14 +289,14 @@ template SiSUheaderExtractNative() { auto dochead_meta = meta_aa; auto set_header = HeaderDocMetadataAndMakeNativeToAA(); char[][] source_header_arr = - split(cast(char[]) src_header, rgx.newline_eol_delimiter); + (cast(char[]) src_header).split(rgx.newline_eol_delimiter); foreach(header_line; source_header_arr) { - if (auto m = matchFirst(header_line, rgx.comment)) { + if (auto m = header_line.matchFirst(rgx.comment)) { /+ matched comment +/ debug(comment) { } header_reset_states_common(line_occur, an_object, type); - } else if ((matchFirst(header_line, rgx.native_header)) + } else if ((header_line.matchFirst(rgx.native_header)) || (type["header_make"] == State.on && (line_occur["header_make"] > State.off)) || (type["header_meta"] == State.on -- cgit v1.2.3