diff options
author | Georg Brandl <georg@python.org> | 2014-10-07 16:10:21 +0200 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2014-10-07 16:10:21 +0200 |
commit | 80d2ee61b9c146bc4dd5dec9d43a3a7e4c44ed36 (patch) | |
tree | dbd8b041d3aabffdf32f961621d67ad1e8ee7137 /scripts/debug_lexer.py | |
parent | 68dfb127bc105ba9b2bcadac476220ab30161da4 (diff) | |
download | pygments-80d2ee61b9c146bc4dd5dec9d43a3a7e4c44ed36.tar.gz |
debug_lexer: fix missing import and wrong API usage
Diffstat (limited to 'scripts/debug_lexer.py')
-rwxr-xr-x | scripts/debug_lexer.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/scripts/debug_lexer.py b/scripts/debug_lexer.py index 81b9288d..dfc28ce2 100755 --- a/scripts/debug_lexer.py +++ b/scripts/debug_lexer.py @@ -24,7 +24,8 @@ if os.path.isdir(os.path.join(srcpath, 'pygments')): from pygments.lexer import RegexLexer, ProfilingRegexLexer, ProfilingRegexLexerMeta -from pygments.lexers import get_lexer_by_name, find_lexer_class_for_filename +from pygments.lexers import get_lexer_by_name, find_lexer_class, \ + find_lexer_class_for_filename from pygments.token import Error, Text, _TokenType from pygments.cmdline import _parse_options @@ -93,10 +94,9 @@ def main(fn, lexer=None, options={}): else: lxcls = find_lexer_class_for_filename(os.path.basename(fn)) if lxcls is None: - try: - name, rest = fn.split('_', 1) - lxcls = find_lexer_class(name) - except ValueError: + name, rest = fn.split('_', 1) + lxcls = find_lexer_class(name) + if lxcls is None: raise AssertionError('no lexer found for file %r' % fn) debug_lexer = False if profile: |