From: "Mattias Engdegård" <mattias.engdegard@gmail.com>
To: Vladimir Kazanov <vekazanov@gmail.com>
Cc: Eli Zaretskii <eliz@gnu.org>, 69714@debbugs.gnu.org
Subject: bug#69714: [PATCH] Improve ert-font-lock assertion parser
Date: Sat, 30 Mar 2024 13:52:05 +0100 [thread overview]
Message-ID: <8EAA90DF-C567-4ADA-81DB-F074FE73ADAF@gmail.com> (raw)
In-Reply-To: <CABvCZ41gWPvjCSTrVGs0iXQLQJwgU+h1VQ9yO7_mYSxWYKcU7Q@mail.gmail.com>
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))
")")
next prev parent reply other threads:[~2024-03-30 12:52 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-10 20:31 bug#69714: 30.0.50; ert-font-lock doesn't handle list of faces Troy Brown
2024-03-11 8:36 ` Vladimir Kazanov
2024-03-12 20:46 ` Vladimir Kazanov
2024-03-13 16:14 ` Troy Brown
2024-03-13 17:04 ` Vladimir Kazanov
2024-03-13 17:48 ` Troy Brown
2024-03-13 18:20 ` Vladimir Kazanov
2024-03-15 11:47 ` bug#69714: [PATCH] Improve ert-font-lock assertion parser (Bug#69714) Vladimir Kazanov
2024-03-28 9:41 ` Eli Zaretskii
2024-03-30 12:52 ` Mattias Engdegård [this message]
2024-03-31 17:56 ` bug#69714: [PATCH] Improve ert-font-lock assertion parser Vladimir Kazanov
2024-04-01 8:04 ` Mattias Engdegård
2024-04-01 8:17 ` Mattias Engdegård
2024-04-01 8:34 ` Vladimir Kazanov
2024-04-01 9:08 ` Mattias Engdegård
2024-04-01 9:12 ` Vladimir Kazanov
2024-04-01 9:15 ` Mattias Engdegård
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8EAA90DF-C567-4ADA-81DB-F074FE73ADAF@gmail.com \
--to=mattias.engdegard@gmail.com \
--cc=69714@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=vekazanov@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).