summaryrefslogtreecommitdiff
path: root/Lib/idlelib/pyparse.py
diff options
context:
space:
mode:
authorTerry Jan Reedy <tjreedy@udel.edu>2018-02-22 01:19:02 -0500
committerGitHub <noreply@github.com>2018-02-22 01:19:02 -0500
commit451d1edaf4d27c4e632d81246d308e8dd6ea945f (patch)
treed45a69250207e55f723331d205f8310c01267a0f /Lib/idlelib/pyparse.py
parent745dc65b17b3936e3f9f4099f735f174d30c4e0c (diff)
downloadcpython-git-451d1edaf4d27c4e632d81246d308e8dd6ea945f.tar.gz
bpo-32905: IDLE - remove unused code in pyparse module (GH-5807)
dump is similar to print but less flexible. lastopenbracketpos is now always initialized in _study2, as was stmt_bracketing, so the class settings are not needed. get_last_open_bracket_pos is never called.
Diffstat (limited to 'Lib/idlelib/pyparse.py')
-rw-r--r--Lib/idlelib/pyparse.py23
1 files changed, 3 insertions, 20 deletions
diff --git a/Lib/idlelib/pyparse.py b/Lib/idlelib/pyparse.py
index 72bd9e00c1..93607dc5bc 100644
--- a/Lib/idlelib/pyparse.py
+++ b/Lib/idlelib/pyparse.py
@@ -18,10 +18,6 @@ import sys
(C_NONE, C_BACKSLASH, C_STRING_FIRST_LINE,
C_STRING_NEXT_LINES, C_BRACKET) = range(5)
-if 0: # for throwaway debugging output
- def dump(*stuff):
- sys.__stdout__.write(" ".join(map(str, stuff)) + "\n")
-
# Find what looks like the start of a popular statement.
_synchre = re.compile(r"""
@@ -496,8 +492,7 @@ class Parser:
# end while p < q:
self.lastch = lastch
- if stack:
- self.lastopenbracketpos = stack[-1]
+ self.lastopenbracketpos = stack[-1] if stack else None
self.stmt_bracketing = tuple(bracketing)
def compute_bracket_indent(self):
@@ -620,22 +615,10 @@ class Parser:
self._study2()
return _closere(self.str, self.stmt_start) is not None
- # XXX - is this used?
- lastopenbracketpos = None
-
- def get_last_open_bracket_pos(self):
- "Return index of last open bracket or None."
- self._study2()
- return self.lastopenbracketpos
-
- # XXX - is this used?
- stmt_bracketing = None
-
def get_last_stmt_bracketing(self):
- """Return a tuple of the structure of the bracketing of the last
- interesting statement.
+ """Return bracketing structure of the last interesting statement.
- Tuple is in the format defined in _study2().
+ The returned tuple is in the format defined in _study2().
"""
self._study2()
return self.stmt_bracketing