From: Tom de Vries <tdevries@suse.de>
To: Tom Tromey <tom@tromey.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] [gdb/testsuite] Fix gdb.tui/resize-3.exp on ppc64-linux
Date: Sat, 18 Oct 2025 10:21:58 +0200 [thread overview]
Message-ID: <d51080eb-544b-4841-8609-14ee97c0d616@suse.de> (raw)
In-Reply-To: <87cy6lr4xw.fsf@tromey.com>
On 10/17/25 4:14 PM, Tom Tromey wrote:
> Tom> - "$hex\\s+<foo"
> Tom> + [string cat $hex {\s+} "<" ([string_to_regexp .])? "foo"]
>
> Personally I find this a lot less readable than just writing out the
> regular expression.
How about:
...
set re_dot [string_to_regexp "."]
set re [string cat $hex {\s+} "<" "($re_dot)?" "foo"]
...
Or:
...
set re [string cat $hex {\s+} "<" {(\.)?} "foo"]
...
I find this style much less readable:
...
set re "$hex\\s+<(\\.)?foo"
...
That is, I don't understand why you would join logically separate parts
of the regexp together and force readers of the regexp to go through the
process of separating them out again.
It's also error prone, especially where the dot is concerned:
- if you forget the second backslash on the s, you get a mismatch and
it's easily spotted.
- if you forget the second backslash on the dot, you still get a match,
but it'll match any character, say the a in "0x00c0ffee <afoo>".
I've seen many examples of this mistake in the testsuite sources.
Thanks,
- Tom
next prev parent reply other threads:[~2025-10-18 8:23 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-17 13:39 Tom de Vries
2025-10-17 14:14 ` Tom Tromey
2025-10-18 8:21 ` Tom de Vries [this message]
2025-10-18 9:11 ` Tom de Vries
2025-10-18 17:19 ` Tom Tromey
2025-10-20 10:08 ` Tom de Vries
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d51080eb-544b-4841-8609-14ee97c0d616@suse.de \
--to=tdevries@suse.de \
--cc=gdb-patches@sourceware.org \
--cc=tom@tromey.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox