Omit/rewrite useless regexp repetitions
Problem reported by Mattias Engdegård in: https://lists.gnu.org/r/emacs-devel/2019-04/msg00527.html * lisp/align.el (align-rules-list): * lisp/cedet/srecode/srt-mode.el (srecode-font-lock-keywords): * lisp/emacs-lisp/copyright.el (copyright-regexp): * lisp/erc/erc-backend.el (JOIN): * lisp/erc/erc-goodies.el (erc-unmorse): * lisp/mail/mail-extr.el (mail-extr-telephone-extension-pattern): * lisp/net/tramp-adb.el (tramp-adb-prompt): * lisp/org/org-table.el (org-table-range-regexp): * lisp/progmodes/idlwave.el (idlwave-where): * lisp/progmodes/verilog-mode.el (verilog-declaration-re-2-no-macro) (verilog-declaration-re-2-macro, verilog-delete-auto-buffer) (verilog-auto-inst-port): * lisp/url/url-misc.el (url-data): Omit or rewrite useless repetitions that risk being very slow in the backtracking regexp engine in Emacs.
This commit is contained in:
parent
8635e011ed
commit
7ddd08bd3e
11 changed files with 16 additions and 16 deletions
|
@ -411,7 +411,7 @@ The possible settings for `align-region-separate' are:
|
|||
(c-variable-declaration
|
||||
(regexp . ,(concat "[*&0-9A-Za-z_]>?[&*]*\\(\\s-+[*&]*\\)"
|
||||
"[A-Za-z_][0-9A-Za-z:_]*\\s-*\\(\\()\\|"
|
||||
"=[^=\n].*\\|(.*)\\|\\(\\[.*\\]\\)*\\)?"
|
||||
"=[^=\n].*\\|(.*)\\|\\(\\[.*\\]\\)*\\)"
|
||||
"\\s-*[;,]\\|)\\s-*$\\)"))
|
||||
(group . 1)
|
||||
(modes . align-c++-modes)
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
(defvar srecode-font-lock-keywords
|
||||
'(
|
||||
;; Template
|
||||
("^\\(template\\)\\s-+\\(\\w*\\)\\(\\( \\(:\\w+\\)\\|\\)+\\)$"
|
||||
("^\\(template\\)\\s-+\\(\\w*\\)\\(\\( \\(:\\w+\\)\\)*\\)$"
|
||||
(1 font-lock-keyword-face)
|
||||
(2 font-lock-function-name-face)
|
||||
(3 font-lock-builtin-face ))
|
||||
|
|
|
@ -52,7 +52,7 @@ This is useful for ChangeLogs."
|
|||
(defcustom copyright-regexp
|
||||
"\\(©\\|@copyright{}\\|[Cc]opyright\\s *:?\\s *\\(?:(C)\\)?\
|
||||
\\|[Cc]opyright\\s *:?\\s *©\\)\
|
||||
\\s *\\(?:[^0-9\n]*\\s *\\)?\
|
||||
\\s *[^0-9\n]*\\s *\
|
||||
\\([1-9]\\([-0-9, ';/*%#\n\t]\\|\\s<\\|\\s>\\)*[0-9]+\\)"
|
||||
"What your copyright notice looks like.
|
||||
The second \\( \\) construct must match the years."
|
||||
|
|
|
@ -1285,7 +1285,7 @@ add things to `%s' instead."
|
|||
(pcase-let ((`(,nick ,login ,host)
|
||||
(erc-parse-user (erc-response.sender parsed))))
|
||||
;; strip the stupid combined JOIN facility (IRC 2.9)
|
||||
(if (string-match "^\\(.*\\)?\^g.*$" chnl)
|
||||
(if (string-match "^\\(.*\\)\^g.*$" chnl)
|
||||
(setq chnl (match-string 1 chnl)))
|
||||
(save-excursion
|
||||
(let* ((str (cond
|
||||
|
|
|
@ -548,7 +548,7 @@ channel that has weird people talking in morse to each other.
|
|||
|
||||
See also `unmorse-region'."
|
||||
(goto-char (point-min))
|
||||
(when (re-search-forward "[.-]+\\([.-]*/? *\\)+[.-]+/?" nil t)
|
||||
(when (re-search-forward "[.-]+[./ -]*[.-]/?" nil t)
|
||||
(save-restriction
|
||||
(narrow-to-region (match-beginning 0) (match-end 0))
|
||||
;; Turn " / " into " "
|
||||
|
|
|
@ -383,7 +383,7 @@ by translating things like \"foo!bar!baz@host\" into \"baz@bar.UUCP\"."
|
|||
;; Matches telephone extensions.
|
||||
(defconst mail-extr-telephone-extension-pattern
|
||||
(purecopy
|
||||
"\\(\\([Ee]xt\\|\\|[Tt]ph\\|[Tt]el\\|[Xx]\\).?\\)? *\\+?[0-9][- 0-9]+"))
|
||||
"\\(\\([Ee]xt\\|[Tt]ph\\|[Tt]el\\|[Xx]\\).?\\)? *\\+?[0-9][- 0-9]+"))
|
||||
|
||||
;; Matches ham radio call signs.
|
||||
;; Help from: Mat Maessen N2NJZ <maessm@rpi.edu>, Mark Feit
|
||||
|
|
|
@ -53,7 +53,7 @@ It is used for TCP/IP devices."
|
|||
"When this method name is used, forward all calls to Android Debug Bridge.")
|
||||
|
||||
(defcustom tramp-adb-prompt
|
||||
"^\\(?:[[:digit:]]*|?\\)?\\(?:[[:alnum:]\e;[]*@?[[:alnum:]]*[^#\\$]*\\)?[#\\$][[:space:]]"
|
||||
"^[[:digit:]]*|?\\(?:[[:alnum:]\e;[]*@?[[:alnum:]]*[^#\\$]*\\)?[#\\$][[:space:]]"
|
||||
"Regexp used as prompt in almquist shell."
|
||||
:type 'string
|
||||
:version "24.4"
|
||||
|
|
|
@ -484,8 +484,8 @@ Line numbers are counted from the beginning of the table. This
|
|||
variable is initialized with `org-table-analyze'.")
|
||||
|
||||
(defconst org-table-range-regexp
|
||||
"@\\([-+]?I*[-+]?[0-9]*\\)?\\(\\$[-+]?[0-9]+\\)?\\(\\.\\.@?\\([-+]?I*[-+]?[0-9]*\\)?\\(\\$[-+]?[0-9]+\\)?\\)?"
|
||||
;; 1 2 3 4 5
|
||||
"@\\([-+]?I*[-+]?[0-9]*\\)\\(\\$[-+]?[0-9]+\\)?\\(\\.\\.@?\\([-+]?I*[-+]?[0-9]*\\)\\(\\$[-+]?[0-9]+\\)?\\)?"
|
||||
;; 1 2 3 4 5
|
||||
"Regular expression for matching ranges in formulas.")
|
||||
|
||||
(defconst org-table-range-regexp2
|
||||
|
|
|
@ -6454,10 +6454,10 @@ ARROW: Location of the arrow"
|
|||
((string-match "\\`[ \t]*\\(pro\\|function\\)\\>"
|
||||
match-string)
|
||||
nil)
|
||||
((string-match "OBJ_NEW([ \t]*['\"]\\([a-zA-Z0-9$_]*\\)?\\'"
|
||||
((string-match "OBJ_NEW([ \t]*['\"][a-zA-Z0-9$_]*\\'"
|
||||
match-string)
|
||||
(setq cw 'class))
|
||||
((string-match "\\<inherits\\s-+\\([a-zA-Z0-9$_]*\\)?\\'"
|
||||
((string-match "\\<inherits\\s-+[a-zA-Z0-9$_]*\\'"
|
||||
match-string)
|
||||
(setq cw 'class))
|
||||
((and func
|
||||
|
|
|
@ -2761,12 +2761,12 @@ find the errors."
|
|||
(defconst verilog-declaration-re-2-no-macro
|
||||
(concat "\\s-*" verilog-declaration-re
|
||||
"\\s-*\\(\\(" verilog-optional-signed-range-re "\\)\\|\\(" verilog-delay-re "\\)"
|
||||
"\\)?"))
|
||||
"\\)"))
|
||||
(defconst verilog-declaration-re-2-macro
|
||||
(concat "\\s-*" verilog-declaration-re
|
||||
"\\s-*\\(\\(" verilog-optional-signed-range-re "\\)\\|\\(" verilog-delay-re "\\)"
|
||||
"\\|\\(" verilog-macroexp-re "\\)"
|
||||
"\\)?"))
|
||||
"\\)"))
|
||||
(defconst verilog-declaration-re-1-macro
|
||||
(concat "^" verilog-declaration-re-2-macro))
|
||||
|
||||
|
@ -10810,7 +10810,7 @@ Intended for internal use inside a `verilog-save-font-no-change-functions' block
|
|||
'verilog-delete-auto-star-all)
|
||||
;; Remove template comments ... anywhere in case was pasted after AUTOINST removed
|
||||
(goto-char (point-min))
|
||||
(while (re-search-forward "\\s-*// \\(Templated\\|Implicit \\.\\*\\)\\([ \tLT0-9]*\\| LHS: .*\\)?$" nil t)
|
||||
(while (re-search-forward "\\s-*// \\(Templated\\|Implicit \\.\\*\\)\\([ \tLT0-9]*\\| LHS: .*\\)$" nil t)
|
||||
(replace-match ""))
|
||||
|
||||
;; Final customize
|
||||
|
@ -11412,7 +11412,7 @@ If PAR-VALUES replace final strings with these parameter values."
|
|||
(when tpl-ass
|
||||
;; Evaluate @"(lispcode)"
|
||||
(when (string-match "@\".*[^\\]\"" tpl-net)
|
||||
(while (string-match "@\"\\(\\([^\\\"]*\\(\\\\.\\)*\\)*\\)\"" tpl-net)
|
||||
(while (string-match "@\"\\(\\([^\\\"]\\|\\\\.\\)*\\)\"" tpl-net)
|
||||
(setq tpl-net
|
||||
(concat
|
||||
(substring tpl-net 0 (match-beginning 0))
|
||||
|
|
|
@ -88,7 +88,7 @@
|
|||
(encoding "8bit")
|
||||
(data nil))
|
||||
(save-excursion
|
||||
(if (not (string-match "\\([^,]*\\)?," desc))
|
||||
(if (not (string-match "\\([^,]*\\)," desc))
|
||||
(error "Malformed data URL: %s" desc)
|
||||
(setq mediatype (match-string 1 desc)
|
||||
data (url-unhex-string (substring desc (match-end 0))))
|
||||
|
|
Loading…
Add table
Reference in a new issue