Skip to content

Commit

Permalink
#167 parse better
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Feb 26, 2024
1 parent 80f09db commit 6b6c70a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions filters/040-delete-unparseable.sh
Expand Up @@ -52,9 +52,9 @@ wait

total=$(wc -l < "${candidates}" | xargs)
if [ -s "${list}" ]; then
printf "%'d files out of %'d with broken Java syntax were deleted" \
printf "%'d files out of %'d with an unparseable Java syntax were deleted" \
"$(wc -l < "${list}" | xargs)" "${total}"
else
printf "No files out of %'d had broken Java syntax" \
printf "No files out of %'d had an unparseable Java syntax" \
"${total}"
fi
4 changes: 3 additions & 1 deletion filters/delete-unparseable.py
Expand Up @@ -31,7 +31,9 @@
try:
with open(JAVA, encoding='utf-8') as f:
try:
javalang.parse.parse(f.read())
raw = javalang.parse.parse(f.read())
tree = raw.filter(javalang.tree.ClassDeclaration)
list((value for value in tree))
except Exception:
os.remove(JAVA)
with open(LST, 'a+', encoding='utf-8') as others:
Expand Down

0 comments on commit 6b6c70a

Please sign in to comment.