Skip to content

Commit 9e4bb0d

Browse files
committed
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.
1 parent e6a9785 commit 9e4bb0d

File tree

7 files changed

+10
-11
lines changed

7 files changed

+10
-11
lines changed

lisp/arc-mode.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2019,7 +2019,7 @@ This doesn't recover lost files, it just undoes changes in the buffer itself."
20192019
(re-search-forward "^\\(\s+=+\s*\\)+\n")
20202020
(while (looking-at (concat "^\s+[0-9.]+\s+D?-+\s+" ; Flags
20212021
"\\([0-9-]+\\)\s+" ; Size
2022-
"\\([-0-9.%]+\\|-+\\)\s+" ; Ratio
2022+
"\\([-0-9.%]+\\)\s+" ; Ratio
20232023
"\\([0-9a-zA-Z]+\\)\s+" ; Mode
20242024
"\\([0-9-]+\\)\s+" ; Date
20252025
"\\([0-9:]+\\)\s+" ; Time

lisp/eshell/em-hist.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ element, regardless of any text on the command line. In that case,
153153
:group 'eshell-hist)
154154

155155
(defcustom eshell-hist-word-designator
156-
"^:?\\([0-9]+\\|[$^%*]\\)?\\(\\*\\|-[0-9]*\\|[$^%*]\\)?"
156+
"^:?\\([0-9]+\\|[$^%*]\\)?\\(-[0-9]*\\|[$^%*]\\)?"
157157
"The regexp used to identify history word designators."
158158
:type 'regexp
159159
:group 'eshell-hist)

lisp/info.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1531,7 +1531,7 @@ is non-nil)."
15311531
(save-restriction
15321532
(narrow-to-region start (point))
15331533
(goto-char (point-min))
1534-
(while (re-search-forward "^\\* \\([^:\n]+:\\(:\\|[^.\n]+\\).\\)" nil 'move)
1534+
(while (re-search-forward "^\\* \\([^:\n]+:[^.\n]+.\\)" nil 'move)
15351535
;; Fold case straight away; `member-ignore-case' here wasteful.
15361536
(let ((x (downcase (match-string 1))))
15371537
(if (member x seen)

lisp/international/ja-dic-cnv.el

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
(setq l (cdr l)))))
125125

126126
;; Search postfix entries.
127-
(while (re-search-forward "^[#<>?]\\(\\(\\cH\\|ー\\)+\\) " nil t)
127+
(while (re-search-forward "^[#<>?]\\(\\cH+\\) " nil t)
128128
(let ((kana (match-string-no-properties 1))
129129
str candidates)
130130
(while (looking-at "/[#0-9 ]*\\([^/\n]*\\)/")
@@ -157,7 +157,7 @@
157157
(insert ";; Setting prefix entries.\n"
158158
"(skkdic-set-prefix\n"))
159159
(save-excursion
160-
(while (re-search-forward "^\\(\\(\\cH\\|ー\\)+\\)[<>?] " nil t)
160+
(while (re-search-forward "^\\(\\cH+\\)[<>?] " nil t)
161161
(let ((kana (match-string-no-properties 1))
162162
str candidates)
163163
(while (looking-at "/\\([^/\n]+\\)/")
@@ -275,11 +275,11 @@
275275
(let ((progress (make-progress-reporter "Collecting OKURI-NASI entries"
276276
(point) (point-max)
277277
nil 10)))
278-
(while (re-search-forward "^\\(\\(\\cH\\|ー\\)+\\) \\(/\\cj.*\\)/$"
278+
(while (re-search-forward "^\\(\\cH+\\) \\(/\\cj.*\\)/$"
279279
nil t)
280280
(let ((kana (match-string-no-properties 1))
281-
(candidates (skkdic-get-candidate-list (match-beginning 3)
282-
(match-end 3))))
281+
(candidates (skkdic-get-candidate-list (match-beginning 2)
282+
(match-end 2))))
283283
(setq skkdic-okuri-nasi-entries
284284
(cons (cons kana candidates) skkdic-okuri-nasi-entries))
285285
(progress-reporter-update progress (point))

lisp/progmodes/cc-awk.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
;; Emacs has in the past used \r to mark hidden lines in some fashion (and
9696
;; maybe still does).
9797

98-
(defconst c-awk-esc-pair-re "\\\\\\(.\\|\n\\|\r\\|\\'\\)")
98+
(defconst c-awk-esc-pair-re "\\\\\\(.\\|\n\\|\\'\\)")
9999
;; Matches any escaped (with \) character-pair, including an escaped newline.
100100
(defconst c-awk-non-eol-esc-pair-re "\\\\\\(.\\|\\'\\)")
101101
;; Matches any escaped (with \) character-pair, apart from an escaped newline.

lisp/progmodes/cperl-mode.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7983,7 +7983,7 @@ prototype \\&SUB Returns prototype of the function given a reference.
79837983
"\\|" ; $ ^
79847984
"[$^]"
79857985
"\\|" ; simple-code simple-code*?
7986-
"\\(\\\\.\\|[^][()#|*+?\n]\\)\\([*+{?]\\??\\)?" ; 4 5
7986+
"\\(\\\\.\\|[^][()#|*+?$^\n]\\)\\([*+{?]\\??\\)?" ; 4 5
79877987
"\\|" ; Class
79887988
"\\(\\[\\)" ; 6
79897989
"\\|" ; Grouping

lisp/xml.el

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,6 @@ See also `xml-get-attribute-or-nil'."
245245
;; [54] AttType ::= StringType | TokenizedType | EnumeratedType
246246
;; [55] StringType ::= 'CDATA'
247247
(defconst xml-att-type-re (concat "\\(?:CDATA\\|" xml-tokenized-type-re
248-
"\\|" xml-notation-type-re
249248
"\\|" xml-enumerated-type-re "\\)"))
250249

251250
;; [60] DefaultDecl ::= '#REQUIRED' | '#IMPLIED' | (('#FIXED' S)? AttValue)

0 commit comments

Comments
 (0)