Subject: bug#69714: [PATCH] Improve ert-font-lock assertion parser

From: Mattias Engdegård <[email-masked]>
Date: Mon, 1 Apr 2024 10:04:44 +0200

31 mars 2024 kl. 19.56 skrev Vladimir Kazanov <[email-masked]>:

>    (rx "("
>        (* whitespace)
> -      (one-or-more
> -       (seq (regexp ert-font-lock--face-symbol-re)
> -            (* whitespace)))
> +      (opt (regexp ert-font-lock--face-symbol-re))
> +      (zero-or-more
> +       (seq (+ whitespace)
> +            (regexp ert-font-lock--face-symbol-re)))
> +      (* whitespace)
>        ")")

Since you want to match zero or more symbols, this can be improved further:

   (rx "("
       (* whitespace)
       (* (regexp ert-font-lock--face-symbol-re)
          (+ whitespace)))
       ")")

(Note that most rx operators have an implicit `seq` inside.)

You may want to use ´rx-define` instead of `defconst` as well -- it avoids some use of the `regexp` construct and removes some load-time string building.