From 492f361b79f93a110679ccb7f7e86f4814990dee Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Fri, 10 Jan 2014 10:52:53 +0100 Subject: new year in copyright notice --- scripts/find_error.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts/find_error.py') diff --git a/scripts/find_error.py b/scripts/find_error.py index 00923569..75f4b0ff 100755 --- a/scripts/find_error.py +++ b/scripts/find_error.py @@ -8,7 +8,7 @@ the text where Error tokens are being generated, along with some context. - :copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ -- cgit v1.2.1 From a9169c157a05c82a1b8a7ffb92e7f159fb4ca0f8 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Sat, 18 Jan 2014 13:25:15 +0100 Subject: futurizing: move to print_function and "except X as Y" syntax --- scripts/find_error.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'scripts/find_error.py') 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: -- cgit v1.2.1 From b6b690fb833e7031a3008509c1107f7567c065f3 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Sat, 18 Jan 2014 13:29:19 +0100 Subject: manual prettifying and small fixes after futurize run --- scripts/find_error.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'scripts/find_error.py') diff --git a/scripts/find_error.py b/scripts/find_error.py index 3ee77d7d..7a513701 100755 --- a/scripts/find_error.py +++ b/scripts/find_error.py @@ -11,9 +11,11 @@ :copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ + from __future__ import print_function -import sys, os +import os +import sys # always prefer Pygments from source if exists srcpath = os.path.join(os.path.dirname(__file__), '..') -- cgit v1.2.1 From 97703d63f39e6086d497a6a749c9eee3293dcbeb Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Sat, 18 Jan 2014 16:44:49 +0100 Subject: Finalize single-source port for Py2.[67] and Py3.3+. --- scripts/find_error.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts/find_error.py') diff --git a/scripts/find_error.py b/scripts/find_error.py index 7a513701..7aaa9bee 100755 --- a/scripts/find_error.py +++ b/scripts/find_error.py @@ -107,7 +107,7 @@ def main(fn, lexer=None, options={}): # already debugged before debug_lexer = True lno = 1 - text = file(fn, 'U').read() + text = open(fn, 'U').read() text = text.strip('\n') + '\n' tokens = [] states = [] -- cgit v1.2.1