summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2021-05-30 07:12:04 +0200
committerGeorg Brandl <georg@python.org>2021-05-30 07:12:58 +0200
commit0d5397ad05cb652d2e743911d3e9cb2b23159658 (patch)
treed34ed36ecfc61071006b59e50a3956db5d12b8e3 /scripts
parente8803c5e756bf2f78d913d546348bfd2987c918d (diff)
downloadpygments-git-0d5397ad05cb652d2e743911d3e9cb2b23159658.tar.gz
TNT: fix reliance on "assert" stmt, handle recursion
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/debug_lexer.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/scripts/debug_lexer.py b/scripts/debug_lexer.py
index a76265f5..5cc0ef6f 100755
--- a/scripts/debug_lexer.py
+++ b/scripts/debug_lexer.py
@@ -191,7 +191,8 @@ def main(fn, lexer=None, options={}):
reprs = list(map(repr, tok))
print(' ' + reprs[1] + ' ' + ' ' * (29-len(reprs[1])) + reprs[0], end=' ')
if debug_lexer:
- print(' ' + ' ' * (29-len(reprs[0])) + ' : '.join(state) if state else '', end=' ')
+ print(' ' + ' ' * (29-len(reprs[0])) + ' : '.join(state)
+ if state else '', end=' ')
print()
for type, val in lx.get_tokens(text):
@@ -206,10 +207,10 @@ def main(fn, lexer=None, options={}):
else:
show_token(tokens[i], None)
print('Error token:')
- l = len(repr(val))
+ vlen = len(repr(val))
print(' ' + repr(val), end=' ')
if debug_lexer and hasattr(lx, 'ctx'):
- print(' ' * (60-l) + ' : '.join(lx.ctx.stack), end=' ')
+ print(' ' * (60-vlen) + ' : '.join(lx.ctx.stack), end=' ')
print()
print()
return 1