diff --git a/Lib/idlelib/PyParse.py b/Lib/idlelib/PyParse.py index d200b6cb2dd..61a0003ce5a 100644 --- a/Lib/idlelib/PyParse.py +++ b/Lib/idlelib/PyParse.py @@ -94,15 +94,16 @@ def dump(*stuff): # Build translation table to map uninteresting chars to "x", open # brackets to "(", and close brackets to ")". -_tran = ['x'] * 256 +_tran = {} +for i in range(256): + _tran[i] = 'x' for ch in "({[": _tran[ord(ch)] = '(' for ch in ")}]": _tran[ord(ch)] = ')' for ch in "\"'\\\n#": _tran[ord(ch)] = ch -_tran = ''.join(_tran) -del ch +del i, ch class Parser: