1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-20 18:17:20 +00:00

Fix regexp branches that subsume other branches

Problems reported by Mattias Engdegård in:
https://lists.gnu.org/r/emacs-devel/2019-04/msg00803.html
* lisp/arc-mode.el (archive-rar-summarize):
* lisp/eshell/em-hist.el (eshell-hist-word-designator):
* lisp/info.el (Info-dir-remove-duplicates):
* lisp/international/ja-dic-cnv.el (skkdic-convert-postfix)
(skkdic-convert-prefix, skkdic-collect-okuri-nasi):
* lisp/progmodes/cc-awk.el (c-awk-esc-pair-re):
* lisp/xml.el (xml-att-type-re):
Omit regexp branches that subsume other branches.
* lisp/progmodes/cperl-mode.el (cperl-beautify-regexp-piece):
$ and ^ aren’t simple-codes.
This commit is contained in:
Paul Eggert 2019-04-19 09:00:04 -07:00
parent e6a9785f82
commit 9e4bb0d221
7 changed files with 10 additions and 11 deletions

View File

@ -2019,7 +2019,7 @@ This doesn't recover lost files, it just undoes changes in the buffer itself."
(re-search-forward "^\\(\s+=+\s*\\)+\n")
(while (looking-at (concat "^\s+[0-9.]+\s+D?-+\s+" ; Flags
"\\([0-9-]+\\)\s+" ; Size
"\\([-0-9.%]+\\|-+\\)\s+" ; Ratio
"\\([-0-9.%]+\\)\s+" ; Ratio
"\\([0-9a-zA-Z]+\\)\s+" ; Mode
"\\([0-9-]+\\)\s+" ; Date
"\\([0-9:]+\\)\s+" ; Time

View File

@ -153,7 +153,7 @@ element, regardless of any text on the command line. In that case,
:group 'eshell-hist)
(defcustom eshell-hist-word-designator
"^:?\\([0-9]+\\|[$^%*]\\)?\\(\\*\\|-[0-9]*\\|[$^%*]\\)?"
"^:?\\([0-9]+\\|[$^%*]\\)?\\(-[0-9]*\\|[$^%*]\\)?"
"The regexp used to identify history word designators."
:type 'regexp
:group 'eshell-hist)

View File

@ -1531,7 +1531,7 @@ is non-nil)."
(save-restriction
(narrow-to-region start (point))
(goto-char (point-min))
(while (re-search-forward "^\\* \\([^:\n]+:\\(:\\|[^.\n]+\\).\\)" nil 'move)
(while (re-search-forward "^\\* \\([^:\n]+:[^.\n]+.\\)" nil 'move)
;; Fold case straight away; `member-ignore-case' here wasteful.
(let ((x (downcase (match-string 1))))
(if (member x seen)

View File

@ -124,7 +124,7 @@
(setq l (cdr l)))))
;; Search postfix entries.
(while (re-search-forward "^[#<>?]\\(\\(\\cH\\|ー\\)+\\) " nil t)
(while (re-search-forward "^[#<>?]\\(\\cH+\\) " nil t)
(let ((kana (match-string-no-properties 1))
str candidates)
(while (looking-at "/[#0-9 ]*\\([^/\n]*\\)/")
@ -157,7 +157,7 @@
(insert ";; Setting prefix entries.\n"
"(skkdic-set-prefix\n"))
(save-excursion
(while (re-search-forward "^\\(\\(\\cH\\|ー\\)+\\)[<>?] " nil t)
(while (re-search-forward "^\\(\\cH+\\)[<>?] " nil t)
(let ((kana (match-string-no-properties 1))
str candidates)
(while (looking-at "/\\([^/\n]+\\)/")
@ -275,11 +275,11 @@
(let ((progress (make-progress-reporter "Collecting OKURI-NASI entries"
(point) (point-max)
nil 10)))
(while (re-search-forward "^\\(\\(\\cH\\|ー\\)+\\) \\(/\\cj.*\\)/$"
(while (re-search-forward "^\\(\\cH+\\) \\(/\\cj.*\\)/$"
nil t)
(let ((kana (match-string-no-properties 1))
(candidates (skkdic-get-candidate-list (match-beginning 3)
(match-end 3))))
(candidates (skkdic-get-candidate-list (match-beginning 2)
(match-end 2))))
(setq skkdic-okuri-nasi-entries
(cons (cons kana candidates) skkdic-okuri-nasi-entries))
(progress-reporter-update progress (point))

View File

@ -95,7 +95,7 @@
;; Emacs has in the past used \r to mark hidden lines in some fashion (and
;; maybe still does).
(defconst c-awk-esc-pair-re "\\\\\\(.\\|\n\\|\r\\|\\'\\)")
(defconst c-awk-esc-pair-re "\\\\\\(.\\|\n\\|\\'\\)")
;; Matches any escaped (with \) character-pair, including an escaped newline.
(defconst c-awk-non-eol-esc-pair-re "\\\\\\(.\\|\\'\\)")
;; Matches any escaped (with \) character-pair, apart from an escaped newline.

View File

@ -7983,7 +7983,7 @@ prototype \\&SUB Returns prototype of the function given a reference.
"\\|" ; $ ^
"[$^]"
"\\|" ; simple-code simple-code*?
"\\(\\\\.\\|[^][()#|*+?\n]\\)\\([*+{?]\\??\\)?" ; 4 5
"\\(\\\\.\\|[^][()#|*+?$^\n]\\)\\([*+{?]\\??\\)?" ; 4 5
"\\|" ; Class
"\\(\\[\\)" ; 6
"\\|" ; Grouping

View File

@ -245,7 +245,6 @@ See also `xml-get-attribute-or-nil'."
;; [54] AttType ::= StringType | TokenizedType | EnumeratedType
;; [55] StringType ::= 'CDATA'
(defconst xml-att-type-re (concat "\\(?:CDATA\\|" xml-tokenized-type-re
"\\|" xml-notation-type-re
"\\|" xml-enumerated-type-re "\\)"))
;; [60] DefaultDecl ::= '#REQUIRED' | '#IMPLIED' | (('#FIXED' S)? AttValue)