Skip to content

Commit

Permalink
Update count.py
Browse files Browse the repository at this point in the history
  • Loading branch information
sbryngelson authored Dec 31, 2023
1 parent 4212c3b commit f5032c7
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions toolchain/mfc/count.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@ def handle_dir(dirpath: str) -> typing.Tuple[typing.List[typing.Tuple[str, int]]
with open(filepath) as f:
count = 0
for l in f.read().split('\n'):
if not (l.isspace() or len(l) == 0):
if not l.lstrip()[0] == '!':
count = count + 1
if l.lstrip()[0:5] == "!$acc":
count = count + 1
# Skip whitespace
if l.isspace() or len(l) == 0:
continue
# Skip comments but not !$acc ones!
if l.lstrip().startswith("!") and not l.lstrip().startswith("!$acc"):
continue
count += 1

files.append((filepath, count))
total += count

Expand Down

0 comments on commit f5032c7

Please sign in to comment.