Added find_modular_asserts.sh

This commit is contained in:
Garth Minette 2022-09-03 17:00:11 -07:00
parent b4872e2820
commit ec2827eb83

29
scripts/find_modular_asserts.sh Executable file
View file

@ -0,0 +1,29 @@
#!/bin/sh
awk '
/^module/{
m=1
split($2,narr,"(")
module=narr[1]"()"
}
/^function/{
m=0
module=""
}
/[^=] *assert\(/{
if(m) {
if(fname!=FILENAME) {
fname=FILENAME
print "File",fname
}
if(prevmodule!=module) {
prevmodule=module
print " Module",module
}
assertline=$0
sub(/^ */, "", assertline)
print " ",FNR,":",assertline
}
}
' *.scad