summaryrefslogtreecommitdiff
path: root/scripts/find_error.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2012-02-04 10:49:17 +0100
committerGeorg Brandl <georg@python.org>2012-02-04 10:49:17 +0100
commit0245eb9e14ea82d573e367061f376fda67f8577a (patch)
tree36be9f3bd78d4a5b21dfcf6daafd20c06bc9560c /scripts/find_error.py
parent7cef32ec183e53298e76304b965f1ea2c5f3577c (diff)
downloadpygments-0245eb9e14ea82d573e367061f376fda67f8577a.tar.gz
Fix find_error script if error is in very beginning of file.
Diffstat (limited to 'scripts/find_error.py')
-rwxr-xr-xscripts/find_error.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/scripts/find_error.py b/scripts/find_error.py
index 199e9c5c..1b793790 100755
--- a/scripts/find_error.py
+++ b/scripts/find_error.py
@@ -123,7 +123,7 @@ def main(fn, lexer=None, options={}):
for tok, state in map(None, tokens, states):
show_token(tok, state)
else:
- for i in range(len(tokens) - num, len(tokens)):
+ for i in range(max(len(tokens) - num, 0), len(tokens)):
show_token(tokens[i], states[i])
print 'Error token:'
l = len(repr(val))