summaryrefslogtreecommitdiff
path: root/scripts/check_whitespace_token.py
diff options
context:
space:
mode:
authorMatthäus G. Chajdas <dev@anteru.net>2022-12-04 19:53:23 +0100
committerMatthäus G. Chajdas <dev@anteru.net>2022-12-04 19:53:23 +0100
commitbe2196eba29e52ef9fe93b0ff60e8d4af6b2524d (patch)
tree9ed000f888c3d1febcfd2b49cae1fc63cfb19f6b /scripts/check_whitespace_token.py
parentf8a75279139ec4b62a220ba92690c066a2de9ee0 (diff)
downloadpygments-git-be2196eba29e52ef9fe93b0ff60e8d4af6b2524d.tar.gz
Improve utility scripts.
Scan snippet files in addition to token output streams.
Diffstat (limited to 'scripts/check_whitespace_token.py')
-rw-r--r--scripts/check_whitespace_token.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/scripts/check_whitespace_token.py b/scripts/check_whitespace_token.py
index 9fb56ab3..cc3d1aa6 100644
--- a/scripts/check_whitespace_token.py
+++ b/scripts/check_whitespace_token.py
@@ -19,7 +19,14 @@ def check_file(path):
whitespace_re = re.compile('\s+')
for value, token, linenumber in unpack_output_file(path):
- if whitespace_re.fullmatch(value) and 'Whitespace' not in token:
+ if whitespace_re.fullmatch(value):
+ # We allow " " if it's inside a Literal.String for example
+ if 'Literal' in token:
+ continue
+
+ if 'Whitespace' in token:
+ continue
+
print(f'{path}:{linenumber}')
return False