From de02319cfa7b4bbff8c111bda02be1a7c6591555 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 5 Jan 2020 20:17:17 -0500 Subject: dlang safe default imminent, look ahead - @safe @trusted & @system, reconsider @trusted --- src/doc_reform/io_in/read_source_files.d | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src/doc_reform/io_in/read_source_files.d') diff --git a/src/doc_reform/io_in/read_source_files.d b/src/doc_reform/io_in/read_source_files.d index ba3e145..fcbd075 100644 --- a/src/doc_reform/io_in/read_source_files.d +++ b/src/doc_reform/io_in/read_source_files.d @@ -15,7 +15,7 @@ static template spineRawMarkupContent() { mixin spineRgxInit; static auto rgx = Rgx(); string[] _images=[]; - string[] _extract_images(S)(S content_block) @safe { + @safe string[] _extract_images(S)(S content_block) { string[] images_; string _content_block = content_block.to!string; if (auto m = _content_block.matchAll(rgx.image)) { @@ -35,19 +35,19 @@ static template spineRawMarkupContent() { string[], "insert_files", string[], "images" ); - auto spineRawMarkupContent(O,Fn)(O _opt_action, Fn fn_src) @safe { + @safe auto spineRawMarkupContent(O,Fn)(O _opt_action, Fn fn_src) { auto _0_header_1_body_content_2_insert_filelist_tuple = rawsrc.sourceContentSplitIntoHeaderAndBody(_opt_action, rawsrc.sourceContent(fn_src), fn_src); return _0_header_1_body_content_2_insert_filelist_tuple; } struct RawMarkupContent { - final sourceContent(in string fn_src) { + @safe final sourceContent(in string fn_src) { auto raw = MarkupRawUnit(); string source_txt_str = raw.markupSourceReadIn(fn_src); return source_txt_str; } - final auto sourceContentSplitIntoHeaderAndBody(O)( + @safe final auto sourceContentSplitIntoHeaderAndBody(O)( O _opt_action, in string source_txt_str, in string fn_src="" @@ -84,7 +84,7 @@ static template spineRawMarkupContent() { } struct MarkupRawUnit { import std.file; - final private string readInMarkupSource(in char[] fn_src) { + @safe final private string readInMarkupSource(in char[] fn_src) { enforce( exists(fn_src) != 0, "file not found: «" ~ @@ -107,7 +107,7 @@ static template spineRawMarkupContent() { std.utf.validate(source_txt_str); return source_txt_str; } - final private char[][] header0Content1(in string src_text) @trusted { // cast(char[]) + @trusted final private char[][] header0Content1(in string src_text) { // cast(char[]) /+ split string on _first_ match of "^:?A~\s" into [header, content] array/tuple +/ char[][] header_and_content; auto m = (cast(char[]) src_text).matchFirst(rgx.heading_a); @@ -120,12 +120,12 @@ static template spineRawMarkupContent() { ); return header_and_content; } - final private char[][] markupSourceLineArray(in char[] src_text) @trusted { // cast(char[]) + @trusted final private char[][] markupSourceLineArray(in char[] src_text) { // cast(char[]) char[][] source_line_arr = (cast(char[]) src_text).split(rgx.newline_eol_strip_preceding); return source_line_arr; } - string markupSourceReadIn(in string fn_src) { + @safe string markupSourceReadIn(in string fn_src) { static auto rgx = Rgx(); enforce( fn_src.match(rgx.src_pth_sst_or_ssm), @@ -135,7 +135,7 @@ static template spineRawMarkupContent() { string source_txt_str = readInMarkupSource(fn_src); return source_txt_str; } - HeaderContentInsertsImages markupSourceHeaderContentRawLineTupleArray(in string source_txt_str) @safe { + @safe HeaderContentInsertsImages markupSourceHeaderContentRawLineTupleArray(in string source_txt_str) { string[] file_insert_list = []; string[] images_list = []; char[][] hc = header0Content1(source_txt_str); @@ -150,7 +150,7 @@ static template spineRawMarkupContent() { ); return t; } - final char[][] getInsertMarkupSourceContentRawLineArray( + @safe final char[][] getInsertMarkupSourceContentRawLineArray( in char[] fn_src_insert, Regex!(char) rgx_file ) { @@ -169,7 +169,7 @@ static template spineRawMarkupContent() { char[][], "insert_contents", string[], "images" ); - ContentsAndImages scan_subdoc_source(O)( + @safe ContentsAndImages scan_subdoc_source(O)( O _opt_action, char[][] markup_sourcefile_insert_content, string fn_src @@ -254,7 +254,7 @@ static template spineRawMarkupContent() { ); return t; } - ContentsInsertsImages scan_master_src_for_insert_files_and_import_content(O)( + @safe ContentsInsertsImages scan_master_src_for_insert_files_and_import_content(O)( O _opt_action, char[][] sourcefile_body_content, string fn_src -- cgit v1.2.3