From bee0e0cbaa12bba306d8f5c52c6e749f1eb6ea26 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Tue, 7 Oct 2014 15:10:22 +0200 Subject: debug_lexer: remove debug print; allow reading from stdin with filename "-" --- scripts/debug_lexer.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/debug_lexer.py b/scripts/debug_lexer.py index 4d92ebb3..81b9288d 100755 --- a/scripts/debug_lexer.py +++ b/scripts/debug_lexer.py @@ -115,13 +115,16 @@ def main(fn, lexer=None, options={}): debug_lexer = True else: # HACK: ExtendedRegexLexer subclasses will only partially work here. - print(lxcls.__bases__) lxcls.__bases__ = (DebuggingRegexLexer,) debug_lexer = True lx = lxcls(**options) lno = 1 - text = open(fn, 'rb').read().decode('utf-8') + if fn == '-': + text = sys.stdin.read() + else: + with open(fn, 'rb') as fp: + text = fp.read().decode('utf-8') text = text.strip('\n') + '\n' tokens = [] states = [] -- cgit v1.2.1