From 2660db249780e6ec90bf63c43bc1e85785a88cf3 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 30 Apr 2019 19:22:32 -0400 Subject: regex, meta_abstraction, naming of some regex submatches --- org/default_regex.org | 54 +++++++++++++++++++++++++-------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) (limited to 'org/default_regex.org') diff --git a/org/default_regex.org b/org/default_regex.org index f316600..911832b 100644 --- a/org/default_regex.org +++ b/org/default_regex.org @@ -162,7 +162,7 @@ static heading_biblio_glossary = ctRegex!(`^:?(?:(1)[~][! static heading_biblio_blurb = ctRegex!(`^:?(?:(1)[~][!](?:(?:biblio(?:graphy)?|references?)|blurb)|[A-D1][~])`); static heading_blurb_glossary = ctRegex!(`^:?(?:(1)[~][!](?:blurb|glossary)|[A-D1][~])`); static para_bullet = ctRegex!(`^_[*] `); -static para_bullet_indent = ctRegex!(`^_([1-9])[*] `); +static para_bullet_indent = ctRegex!(`^_(?P[1-9])[*] `); static para_indent = ctRegex!(`^_(?P[1-9])[ ]`); static para_indent_hang = ctRegex!(`^_(?P[0-9])_(?P[0-9])[ ]`); static para_attribs = ctRegex!(`^_(?:(?:[0-9])(?:_([0-9]))?|(?:[1-9])?[*]) `); @@ -175,7 +175,7 @@ static para_inline_link_anchor = ctRegex!(`\*[~](?P(?:[ ,]+[0-9]+)+)[)][}]"); +static block_open = ctRegex!("^((code(?:[.][a-z][0-9a-z#+_]+)?|(?:poem|group|block|quote)(?:[.][a-z][0-9a-z_]+)?|table)(?:[(][ a-zA-Z0-9;:,]*[)])?[{][ ]*$)|^`{3} (code(?:[.][a-z][0-9a-z#+_]+)?|(?:poem|group|block|quote)(?:[.][a-z][0-9a-z_]+)?|table)(?:[(][ a-zA-Z0-9;:,]*[)])?|^[{]table[(](?:h;)?(?P(?:[ ,]+[0-9]+)+)[)][}]"); static block_poem_open = ctRegex!("^((poem(?:[(][ a-zA-Z0-9;:,]*[)])?[{][ ]*$)|`{3} poem(?:[(][ a-zA-Z0-9;:,]*[)])?)"); #+END_SRC @@ -184,12 +184,12 @@ static block_poem_open = ctRegex!("^((poem(?:[(][ #+name: meta_rgx #+BEGIN_SRC d /+ blocked markup tics +/ -static block_tic_open = ctRegex!("^`{3} (code(?:[.][a-z][0-9a-z_]+)?|poem|group|block|quote|table)"); -static block_tic_code_open = ctRegex!("^`{3} (?:code)(?:[.](?P[a-z][0-9a-z_]+))?(?:[(](?P[ a-zA-Z0-9;:,]*)[)])?"); -static block_tic_poem_open = ctRegex!("^`{3} (poem)(?:[(](?P[ a-zA-Z0-9;:,]*)[)])?"); -static block_tic_group_open = ctRegex!("^`{3} (group)(?:[(](?P[ a-zA-Z0-9;:,]*)[)])?"); -static block_tic_block_open = ctRegex!("^`{3} (block)(?:[(](?P[ a-zA-Z0-9;:,]*)[)])?"); -static block_tic_quote_open = ctRegex!("^`{3} (quote)(?:[(](?P[ a-zA-Z0-9;:,]*)[)])?"); +static block_tic_open = ctRegex!("^`{3} (code(?:[.][a-z][0-9a-z#+_]+)?|(?:poem|group|block|quote)(?:[.][a-z][0-9a-z_]+)?|table)"); +static block_tic_code_open = ctRegex!("^`{3} code(?:[.](?P[a-z][0-9a-z#+_]+))?(?:[(](?P[ a-zA-Z0-9;:,]*)[)])?"); +static block_tic_poem_open = ctRegex!("^`{3} poem(?:[.](?P[a-z][0-9a-z_]+))?(?:[(](?P[ a-zA-Z0-9;:,]*)[)])?"); +static block_tic_group_open = ctRegex!("^`{3} group(?:[.](?P[a-z][0-9a-z_]+))?(?:[(](?P[ a-zA-Z0-9;:,]*)[)])?"); +static block_tic_block_open = ctRegex!("^`{3} block(?:[.](?P[a-z][0-9a-z_]+))?(?:[(](?P[ a-zA-Z0-9;:,]*)[)])?"); +static block_tic_quote_open = ctRegex!("^`{3} quote(?:[.](?P[a-z][0-9a-z_]+))?(?:[(](?P[ a-zA-Z0-9;:,]*)[)])?"); static block_tic_table_open = ctRegex!("^`{3} table(?:[(](?P[ a-zA-Z0-9;:,]*)[)])?"); // ctRegex!("^`{3} table(?:\(.*?\))?"); static block_tic_close = ctRegex!("^(`{3})$","m"); #+END_SRC @@ -199,18 +199,18 @@ static block_tic_close = ctRegex!("^(`{3})$","m") #+name: meta_rgx #+BEGIN_SRC d /+ blocked markup curly +/ -static block_curly_open = ctRegex!(`^((?:code([.][a-z][0-9a-z_]+)?|poem|group|block|quote|table)(?:[(][ a-zA-Z0-9;:,]*[)])?[{][ ]*$)`); +static block_curly_open = ctRegex!(`^((?:code([.][a-z][0-9a-z#+_]+)?|(?:poem|group|block|quote)(?:[.][a-z][0-9a-z_]+)?|table)(?:[(][ a-zA-Z0-9;:,]*[)])?[{][ ]*$)`); static block_curly_code_open = ctRegex!(`^(?:code(?:[.](?P[a-z][0-9a-z_]+))?(?:[(](?P[ a-zA-Z0-9;:,]*)[)])?[{][ ]*$)`); static block_curly_code_close = ctRegex!(`^([}]code)`); -static block_curly_poem_open = ctRegex!(`^(poem(?:[(](?P[ a-zA-Z0-9;:,]*)[)])?[{][ ]*$)`); +static block_curly_poem_open = ctRegex!(`^(poem(?:[.](?P[a-z][0-9a-z_]+))?(?:[(](?P[ a-zA-Z0-9;:,]*)[)])?[{][ ]*$)`); static block_curly_poem_close = ctRegex!(`^([}]poem)`); -static block_curly_group_open = ctRegex!(`^(group(?:[(](?P[ a-zA-Z0-9;:,]*)[)])?[{][ ]*$)`); +static block_curly_group_open = ctRegex!(`^(group(?:[.](?P[a-z][0-9a-z_]+))?(?:[(](?P[ a-zA-Z0-9;:,]*)[)])?[{][ ]*$)`); static block_curly_group_close = ctRegex!(`^([}]group)`); -static block_curly_block_open = ctRegex!(`^(block(?:[(](?P[ a-zA-Z0-9;:,]*)[)])?[{][ ]*$)`); +static block_curly_block_open = ctRegex!(`^(block(?:[.](?P[a-z][0-9a-z_]+))?(?:[(](?P[ a-zA-Z0-9;:,]*)[)])?[{][ ]*$)`); static block_curly_block_close = ctRegex!(`^([}]block)`); -static block_curly_quote_open = ctRegex!(`^(quote(?:[(](?P[ a-zA-Z0-9;:,]*)[)])?[{][ ]*$)`); +static block_curly_quote_open = ctRegex!(`^(quote(?:[.](?P[a-z][0-9a-z_]+))?(?:[(](?P[ a-zA-Z0-9;:,]*)[)])?[{][ ]*$)`); static block_curly_quote_close = ctRegex!(`^([}]quote)`); -static block_curly_table_open = ctRegex!(`^table(?:[(]([?P a-zA-Z0-9;:,]*)[)])?[{][ ]*$`); +static block_curly_table_open = ctRegex!(`^table(?:[(](?P[ a-zA-Z0-9;:,]*)[)])?[{][ ]*$`); static block_curly_table_close = ctRegex!(`^([}]table)`); static block_curly_table_special_markup = ctRegex!(`^[{]table[(](?P(?:(h);)?(?P(?:[, ]+[0-9]+)+))[)][}]`, "mg"); #+END_SRC @@ -260,7 +260,7 @@ static inline_curly_delimiter_open_symbol_plus = ctRegex!(`~\{[+]\s`, "m" static inline_curly_delimiter_open_star_or_plus = ctRegex!(`~\{[+*]`, "m"); static inline_curly_delimiter_close_regular = ctRegex!(`\s*\}~`, "m"); static inline_text_and_note_curly = ctRegex!(`(?P.+?)(?:(?:[~])[{][*+ ]*)(?P.+?)(?:[}][~])`, "mg"); -static note_ref = ctRegex!(`^\S+?noteref_([0-9]+)`, "mg"); // {^{73.}^}#noteref_73 +static note_ref = ctRegex!(`^\S+?noteref_(?P[0-9]+)`, "mg"); // {^{73.}^}#noteref_73 #+END_SRC *** links/ urls :inline:footnote: @@ -301,7 +301,7 @@ static smid_image_delimit = ctRegex!(`(?P
^|[ ]
 #+name: meta_rgx
 #+BEGIN_SRC d
 /+ inline markup book index +/
-static book_index                                     = ctRegex!(`^=\{\s*(.+?)\}$`, "m");
+static book_index                                     = ctRegex!(`^=\{\s*(?P.+?)\}$`, "m");
 static book_index_open                                = ctRegex!(`^=\{\s*([^}]*?)$`);
 static book_index_close                               = ctRegex!(`^(.*?)\}$`, "m");
 #+END_SRC
@@ -539,7 +539,7 @@ static inline_image_without_dimensions                = ctRegex!(`(?P
┥)
 static inline_image_info                              = ctRegex!(`☼?(?P[a-zA-Z0-9._-]+?\.(?:jpg|gif|png)),w(?P\d+)h(?P\d+)`, "mg");
 static inline_link_anchor                             = ctRegex!(`┃(?P\S+?)┃`, "mg"); // TODO *~text_link_anchor
 static inline_link_                                   = ctRegex!(`┥(?P.+?)┝┤(?P.+?)├`, "mg");
-static inline_link                                    = ctRegex!(`┥(?P.+?)┝┤(?P\S+?)├`, "mg");
+static inline_link                                    = ctRegex!(`┥(?P.+?)┝┤(?P#?(\S+?))├`, "mg");
 static inline_link_empty                              = ctRegex!(`┥(?P.+?)┝┤├`, "mg");
 static inline_link_number                             = ctRegex!(`┥(?P.+?)┝┤(?P[0-9]+)├`, "mg"); // not used
 static inline_link_number_only                        = ctRegex!(`(┥.+?┝)┤(?P[0-9]+)├`, "mg");
@@ -565,16 +565,16 @@ static quotation_mark_various                         = ctRegex!(q"┃['‘’
 /+ inline markup font face mod +/
 static inline_mark_faces                            = ctRegex!(`(?P(?P[*!/_^,+#"-])\{(?P.+?)\}[*!/_^,+#"-])`, "mg");
 static inline_mark_faces_to_mod                     = ctRegex!(`(?P[*!/_^,+#"-])\{(?P.+?)\}([*!/_^,+#"-])`, "mg");
-static inline_mark_emphasis                         = ctRegex!(`([*])\{(?P.+?)\}[*]`, "mg");
-static inline_mark_bold                             = ctRegex!(`([!])\{(?P.+?)\}[!]`, "mg");
-static inline_mark_underscore                       = ctRegex!(`([_])\{(?P.+?)\}[_]`, "mg");
-static inline_mark_italics                          = ctRegex!(`([/])\{(?P.+?)\}[/]`, "mg");
-static inline_mark_superscript                      = ctRegex!(`(\^)\{(?P.+?)\}\^`, "mg");
-static inline_mark_subscript                        = ctRegex!(`([,])\{(?P.+?)\}[,]`, "mg");
-static inline_mark_strike                           = ctRegex!(`([-])\{(?P.+?)\}[-]`, "mg");
-static inline_mark_insert                           = ctRegex!(`([+])\{(?P.+?)\}[+]`, "mg");
-static inline_mark_mono                             = ctRegex!(`([#])\{(?P.+?)\}[#]`, "mg");
-static inline_mark_cite                             = ctRegex!(`(["])\{(?P.+?)\}["]`, "mg");
+static inline_mark_emphasis                         = ctRegex!(`(?P[*])\{(?P.+?)\}[*]`, "mg");
+static inline_mark_bold                             = ctRegex!(`(?P[!])\{(?P.+?)\}[!]`, "mg");
+static inline_mark_underscore                       = ctRegex!(`(?P[_])\{(?P.+?)\}[_]`, "mg");
+static inline_mark_italics                          = ctRegex!(`(?P[/])\{(?P.+?)\}[/]`, "mg");
+static inline_mark_superscript                      = ctRegex!(`(?P\^)\{(?P.+?)\}\^`, "mg");
+static inline_mark_subscript                        = ctRegex!(`(?P[,])\{(?P.+?)\}[,]`, "mg");
+static inline_mark_strike                           = ctRegex!(`(?P[-])\{(?P.+?)\}[-]`, "mg");
+static inline_mark_insert                           = ctRegex!(`(?P[+])\{(?P.+?)\}[+]`, "mg");
+static inline_mark_mono                             = ctRegex!(`(?P[#])\{(?P.+?)\}[#]`, "mg");
+static inline_mark_cite                             = ctRegex!(`(?P["])\{(?P.+?)\}["]`, "mg");
 static inline_mark_fontface_clean                   = ctRegex!(`[*!_/^,+#■"-]\{|\}[*!_/^,+#■"-]`, "mg");
 #+END_SRC
 
-- 
cgit v1.2.3