From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.devel Subject: Experimental regexp check: repetition of empty-matching expression Date: Fri, 12 Apr 2019 22:00:28 +0200 Message-ID: <30C4697B-B2C4-48F3-B01E-B17C00C152B4@acm.org> Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.8\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_0BAC2741-8252-4860-B597-9D1666815B88" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="162328"; mail-complaints-to="usenet@blaine.gmane.org" To: Emacs developers Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Apr 12 22:01:39 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hF2Mj-000g5x-Rt for ged-emacs-devel@m.gmane.org; Fri, 12 Apr 2019 22:01:38 +0200 Original-Received: from localhost ([127.0.0.1]:42015 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hF2Mi-0007Nq-KW for ged-emacs-devel@m.gmane.org; Fri, 12 Apr 2019 16:01:36 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:36290) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hF2Lm-0007Jr-MR for emacs-devel@gnu.org; Fri, 12 Apr 2019 16:00:39 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hF2Ll-000140-Od for emacs-devel@gnu.org; Fri, 12 Apr 2019 16:00:38 -0400 Original-Received: from mail230c50.megamailservers.eu ([91.136.10.240]:49092 helo=mail37c50.megamailservers.eu) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hF2Lk-0000wu-P0 for emacs-devel@gnu.org; Fri, 12 Apr 2019 16:00:37 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1555099230; bh=mP+Aphg4tdjpnCJgz+A7ppdY5HIJDKMUXSXxb46Nf6U=; h=From:Subject:Date:To:From; b=dWgxx8U6qqoy2i5g/SCl7ICC31s2Y55+zYdlUC1vACiHexfwOHr2Nze0RmQyEvf9/ 6CwtlJcRF2n83zJXoAPeZWNjZGxWPBnSnaCzwS8qqAsoy65oJgICfHJcuP4dEeR00i YOnhLorsD5QS6hiGqOnDrakWnucX0MOb0eTyo3Nw= Feedback-ID: mattiase@acm.or Original-Received: from [192.168.1.64] (c-e636e253.032-75-73746f71.bbcust.telenor.se [83.226.54.230]) (authenticated bits=0) by mail37c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id x3CK0Sqp020703 for ; Fri, 12 Apr 2019 20:00:29 +0000 X-Mailer: Apple Mail (2.3445.104.8) X-CTCH-RefID: str=0001.0A0B020C.5CB0EE5E.0002, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=P4AUeBIu c=1 sm=1 tr=0 a=M+GU/qJco4WXjv8D6jB2IA==:117 a=M+GU/qJco4WXjv8D6jB2IA==:17 a=CrDKUpOAP4OL0FDGGGgA:9 a=CjuIK1q_8ugA:10 a=VQ--iiTN30pEp6SAKsMA:9 a=ITdVHhY7-e0A:10 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 91.136.10.240 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:235373 Archived-At: --Apple-Mail=_0BAC2741-8252-4860-B597-9D1666815B88 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii As an experiment I added, to xr, a check for repetitions of expressions = that can match the empty string, like \(a*b*\)* on the grounds that these are either mistakes or potentially risk being = very slow on the backtracking regexp engine in Emacs. (A DFA would have = no problem whatsoever; the regexp above would become a single state.) Is this useful, or a pointless waste of time? Attached are the results = from a relint run on the Emacs tree so that you can judge for = yourselves. If the consensus is that it too often complains about = perfectly fine regexps, then the check will be dropped unceremoniously. --Apple-Mail=_0BAC2741-8252-4860-B597-9D1666815B88 Content-Disposition: attachment; filename=relint.log Content-Type: application/octet-stream; x-unix-mode=0644; name="relint.log" Content-Transfer-Encoding: 7bit ;; -*- compilation -*- Relint results for ~/emacs lisp/cedet/srecode/srt-mode.el:65:3: In srecode-font-lock-keywords: Repetition of expression matching an empty string (pos 41) "^\\(template\\)\\s-+\\(\\w*\\)\\(\\( \\(:\\w+\\)\\|\\)+\\)$" ......................................................^ lisp/emacs-lisp/copyright.el:53:2: In copyright-regexp: Repetition of expression matching an empty string (pos 100) "\\(\251\\|@copyright{}\\|[Cc]opyright\\s *:?\\s *\\(?:(C)\\)?\\|[Cc]opyright\\s *:?\\s *\251\\)\\s *\\(?:[^0-9\n]*\\s *\\)?\\([1-9]\\([-0-9, ';/*%#\n\t]\\|\\s<\\|\\s>\\)*[0-9]+\\)" ..........................................................................................................................^ lisp/emacs-lisp/copyright.el:154:26: In call to copyright-re-search: Repetition of expression matching an empty string (pos 102) "\\(\\(\251\\|@copyright{}\\|[Cc]opyright\\s *:?\\s *\\(?:(C)\\)?\\|[Cc]opyright\\s *:?\\s *\251\\)\\s *\\(?:[^0-9\n]*\\s *\\)?\\([1-9]\\([-0-9, ';/*%#\n\t]\\|\\s<\\|\\s>\\)*[0-9]+\\)\\)\\([ \t]*\n\\)?.*\\(?:\\)" .............................................................................................................................^ lisp/erc/erc-backend.el:1288:25: In call to string-match: Repetition of expression matching an empty string (pos 7) "^\\(.*\\)?\007.*$" .........^ lisp/erc/erc-goodies.el:551:28: In call to re-search-forward: Repetition of expression matching an empty string (pos 18) "[.-]+\\([.-]*/? *\\)+[.-]+/?" ....................^ lisp/mail/mail-extr.el:385:3: In mail-extr-telephone-extension-pattern: Repetition of expression matching an empty string (pos 40) "\\(\\([Ee]xt\\|\\|[Tt]ph\\|[Tt]el\\|[Xx]\\).?\\)? *\\+?[0-9][- 0-9]+" ................................................^ lisp/net/tramp-adb.el:56:3: In tramp-adb-prompt: Repetition of expression matching an empty string (pos 21) "^\\(?:[[:digit:]]*|?\\)?\\(?:[[:alnum:]\e;[]*@?[[:alnum:]]*[^#\\$]*\\)?[#\\$][[:space:]]" .......................^ lisp/net/tramp-adb.el:56:3: In tramp-adb-prompt: Repetition of expression matching an empty string (pos 64) "^\\(?:[[:digit:]]*|?\\)?\\(?:[[:alnum:]\e;[]*@?[[:alnum:]]*[^#\\$]*\\)?[#\\$][[:space:]]" ......................................................................^ lisp/org/org-table.el:487:3: In org-table-range-regexp: Repetition of expression matching an empty string (pos 23) "@\\([-+]?I*[-+]?[0-9]*\\)?\\(\\$[-+]?[0-9]+\\)?\\(\\.\\.@?\\([-+]?I*[-+]?[0-9]*\\)?\\(\\$[-+]?[0-9]+\\)?\\)?" .........................^ lisp/org/org-table.el:487:3: In org-table-range-regexp: Repetition of expression matching an empty string (pos 72) "@\\([-+]?I*[-+]?[0-9]*\\)?\\(\\$[-+]?[0-9]+\\)?\\(\\.\\.@?\\([-+]?I*[-+]?[0-9]*\\)?\\(\\$[-+]?[0-9]+\\)?\\)?" ..................................................................................^ lisp/progmodes/idlwave.el:6457:21: In call to string-match: Repetition of expression matching an empty string (pos 35) "OBJ_NEW([ \t]*['\"]\\([a-zA-Z0-9$_]*\\)?\\'" .......................................^ lisp/progmodes/idlwave.el:6460:21: In call to string-match: Repetition of expression matching an empty string (pos 32) "\\\\s-*\\)?\\<\\(inout\\|input\\|output\\|byte\\|shortint\\|int\\|longint\\|integer\\|time\\|bit\\|logic\\|reg\\|shortreal\\|real\\|realtime\\|supply0\\|supply1\\|tri\\|triand\\|trior\\|trireg\\|tri0\\|tri1\\|uwire\\|wire\\|wand\\|wor\\|string\\|event\\|chandle\\|virtual\\|enum\\|genvar\\|struct\\|union\\|mailbox\\|semaphore\\)\\>\\s-*\\(\\(\\s-*\\(\\<\\(reg\\|wire\\)\\>\\s-*\\)?\\(\\<\\(un\\)?signed\\>\\s-*\\)?\\(\\(\\[[^]]*\\]\\s-*\\)+\\)?\\)\\|\\(#\\s-*\\(\\([0-9_]+\\('s?[hdxbo][0-9a-fA-F_xz]+\\)?\\)\\|\\(([^()]*)\\)\\|\\(\\sw+\\)\\)\\)\\|\\(`\\sw+\\)\\)?" ......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................^ lisp/progmodes/verilog-mode.el:6959:33: In call to looking-at: Repetition of expression matching an empty string (pos 574) "\\s-*\\(\\<\\(inout\\|input\\|output\\|ref\\|const\\|static\\|protected\\|local\\|localparam\\|parameter\\|var\\|typedef\\|rand\\)\\>\\s-*\\)?\\<\\(inout\\|input\\|output\\|byte\\|shortint\\|int\\|longint\\|integer\\|time\\|bit\\|logic\\|reg\\|shortreal\\|real\\|realtime\\|supply0\\|supply1\\|tri\\|triand\\|trior\\|trireg\\|tri0\\|tri1\\|uwire\\|wire\\|wand\\|wor\\|string\\|event\\|chandle\\|virtual\\|enum\\|genvar\\|struct\\|union\\|mailbox\\|semaphore\\)\\>\\s-*\\(\\(\\s-*\\(\\<\\(reg\\|wire\\)\\>\\s-*\\)?\\(\\<\\(un\\)?signed\\>\\s-*\\)?\\(\\(\\[[^]]*\\]\\s-*\\)+\\)?\\)\\|\\(#\\s-*\\(\\([0-9_]+\\('s?[hdxbo][0-9a-fA-F_xz]+\\)?\\)\\|\\(([^()]*)\\)\\|\\(\\sw+\\)\\)\\)\\)?" .......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................^ lisp/progmodes/verilog-mode.el:7125:36: In call to looking-at: Repetition of expression matching an empty string (pos 585) "\\s-*\\(\\<\\(inout\\|input\\|output\\|ref\\|const\\|static\\|protected\\|local\\|localparam\\|parameter\\|var\\|typedef\\|rand\\)\\>\\s-*\\)?\\<\\(inout\\|input\\|output\\|byte\\|shortint\\|int\\|longint\\|integer\\|time\\|bit\\|logic\\|reg\\|shortreal\\|real\\|realtime\\|supply0\\|supply1\\|tri\\|triand\\|trior\\|trireg\\|tri0\\|tri1\\|uwire\\|wire\\|wand\\|wor\\|string\\|event\\|chandle\\|virtual\\|enum\\|genvar\\|struct\\|union\\|mailbox\\|semaphore\\)\\>\\s-*\\(\\(\\s-*\\(\\<\\(reg\\|wire\\)\\>\\s-*\\)?\\(\\<\\(un\\)?signed\\>\\s-*\\)?\\(\\(\\[[^]]*\\]\\s-*\\)+\\)?\\)\\|\\(#\\s-*\\(\\([0-9_]+\\('s?[hdxbo][0-9a-fA-F_xz]+\\)?\\)\\|\\(([^()]*)\\)\\|\\(\\sw+\\)\\)\\)\\|\\(`\\sw+\\)\\)?" ......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................^ lisp/progmodes/verilog-mode.el:7139:33: In call to looking-at: Repetition of expression matching an empty string (pos 574) "\\s-*\\(\\<\\(inout\\|input\\|output\\|ref\\|const\\|static\\|protected\\|local\\|localparam\\|parameter\\|var\\|typedef\\|rand\\)\\>\\s-*\\)?\\<\\(inout\\|input\\|output\\|byte\\|shortint\\|int\\|longint\\|integer\\|time\\|bit\\|logic\\|reg\\|shortreal\\|real\\|realtime\\|supply0\\|supply1\\|tri\\|triand\\|trior\\|trireg\\|tri0\\|tri1\\|uwire\\|wire\\|wand\\|wor\\|string\\|event\\|chandle\\|virtual\\|enum\\|genvar\\|struct\\|union\\|mailbox\\|semaphore\\)\\>\\s-*\\(\\(\\s-*\\(\\<\\(reg\\|wire\\)\\>\\s-*\\)?\\(\\<\\(un\\)?signed\\>\\s-*\\)?\\(\\(\\[[^]]*\\]\\s-*\\)+\\)?\\)\\|\\(#\\s-*\\(\\([0-9_]+\\('s?[hdxbo][0-9a-fA-F_xz]+\\)?\\)\\|\\(([^()]*)\\)\\|\\(\\sw+\\)\\)\\)\\)?" .......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................^ lisp/progmodes/verilog-mode.el:10813:29: In call to re-search-forward: Repetition of expression matching an empty string (pos 59) "\\s-*// \\(Templated\\|Implicit \\.\\*\\)\\([ \tLT0-9]*\\| LHS: .*\\)?$" .....................................................................^ lisp/progmodes/verilog-mode.el:11415:30: In call to string-match: Repetition of expression matching an empty string (pos 22) "@\"\\(\\([^\\\"]*\\(\\\\.\\)*\\)*\\)\"" ................................^ lisp/url/url-misc.el:91:30: In call to string-match: Repetition of expression matching an empty string (pos 9) "\\([^,]*\\)?," ...........^ lisp/align.el:386:3: In align-rules-list (c-variable-declaration): Repetition of expression matching an empty string (pos 97) "[*&0-9A-Za-z_]>?[&*]*\\(\\s-+[*&]*\\)[A-Za-z_][0-9A-Za-z:_]*\\s-*\\(\\()\\|=[^=\n].*\\|(.*)\\|\\(\\[.*\\]\\)*\\)?\\s-*[;,]\\|)\\s-*$\\)" ................................................................................................................^ lisp/dabbrev.el:495:20: In call to re-search-forward: Repetition of expression matching an empty string (pos 6) "\\(?:\\)+" ........^ --Apple-Mail=_0BAC2741-8252-4860-B597-9D1666815B88--