Skip to content

Commit

Permalink
Merge 4f9df54 into d53356a
Browse files Browse the repository at this point in the history
  • Loading branch information
akinomyoga committed Apr 2, 2020
2 parents d53356a + 4f9df54 commit 2179066
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions shellmetrics
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,12 @@ pretty() {
while [ "$i" -lt "$1" ] && i=$((i + 1)); do
echo 'shellmetrics_wrapper() {'
done
sed "s/\([^\$'\"()]\)\( *()\)/\1_L$MARK\2/g" \
sed "
s/\([^[:space:]\$'\"();&|<>=@!*?+]\)\( *()\)/\1_L$MARK\2/g
s/^[[:space:]]*function[[:space:]]\{1,\}[^[:space:]\$'\"();&|<>]\{1,\}/&_L$MARK/g
s/[;&|(][[:space:]]*function[[:space:]]\{1,\}[^[:space:]\$'\"();&|<>]\{1,\}/&_L$MARK/g
s/_L${MARK}_L${MARK}/_L${MARK}/g
" \
| awk "{i++; gsub(/$MARK/,i); print}"
while [ "$i" -gt 0 ] && i=$((i - 1)); do
echo '}'
Expand Down Expand Up @@ -262,7 +267,8 @@ analyze() {

case $mark in (*"f"*)
func=${line%"()"*} && func=${func%" "} && func=${func##*[$SP]}
lineno=${func##*_L} && func=${func%_L*}:$lineno
lineno=${func##*_L}
[ "$lineno" != "$func" ] && func=${func%_L*}:$lineno
push_array indent func ccn lloc
ccn=1 lloc=0
esac
Expand Down

0 comments on commit 2179066

Please sign in to comment.