[gdb/contrib] Handle parentheses in spellcheck.sh

Currently, text adjacent to parentheses is not spell-checked:
...
$ cat tmp.txt
(upto)
$ ./gdb/contrib/spellcheck.sh tmp.txt
$
...

Add handling of parentheses, such that we get:
...
$ ./gdb/contrib/spellcheck.sh tmp.txt
upto -> up to
$
...

Rerun spellcheck.sh, resulting in a few "thru->through" replacements.

Tested on x86_64-linux.

Approved-by: Kevin Buettner <kevinb@redhat.com>
This commit is contained in:
Tom de Vries 2024-11-13 21:06:58 +01:00
parent e2fa415cfd
commit 0d1f7e2765
4 changed files with 37 additions and 14 deletions

View File

@ -47,6 +47,32 @@ sed_separators=(
","
)
# Pre: start of line, left parenthesis.
declare -a grep_pre
grep_pre=(
"^"
"\("
)
declare -a sed_pre
sed_pre=(
"^"
"("
)
# Post: dot, right parenthesis, end of line.
declare -a grep_post
grep_post=(
"\."
"\)"
"$"
)
declare -a sed_post
sed_post=(
"\."
")"
"$"
)
join ()
{
local or
@ -223,12 +249,11 @@ find_files_matching_words ()
local before after
before=$(grep_join \
"^" \
"${grep_pre[@]}" \
"${grep_separators[@]}")
after=$(grep_join \
"${grep_separators[@]}" \
"\." \
"$")
"${grep_post[@]}")
pat="$before$pat$after"
@ -250,12 +275,11 @@ find_files_matching_word ()
local before after
before=$(grep_join \
"^" \
"${grep_pre[@]}" \
"${grep_separators[@]}")
after=$(grep_join \
"${grep_separators[@]}" \
"\." \
"$")
"${grep_post[@]}")
pat="$before$pat$after"
@ -278,12 +302,11 @@ replace_word_in_file ()
local before after
before=$(sed_join \
"^" \
"${sed_pre[@]}" \
"${sed_separators[@]}")
after=$(sed_join \
"${sed_separators[@]}" \
"\." \
"$")
"${sed_post[@]}")
local repl
repl="s%$before$word$after%\1$replacement\2%g"

View File

@ -1203,7 +1203,7 @@ print_object_command (const char *args, int from_tty)
gdb_printf ("\n");
}
/* The data structure 'methcalls' is used to detect method calls (thru
/* The data structure 'methcalls' is used to detect method calls (through
* ObjC runtime lib functions objc_msgSend, objc_msgSendSuper, etc.),
* and ultimately find the method being called.
*/

View File

@ -268,12 +268,12 @@ gdb_test_multiple "stepi" "$test_message" {
}
}
# step backward into function (thru return)
# step backward into function (through return)
gdb_test "step" "(RETURN FROM CALLEE|ARRIVED IN CALLEE).*" \
"reverse step into fn call"
# step backward out of called function (thru call)
# step backward out of called function (through call)
set test_message "reverse step out of called fn"
gdb_test_multiple "step" "$test_message" {

View File

@ -230,12 +230,12 @@ gdb_test_multiple "stepi" "$test_message" {
}
}
# step backward into function (thru return)
# step backward into function (through return)
gdb_test "step" "(RETURN FROM CALLEE|ARRIVED IN CALLEE).*" \
"reverse step into fn call"
# step backward out of called function (thru call)
# step backward out of called function (through call)
set test_message "reverse step out of called fn"
gdb_test_multiple "step" "$test_message" {