Skip to content

Commit

Permalink
Fix how we find nested loops with comby
Browse files Browse the repository at this point in the history
  • Loading branch information
Yowgf committed Oct 17, 2023
1 parent 12e9505 commit 7fb0385
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
1 change: 0 additions & 1 deletion test/comby/count-for.txt

This file was deleted.

3 changes: 2 additions & 1 deletion test/comby/count_loops.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@

file=$1
[ -z "$file" ] && echo "Please provide a file to process" && exit 1
comby -count -match-only "$(cat count-for.txt)" '' "$file"
comby 'for (:[args]) { :[body] }' ':[body]' main.c -stdout | \
comby -count -stdin -match-only 'for (:[args]) {:[body]}' '' -rule 'where nested' -matcher .c
10 changes: 10 additions & 0 deletions test/comby/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,13 @@ for (int i = 0; i < 10; i++) {
}
}
}

for (int j = 0; j < 20; j++) {
for (int k = 0; k < 30; k++) {
printf("%d %d %d\n", i, j, k);
}
}

for (int i = 0; i < 10; i++) {
printf("%d ", i);
}

0 comments on commit 7fb0385

Please sign in to comment.