summaryrefslogtreecommitdiff
path: root/scripts/find_error.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2014-01-18 13:25:15 +0100
committerGeorg Brandl <georg@python.org>2014-01-18 13:25:15 +0100
commita9169c157a05c82a1b8a7ffb92e7f159fb4ca0f8 (patch)
treeface5db25ebef227315a0ae1080d4b2262f6fe23 /scripts/find_error.py
parente921fe0b430608cb7e0c89f7fada9260cb4822eb (diff)
downloadpygments-a9169c157a05c82a1b8a7ffb92e7f159fb4ca0f8.tar.gz
futurizing: move to print_function and "except X as Y" syntax
Diffstat (limited to 'scripts/find_error.py')
-rwxr-xr-xscripts/find_error.py21
1 files changed, 11 insertions, 10 deletions
diff --git a/scripts/find_error.py b/scripts/find_error.py
index 75f4b0ff..3ee77d7d 100755
--- a/scripts/find_error.py
+++ b/scripts/find_error.py
@@ -11,6 +11,7 @@
:copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
+from __future__ import print_function
import sys, os
@@ -111,29 +112,29 @@ def main(fn, lexer=None, options={}):
def show_token(tok, state):
reprs = map(repr, tok)
- print ' ' + reprs[1] + ' ' + ' ' * (29-len(reprs[1])) + reprs[0],
+ print(' ' + reprs[1] + ' ' + ' ' * (29-len(reprs[1])) + reprs[0], end=' ')
if debug_lexer:
- print ' ' + ' ' * (29-len(reprs[0])) + repr(state),
- print
+ print(' ' + ' ' * (29-len(reprs[0])) + repr(state), end=' ')
+ print()
for type, val in lx.get_tokens(text):
lno += val.count('\n')
if type == Error:
- print 'Error parsing', fn, 'on line', lno
- print 'Previous tokens' + (debug_lexer and ' and states' or '') + ':'
+ print('Error parsing', fn, 'on line', lno)
+ print('Previous tokens' + (debug_lexer and ' and states' or '') + ':')
if showall:
for tok, state in map(None, tokens, states):
show_token(tok, state)
else:
for i in range(max(len(tokens) - num, 0), len(tokens)):
show_token(tokens[i], states[i])
- print 'Error token:'
+ print('Error token:')
l = len(repr(val))
- print ' ' + repr(val),
+ print(' ' + repr(val), end=' ')
if debug_lexer and hasattr(lx, 'statestack'):
- print ' ' * (60-l) + repr(lx.statestack),
- print
- print
+ print(' ' * (60-l) + repr(lx.statestack), end=' ')
+ print()
+ print()
return 1
tokens.append((type, val))
if debug_lexer: