From: Kevin Buettner <kevinb@redhat.com>
To: Tom de Vries <tdevries@suse.de>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] [gdb/contrib] Handle capitalized words in spellcheck.sh
Date: Wed, 13 Nov 2024 13:37:22 -0700 [thread overview]
Message-ID: <20241113133722.52c198f4@f40-zbm-amd> (raw)
In-Reply-To: <20241113010852.13952-1-tdevries@suse.de>
On Wed, 13 Nov 2024 02:08:52 +0100
Tom de Vries <tdevries@suse.de> wrote:
> The dictionary contains a few entries with capital letters:
> ...
> $ grep -E '[A-Z]' .git/wikipedia-common-misspellings.txt | wc -l
> 143
> ...
> but they don't look too interesting in the gdb context (for instance,
> Habsbourg->Habsburg), so filter them out.
>
> That leaves us with entries looking only like "foobat->foobar", so add
> handling of capitalized words, such that we also rewrite "Foobat" to "Foobar".
...
- pat=$(grep_join "${words[@]}")
+ declare -a re_words
+ mapfile -t re_words \
+ < <(for f in "${words[@]}"; do
+ echo "$f"
+ done \
+ | sed "s/^\(.\)/[\u\1\1]/")
+
+ pat=$(grep_join "${re_words[@]}")
It took me a while to puzzle out that process substitution is being
used to provide input to the mapfile command, but once I figured that
out, it made sense to me.
Approved-by: Kevin Buettner <kevinb@redhat.com>
next prev parent reply other threads:[~2024-11-13 20:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-13 1:08 Tom de Vries
2024-11-13 20:37 ` Kevin Buettner [this message]
2024-11-13 21:38 ` 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=20241113133722.52c198f4@f40-zbm-amd \
--to=kevinb@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=tdevries@suse.de \
/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