From ec2827eb83a003df689e2f69cef6402d4b687678 Mon Sep 17 00:00:00 2001 From: Garth Minette Date: Sat, 3 Sep 2022 17:00:11 -0700 Subject: [PATCH] Added find_modular_asserts.sh --- scripts/find_modular_asserts.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 scripts/find_modular_asserts.sh diff --git a/scripts/find_modular_asserts.sh b/scripts/find_modular_asserts.sh new file mode 100755 index 0000000..e737a75 --- /dev/null +++ b/scripts/find_modular_asserts.sh @@ -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 +