retroforth/tools/find-deprecated.retro
crc a4bb5eec3f toolchain: add a tool to locate deprecated words (based on the shell snippit used by john_cephalopoda)
FossilOrigin-Name: 0f15a232ef1685f5cda43681de1eed41c5d76b43326c6c285964935b85021789
2020-10-01 13:37:36 +00:00

56 lines
1.1 KiB
Forth
Executable file

#!/usr/bin/env retro
This is a small tool to find use of deprecated words in the
Retro source tree.
It's pretty much just a wrapper over a Unix shell pipeline,
but pulls the word names from an array of strings defined in
Retro, so it's easy for me to add new entries as the language
evolves.
First, files/patterns to exclude.
~~~
{ 'Glossary-Concise.txt
'Glossary-Names-and-Stack.txt
'Glossary.html
'Glossary.txt
'words.tsv
'glossary/glossary
'bin/retro-describe
'compat.retro
'compat.forth
'README
'RELEASE-NOTES
} s:empty swap [ swap '%s_|_grep_-v_%s s:format ] a:for-each
'EXCLUSIONS s:const
~~~
Then the deprecated words.
~~~
{ (2020.7)
'd:last<class>
'd:last<name>
'd:last<xt>
'file:open<for-append>
'file:open<for-reading>
'file:open<for-writing>
'times<with-index>
'var<n>
(2020.10)
'sys:name
'sys:argc
'sys:argv
} s:empty swap [ swap '%s_"%s" s:format ] a:for-each
'DEPRECATED s:const
~~~
Construct the actual shell pipeline and run it.
~~~
EXCLUSIONS DEPRECATED 'for_name_in_%s;_do_find_._|_xargs_grep_-s_$name_|_grep_-v_find-deprecated.retro_%s_;_done
s:format unix:system
~~~