[Xfce4-commits] [apps/xfce4-terminal] 01/01: Take gnome-terminal regexes update

noreply at xfce.org noreply at xfce.org
Wed May 31 02:31:41 CEST 2017


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 37ac19b0eb884fc8b6ad94e33cfd946f3ccfb437
Author: Igor <f2404 at yandex.ru>
Date:   Tue May 30 20:31:30 2017 -0400

    Take gnome-terminal regexes update
---
 terminal/terminal-regex.h | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/terminal/terminal-regex.h b/terminal/terminal-regex.h
index 358f330..be0e2b7 100644
--- a/terminal/terminal-regex.h
+++ b/terminal/terminal-regex.h
@@ -122,21 +122,26 @@
 /* Optional colon-prefixed port, e.g. ":1080", "" */
 #define PORT "(?x: \\:" N_1_65535 " )?"
 
+/* Omit the parentheses, see below */
 #define PATHCHARS_CLASS "[-[:alnum:]\\Q_$.+!*,:;@&=?/~#|%\\E]"
-/* Chars not to end a URL */
-#define PATHNONTERM_CLASS "[\\Q.!,?\\E]"
+/* Chars to end a URL */
+#define PATHTERM_CLASS "[-[:alnum:]\\Q_$+*:;@&=/~#|%\\E]"
 
-/* Lookbehind at the end, so that the last character (if we matched a character at all) is not from PATHTERM_CLASS */
-#define URLPATH "(?x: /" PATHCHARS_CLASS "* (?<! " PATHNONTERM_CLASS " ) )?"
-#define VOIP_PATH "(?x: [;?]" PATHCHARS_CLASS "* (?<! " PATHNONTERM_CLASS " ) )?"
+/* Recursive definition of PATH that allows parentheses only if balanced, see bug 763980. */
+#define PATH_INNER_DEF "(?(DEFINE)(?<PATH_INNER>(?x: (?: " PATHCHARS_CLASS "* \\( (?&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) \\) )* (?: " PATHCHARS_CLASS "* " PATHTERM_CLASS " )? )))"
+
+#define URLPATH "(?x: /(?&PATH) )?"
+#define VOIP_PATH "(?x: [;?](?&PATH) )?"
 
 /* Now let's put these fragments together */
 
-#define DEFS IP_DEF
+#define DEFS 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 */
-#define REGEX_URL_FILE   DEFS "(?ix: file:/ (?: / (?: " HOSTNAME1 " )? / )? (?! / ) )(?x: " PATHCHARS_CLASS "+ (?<! " PATHNONTERM_CLASS " ) )?" 
+#define REGEX_URL_FILE   DEFS "(?ix: file:/ (?: / (?: " HOSTNAME1 " )? / )? (?! / ) )(?&PATH)"
 /* Lookbehind so that we don't catch "abc.www.foo.bar", bug 739757. Lookahead for www/ftp for convenience (so that we can reuse HOSTNAME1). */
 #define REGEX_URL_HTTP   DEFS "(?<!(?:" HOSTNAMESEGMENTCHARS_CLASS "|[.]))(?=(?i:www|ftp))" HOSTNAME1 PORT URLPATH
 #define REGEX_URL_VOIP   DEFS "(?i:h323:|sips?:)" USERPASS URL_HOST PORT VOIP_PATH

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


More information about the Xfce4-commits mailing list