GNU bug report logs -
#69714
30.0.50; ert-font-lock doesn't handle list of faces
Previous Next
Reported by: Troy Brown <brownts <at> troybrown.dev>
Date: Sun, 10 Mar 2024 20:33:02 UTC
Severity: normal
Found in version 30.0.50
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Vladimir, thank you for your patch. However, this regexp:
> (defconst ert-font-lock--face-symbol-re
> (rx (one-or-more (or alphanumeric "-" "_" ".")))
> "A face symbol matching regex.")
>
> (defconst ert-font-lock--face-symbol-list-re
> (rx "("
> (* whitespace)
> (one-or-more
> (seq (regexp ert-font-lock--face-symbol-re)
> (* whitespace)))
> ")")
> "A face symbol list matching regex.")
is rather inefficient. (Relint complained about it, which is why I am here).
The problem is that
(one-or-more
(seq (one-or-more (or alphanumeric "-" "_" "."))
(* whitespace)))
can match a string that consists of alphanumeric characters, say, in many different ways because of the nested `one-or-more`; the (* whitespace) can match the empty string anywhere.
Try, for instance:
(string-match ert-font-lock--face-symbol-list-re
(concat "(" (make-string 20 ?a)))
which should return nil as it doesn't match.
Now try raising the number from 20 to 25, then 30.
If you want the regexp to match a list of one or more symbols, what about this:
(rx "("
(* whitespace)
(regexp ert-font-lock--face-symbol-re)
(* (+ whitespace)
(regexp ert-font-lock--face-symbol-re))
")")
This bug report was last modified 1 year and 50 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.