From 9c14b019a6f695b54a035605e3bb3fc76bf20aa6 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 24 Apr 2016 22:35:39 -0400 Subject: step2 --- lib/sdp/ao_rgx.d | 50 +++++++++++++++++++++++++++++++++++++------------- 1 file changed, 37 insertions(+), 13 deletions(-) (limited to 'lib/sdp/ao_rgx.d') diff --git a/lib/sdp/ao_rgx.d b/lib/sdp/ao_rgx.d index 4c36ff9..e675ca1 100644 --- a/lib/sdp/ao_rgx.d +++ b/lib/sdp/ao_rgx.d @@ -2,7 +2,7 @@ regex ao_rgx.d +/ -mixin template RgxInit() { +template RgxInit() { struct Rgx { /+ misc +/ static flag_action = ctRegex!(`^(--[a-z][a-z0-9-]+)$`); @@ -11,11 +11,14 @@ mixin template RgxInit() { static src_fn = ctRegex!(`^([a-zA-Z0-9._-]+/)*([a-zA-Z0-9._-]+[.]ss[tm])$`); static src_fn_master = ctRegex!(`^([a-zA-Z0-9._-]+/)*([a-zA-Z0-9._-]+[.]ssm)$`); static src_fn_find_inserts = ctRegex!(`^([a-zA-Z0-9._-]+/)*([a-zA-Z0-9._-]+[.]ss[im])$`); + // static ssm_fn = ctRegex!(`^[a-zA-Z0-9._-]+[.]ssm$`); static line_delimiter = ctRegex!("\n"); + // static arr_delimiter = ctRegex!(`\s*[;]\s*`); static within_quotes = ctRegex!(`"(.+?)"`); static make_heading_delimiter = ctRegex!(`[;][ ]*`); static arr_delimiter = ctRegex!(`[ ]*[;][ ]*`); static name_delimiter = ctRegex!(`^([^,]+)[ ]*,[ ]+(.+?)$`); + // static name_delimiter = ctRegex!(`^(.+?)[ ]*,[ ]*(.+?)$`); static book_index_go = ctRegex!("([0-9]+)(?:-[0-9]+)?"); static trailing_comma = ctRegex!(",[ ]*$"); static trailing_linebreak = ctRegex!(",[ ]{1,2}\\\\\\\\\n[ ]{4}$","m"); @@ -26,6 +29,7 @@ mixin template RgxInit() { static levels_numbered = ctRegex!(`^[0-9]$`); static levels_numbered_headings = ctRegex!(`^[0-7]$`); /+ insert markup file +/ + // static insert_src_fn_ssi_or_sst = ctRegex!(`^<<\s*([a-zA-Z0-9._-]+/)*(?P[a-zA-Z0-9._-]+[.]ss[ti])$`); static insert_src_fn_ssi_or_sst = ctRegex!(`^<<\s*(?P[a-zA-Z0-9._-]+/)*(?P[a-zA-Z0-9._-]+[.]ss[ti])$`); // static insert_ssi_or_sst_fn = ctRegex!(`^<<\s*[a-zA-Z0-9._-]+[.]ss[ti]`); /+ comments +/ @@ -49,7 +53,13 @@ mixin template RgxInit() { static para_indent = ctRegex!(`^_([1-9]) `); static para_indent_hang = ctRegex!(`^_([0-9])_([0-9]) `); static para_attribs = ctRegex!(`^_(([0-9])(_([0-9]))?|_([1-9])?[*]) `); + /+ blocked markup +/ + static block_open = ctRegex!("^((code|poem|group|block|quote|table)[{].*?$)|^`{3} (code|poem|group|block|quote|table)"); + // static block_open_less_code = ctRegex!("^(((poem|group|block|quote|table)[{].*?$)|`{3} (poem|group|block|quote|table))"); + static block_poem_open = ctRegex!("^((poem[{].*?$)|`{3} poem)"); /+ blocked markup tics +/ + static block_tic_open = ctRegex!("^`{3} (code|poem|group|block|quote|table)"); + // static block_tic_open_less_code = ctRegex!("^`{3} (poem|group|block|quote|table)"); static block_tic_code_open = ctRegex!("^`{3} (code)"); static block_tic_poem_open = ctRegex!("^`{3} (poem)"); static block_tic_group_open = ctRegex!("^`{3} (group)"); @@ -58,6 +68,8 @@ mixin template RgxInit() { static block_tic_table_open = ctRegex!("^`{3} (table)"); static block_tic_close = ctRegex!("^(`{3})$","m"); /+ blocked markup curly +/ + static block_curly_open = ctRegex!(`^((code|poem|group|block|quote|table)[{].*?$)`); + // static block_curly_open_less_code = ctRegex!(`^((poem|group|block|quote|table)[{].*?$)`); static block_curly_code_open = ctRegex!(`^(code[{].*?$)`); static block_curly_code_close = ctRegex!(`^([}]code)`); static block_curly_poem_open = ctRegex!(`^(poem[{].*?$)`); @@ -85,22 +97,33 @@ mixin template RgxInit() { static inline_notes_al_gen = ctRegex!(`【.+?】`, "m"); static inline_notes_curly_gen = ctRegex!(`~\{.+?\}~`, "m"); static inline_notes_curly = ctRegex!(`~\{\s*(.+?)\}~`, "mg"); + // static inline_notes_curly = ctRegex!(`~\{(?:[*+]\s+|\s*)(.+?)\}~`, "mg"); static inline_al_delimiter_open_regular = ctRegex!(`【`, "m"); static inline_al_delimiter_close_regular = ctRegex!(`】`, "m"); static inline_al_delimiter_open_and_close_regular = ctRegex!(`【|】`, "m"); static inline_notes_delimiter_al_regular = ctRegex!(`【(.+?)】`, "m"); static inline_notes_delimiter_al_regular_number_note = ctRegex!(`【(\d+)\s+(.+?)】`, "m"); + static inline_al_delimiter_open_asterisk = ctRegex!(`【\*`, "m"); static inline_al_delimiter_open_plus = ctRegex!(`【\+`, "m"); + static inline_curly_delimiter_open_regular = ctRegex!(`~\{\s*`, "m"); static inline_curly_delimiter_close_regular = ctRegex!(`\s*\}~`, "m"); static inline_curly_delimiter_open_and_close_regular = ctRegex!(`~\{\s*|\s*\}~`, "m"); static inline_notes_delimiter_curly_regular = ctRegex!(`~\{[ ]*(.+?)\}~`, "m"); + // static inline_notes_curly_regular = ctRegex!(`(?:[~][{][ ]*)(.+?)(?:[}][~])`, "m"); + // static inline_notes_curly_regular = ctRegex!(`~\{\s*(.+?)\}~`, "m"); + // static inline_notes_curly = ctRegex!(`~\{(?:[*+]\s+|\s*)(.+?)\}~`, "mg"); static inline_notes_curly_sp = ctRegex!(`~\{[*+]+\s+(.+?)\}~`, "m"); static inline_notes_curly_sp_asterisk = ctRegex!(`~\{[*]+\s+(.+?)\}~`, "m"); static inline_notes_curly_sp_plus = ctRegex!(`~\{[+]+\s+(.+?)\}~`, "m"); + // static inline_text_and_note_curly = ctRegex!(`(.+?)~\{(?:[*+]\s+|\s*)(.+?)\}~`, "mg"); static inline_text_and_note_al = ctRegex!(`(?P.+?)【(?:[*+ ]*)(?P.+?)】`, "mg"); static inline_text_and_note_curly = ctRegex!(`(?P.+?)(?:(?:[~])[{][*+ ]*)(?P.+?)(?:[}][~])`, "mg"); + // static inline_text_and_note_curly = ctRegex!(`(?P.+?)~\{(?:[*+]\s+|\s*)(?P.+?)\}~`, "mg"); + // static inline_text_and_note_curly_sp = ctRegex!(`(.+?)~\{[*+]+\s+(.+?)\}~`, "mg"); + // static inline_text_and_note_curly_sp_asterisk = ctRegex!(`(.+?)~\{[*]+\s+(.+?)\}~`, "mg"); + // static inline_text_and_note_curly_sp_plus = ctRegex!(`(.+?)~\{[+]+\s+(.+?)\}~`, "mg"); static inline_note_curly_delimiters = ctRegex!(`(~\{[*+]?\s*)(.+?)(\}~)`, "mg"); static inline_notes_square = ctRegex!(`~\[\s*(.+?)\]~`, "mg"); static inline_text_and_note_square_sp = ctRegex!(`(.+?)~\[[*+]+\s+(.+?)\]~`, "mg"); @@ -110,16 +133,16 @@ mixin template RgxInit() { static book_index = ctRegex!(`^=\{\s*(.+?)\}$`, "m"); static book_index_open = ctRegex!(`^=\{\s*([^}]+?)$`); static book_index_close = ctRegex!(`^(.*?)\}$`, "m"); // strip - /+ no ocn object +/ - static ocn_off = ctRegex!(`~#$`, "m"); - static ocn_off_dh = ctRegex!(`-#$`, "m"); - static ocn_off_all = ctRegex!(`[~-]#$`, "m"); - /+ no ocn block +/ - static ocn_off_block = ctRegex!(`^--~#$`); - static ocn_off_block_dh = ctRegex!(`^---#$`); - static ocn_off_block_close = ctRegex!(`^--\+#$`); - // static auto_ocn_ignore = ctRegex!(`^[+~*$-]{3,}$`); // reminder - static ocn_block_marks = ctRegex!(`^--[+~-]#$`); + /+ no obj_cite_number object +/ + static obj_cite_number_off = ctRegex!(`~#$`, "m"); + static obj_cite_number_off_dh = ctRegex!(`-#$`, "m"); + static obj_cite_number_off_all = ctRegex!(`[~-]#$`, "m"); + /+ no obj_cite_number block +/ + static obj_cite_number_off_block = ctRegex!(`^--~#$`); + static obj_cite_number_off_block_dh = ctRegex!(`^---#$`); + static obj_cite_number_off_block_close = ctRegex!(`^--\+#$`); + // static auto_obj_cite_number_ignore = ctRegex!(`^[+~*$-]{3,}$`); // reminder + static obj_cite_number_block_marks = ctRegex!(`^--[+~-]#$`); /+ ignore outside code blocks +/ static regular_parse_skip = ctRegex!(`^(--[+~-]#|-[\\]{2}-|=[.\\]{2}=)$`); // not structural info /+ line & page breaks +/ @@ -148,10 +171,11 @@ mixin template RgxInit() { /+ biblio tags +/ static biblio_tags = ctRegex!(`^(is|au|author_raw|author|author_arr|editor_raw|ed|editor_arr|ti|title|subtitle|fulltitle|lng|language|trans|src|jo|journal|in|vol|volume|edn|edition|yr|year|pl|place|pb|pub|publisher|url|pg|pages|note|short_name|id):\s+(.+)`); static biblio_abbreviations = ctRegex!(`^(au|ed|ti|lng|jo|vol|edn|yr|pl|pb|pub|pg|pgs|sn)$`); + // static biblio_tags = ctRegex!(`^(is|author_raw|author|author_arr|editor_raw|editor_arr|title|subtitle|fulltitle|language|trans|src|journal|in|volume|edition|year|place|publisher|url|pages|note|short_name|id):\s+(.+)`); /+ bookindex split +/ static bi_main_terms_split = ctRegex!(`\s*;\s*`); static bi_main_term_plus_rest_split = ctRegex!(`\s*:\s*`); - static bi_sub_terms_plus_ocn_offset_split = ctRegex!(`\s*\|\s*`); - static bi_term_and_ocns_match = ctRegex!(`^(.+?)\+(\d+)`); + static bi_sub_terms_plus_obj_cite_number_offset_split = ctRegex!(`\s*\|\s*`); + static bi_term_and_obj_cite_numbers_match = ctRegex!(`^(.+?)\+(\d+)`); } } -- cgit v1.2.3