summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/ReplaceDialog.py
diff options
context:
space:
mode:
authorKurt B. Kaiser <kbk@shore.net>2002-09-14 02:53:05 (GMT)
committerKurt B. Kaiser <kbk@shore.net>2002-09-14 02:53:05 (GMT)
commit2def78bddb407f3ff507024e3cb0045ea05fbaaf (patch)
tree68ab90981619d138cfc7c9d81452f9bd7879d710 /Lib/idlelib/ReplaceDialog.py
parentee7afca550f69ace3e20d25b84432f45c246c600 (diff)
downloadcpython-2def78bddb407f3ff507024e3cb0045ea05fbaaf.zip
cpython-2def78bddb407f3ff507024e3cb0045ea05fbaaf.tar.gz
cpython-2def78bddb407f3ff507024e3cb0045ea05fbaaf.tar.bz2
MERGE DS_RPC_BRANCH into MAIN
ReplaceDialog (missed a change Py Idle 04Apr2002, Booleans, pick up later) track Py Idle: GvR drops 1.5.2 re support 24 Jul
Diffstat (limited to 'Lib/idlelib/ReplaceDialog.py')
-rw-r--r--Lib/idlelib/ReplaceDialog.py20
1 files changed, 2 insertions, 18 deletions
diff --git a/Lib/idlelib/ReplaceDialog.py b/Lib/idlelib/ReplaceDialog.py
index 83462f9..1b6cbce 100644
--- a/Lib/idlelib/ReplaceDialog.py
+++ b/Lib/idlelib/ReplaceDialog.py
@@ -90,7 +90,7 @@ class ReplaceDialog(SearchDialogBase):
line, m = res
chars = text.get("%d.0" % line, "%d.0" % (line+1))
orig = m.group()
- new = self._expand(m, repl)
+ new = m.expand(repl)
i, j = m.span()
first = "%d.%d" % (line, i)
last = "%d.%d" % (line, j)
@@ -142,7 +142,7 @@ class ReplaceDialog(SearchDialogBase):
m = prog.match(chars, col)
if not prog:
return 0
- new = self._expand(m, self.replvar.get())
+ new = m.expand(self.replvar.get())
text.mark_set("insert", first)
text.undo_block_start()
if m.group():
@@ -154,22 +154,6 @@ class ReplaceDialog(SearchDialogBase):
self.ok = 0
return 1
- def _expand(self, m, template):
- # XXX This code depends on internals of the regular expression
- # engine! There's no standard API to do a substitution when you
- # have already found the match. One should be added.
- # The solution here is designed to be backwards compatible
- # with previous Python versions, e.g. 1.5.2.
- # XXX This dynamic test should be done only once.
- if getattr(re, "engine", "pre") == "pre":
- return re.pcre_expand(m, template)
- else: # sre
- # XXX This import should be avoidable...
- import sre_parse
- # XXX This parses the template over and over...
- ptemplate = sre_parse.parse_template(template, m.re)
- return sre_parse.expand_template(ptemplate, m)
-
def show_hit(self, first, last):
text = self.text
text.mark_set("insert", first)