[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Regexp error scan (March 26)
From: |
Mattias Engdegård |
Subject: |
Re: Regexp error scan (March 26) |
Date: |
Wed, 27 Mar 2019 13:09:07 +0100 |
27 mars 2019 kl. 03.10 skrev Paul Eggert <address@hidden>:
>
> Thanks, I installed the attached patch to try to fix those issues.
Thank you, that was quick!
- (concat (nth 2 (or (assq footnote-style footnote-style-alist)
- (nth 0 footnote-style-alist)))
- "*"))
+ (let ((regexp (nth 2 (or (assq footnote-style footnote-style-alist)
+ (nth 0 footnote-style-alist)))))
+ (concat
+ ;; Hack to avoid repetition of repetition.
+ (if (string-match "[^\\]\\\\\\{2\\}*[*+?]\\'" regexp)
+ (substring regexp 0 -1)
+ regexp)
+ "*")))
The repetition-of-repetition check is useful and has caught several
actual errors; this may be the first true false positive that has to
be hacked around. We could suppress the complaint if the inner
repetition is wrapped in brackets, like \(?:a+\)*, but it would reduce
the error-finding power of the check.
In this case I'm not sure the added * makes sense at all; there is
always a single number within the footnote-{start,end}-tag pairs.
Worse, the code goes on and adds yet another + later on, in
footnote-refresh-footnotes, just in case. That makes even less sense.
Likely, both the * and the extra + should go away.
- ("^[ \t]*\\(:root\\)\\(?:[\n \t]*\\)*{" (1 'css-selector keep))
+ ("^[ \t]*\\(:root\\)\\(?:[\n \t]*\\){" (1 'css-selector keep))
Those brackets around the [\n \t] could go away, too.
- Re: Regexp error scan (March 26), (continued)
- Re: Regexp error scan (March 26), Mattias Engdegård, 2019/03/27
- Re: Regexp error scan (March 26), Andy Moreton, 2019/03/27
- Re: Regexp error scan (March 26), Stefan Monnier, 2019/03/27
- Re: Regexp error scan (March 26), Mattias Engdegård, 2019/03/27
- Re: Regexp error scan (March 26), Stefan Monnier, 2019/03/27
- Re: Regexp error scan (March 26), Noam Postavsky, 2019/03/27
- Re: Regexp error scan (March 26), Mattias Engdegård, 2019/03/27
- Re: Regexp error scan (March 26), Stefan Monnier, 2019/03/27
- Re: Regexp error scan (March 26), Paul Eggert, 2019/03/27
- Re: Regexp error scan (March 26), Damien Collard, 2019/03/27
Re: Regexp error scan (March 26),
Mattias Engdegård <=