aboutsummaryrefslogtreecommitdiff
path: root/gdb/contrib
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2024-10-08 08:24:13 +0200
committerTom de Vries <tdevries@suse.de>2024-10-08 08:24:13 +0200
commit0576fe8146527d871558d82d3e4e99d85f2115a7 (patch)
tree62f4cb2af514c69276e2da22ffb78ca34bade92a /gdb/contrib
parent99fd53b19dddeb232e169cc5a3918a2adf7d3da2 (diff)
downloadgdb-0576fe8146527d871558d82d3e4e99d85f2115a7.zip
gdb-0576fe8146527d871558d82d3e4e99d85f2115a7.tar.gz
gdb-0576fe8146527d871558d82d3e4e99d85f2115a7.tar.bz2
[gdb/contrib] Add more separators in spellcheck.sh
Add two more separators in spellcheck.sh: colon and comma. Doing so triggers the "inbetween->between" rule, which gives an incorrect result. Override this with "inbetween->between, in between, in-between" [1], in a new file gdb/contrib/common-misspellings.txt. Fix the following common misspellings: ... everytime -> every time sucess -> success thru -> through transfered -> transferred inbetween -> between, in between, in-between ... Verified with spellcheck.sh. Tested on x86_64-linux. [1] https://www.grammarly.com/blog/commonly-confused-words/in-between-or-inbetween/
Diffstat (limited to 'gdb/contrib')
-rw-r--r--gdb/contrib/common-misspellings.txt17
-rwxr-xr-xgdb/contrib/spellcheck.sh33
2 files changed, 47 insertions, 3 deletions
diff --git a/gdb/contrib/common-misspellings.txt b/gdb/contrib/common-misspellings.txt
new file mode 100644
index 0000000..7281ec0
--- /dev/null
+++ b/gdb/contrib/common-misspellings.txt
@@ -0,0 +1,17 @@
+# Copyright (C) 2024 Free Software Foundation, Inc.
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Common spelling mistakes.
+
+inbetween->between, in between, in-between
diff --git a/gdb/contrib/spellcheck.sh b/gdb/contrib/spellcheck.sh
index 343a43f..4203333 100755
--- a/gdb/contrib/spellcheck.sh
+++ b/gdb/contrib/spellcheck.sh
@@ -25,19 +25,24 @@ url=https://en.wikipedia.org/wiki/Wikipedia:Lists_of_common_misspellings/For_mac
cache_dir=$scriptdir/../../.git
cache_file=wikipedia-common-misspellings.txt
dictionary=$cache_dir/$cache_file
+local_dictionary=$scriptdir/common-misspellings.txt
-# Separators: space, slash, tab.
+# Separators: space, slash, tab, colon, comma.
declare -a grep_separators
grep_separators=(
" "
"/"
" "
+ ":"
+ ","
)
declare -a sed_separators
sed_separators=(
" "
"/"
"\t"
+ ":"
+ ","
)
join ()
@@ -149,13 +154,27 @@ get_dictionary ()
trap "" EXIT
}
+output_local_dictionary ()
+{
+ # Filter out comments and empty lines.
+ grep -E -v \
+ "^#|^$" \
+ "$local_dictionary"
+}
+
+output_dictionaries ()
+{
+ output_local_dictionary
+ cat "$dictionary"
+}
+
parse_dictionary ()
{
# Parse dictionary.
mapfile -t words \
- < <(awk -F '->' '{print $1}' "$dictionary")
+ < <(awk -F '->' '{print $1}' <(output_dictionaries))
mapfile -t replacements \
- < <(awk -F '->' '{print $2}' "$dictionary")
+ < <(awk -F '->' '{print $2}' <(output_dictionaries))
}
find_files_matching_words ()
@@ -310,12 +329,20 @@ main ()
return
fi
+ declare -A words_done
local i word replacement
i=0
for word in "${words[@]}"; do
replacement=${replacements[$i]}
i=$((i + 1))
+ # Skip words that are already handled. This ensures that the local
+ # dictionary overrides the wiki dictionary.
+ if [ "${words_done[$word]}" == 1 ]; then
+ continue
+ fi
+ words_done[$word]=1
+
replace_word_in_files \
"$word" \
"$replacement" \