[Xfce4-commits] [apps/xfce4-terminal] 01/01: Update terminal regexes from gnome-terminal

noreply at xfce.org noreply at xfce.org
Mon Jul 16 23:35:02 CEST 2018


This is an automated email from the git hooks/post-receive script.

f   2   4   0   4       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository apps/xfce4-terminal.

commit 95b48905cea9e31d543dc92089d0bbcab86f3981
Author: Igor <f2404 at yandex.ru>
Date:   Mon Jul 16 17:34:11 2018 -0400

    Update terminal regexes from gnome-terminal
    
    regex: Allow apostrophes in URLs, except when enclosed between them
    https://bugzilla.gnome.org/show_bug.cgi?id=448044
---
 terminal/terminal-regex.h | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/terminal/terminal-regex.h b/terminal/terminal-regex.h
index 2ed28d7..23d3266 100644
--- a/terminal/terminal-regex.h
+++ b/terminal/terminal-regex.h
@@ -44,6 +44,9 @@
 #ifndef TERMINAL_REGEX_H
 #define TERMINAL_REGEX_H
 
+/* Lookbehind to see if there's a preceding apostrophe */
+#define APOS_START_DEF "(?<APOS_START>(?<='))?"
+
 #define SCHEME "(?ix: news | telnet | nntp | https? | ftps? | sftp | webcal )"
 
 #define USERCHARS "-+.[:alnum:]"
@@ -123,21 +126,22 @@
 #define PORT "(?x: \\:" N_1_65535 " )?"
 
 /* Omit the parentheses, see below */
-#define PATHCHARS_CLASS "[-[:alnum:]\\Q_$.+!*,:;@&=?/~#|%\\E]"
-/* Chars to end a URL */
-#define PATHTERM_CLASS "[-[:alnum:]\\Q_$+*:@&=/~#|%\\E]"
+#define PATHCHARS_CLASS "[-[:alnum:]\\Q_$.+!*,:;@&=?/~#|%'\\E]"
+/* Chars to end a URL. Apostrophe only allowed if there wasn't one in front of the URL, see bug 448044 */
+#define PATHTERM_CLASS        "[-[:alnum:]\\Q_$+*:@&=/~#|%'\\E]"
+#define PATHTERM_NOAPOS_CLASS "[-[:alnum:]\\Q_$+*:@&=/~#|%\\E]"
 
 /* Recursive definition of PATH that allows parentheses and square brackets only if balanced, see bug 763980. */
 #define PATH_INNER_DEF "(?(DEFINE)(?<PATH_INNER>(?x: (?: " PATHCHARS_CLASS "* (?: \\( (?&PATH_INNER) \\) | \\[ (?&PATH_INNER) \\] ) )* " PATHCHARS_CLASS "* )))"
 /* Same as above, but the last character (if exists and is not a parenthesis) must be from PATHTERM_CLASS. */
-#define PATH_DEF "(?(DEFINE)(?<PATH>(?x: (?: " PATHCHARS_CLASS "* (?: \\( (?&PATH_INNER) \\) | \\[ (?&PATH_INNER) \\] ) )* (?: " PATHCHARS_CLASS "* " PATHTERM_CLASS " )? )))"
+#define PATH_DEF "(?(DEFINE)(?<PATH>(?x: (?: " PATHCHARS_CLASS "* (?: \\( (?&PATH_INNER) \\) | \\[ (?&PATH_INNER) \\] ) )* (?: " PATHCHARS_CLASS "* (?(<APOS_START>)" PATHTERM_NOAPOS_CLASS "|" PATHTERM_CLASS ") )? )))"
 
 #define URLPATH "(?x: /(?&PATH) )?"
 #define VOIP_PATH "(?x: [;?](?&PATH) )?"
 
 /* Now let's put these fragments together */
 
-#define DEFS IP_DEF PATH_INNER_DEF PATH_DEF
+#define DEFS APOS_START_DEF IP_DEF PATH_INNER_DEF PATH_DEF
 
 #define REGEX_URL_AS_IS  DEFS SCHEME "://" USERPASS URL_HOST PORT URLPATH
 /* TODO: also support file:/etc/passwd */

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list