[Python-checkins] python/dist/src/Tools/idle ReplaceDialog.py,1.6,1.7

gvanrossum@users.sourceforge.net gvanrossum@users.sourceforge.net
2002年7月24日 12:13:10 -0700


Update of /cvsroot/python/python/dist/src/Tools/idle
In directory usw-pr-cvs1:/tmp/cvs-serv8087
Modified Files:
	ReplaceDialog.py 
Log Message:
Get rid of _expand() altogether - the match object supports m.expand().
Index: ReplaceDialog.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/idle/ReplaceDialog.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** ReplaceDialog.py	24 Jul 2002 01:49:16 -0000	1.6
--- ReplaceDialog.py	24 Jul 2002 19:13:08 -0000	1.7
***************
*** 7,11 ****
 import SearchEngine
 from SearchDialogBase import SearchDialogBase
- import sre_parse
 
 def replace(text):
--- 7,10 ----
***************
*** 92,96 ****
 chars = text.get("%d.0" % line, "%d.0" % (line+1))
 orig = m.group()
! new = self._expand(m, repl)
 i, j = m.span()
 first = "%d.%d" % (line, i)
--- 91,95 ----
 chars = text.get("%d.0" % line, "%d.0" % (line+1))
 orig = m.group()
! new = m.expand(repl)
 i, j = m.span()
 first = "%d.%d" % (line, i)
***************
*** 144,148 ****
 if not prog:
 return False
! new = self._expand(m, self.replvar.get())
 text.mark_set("insert", first)
 text.undo_block_start()
--- 143,147 ----
 if not prog:
 return False
! new = m.expand(self.replvar.get())
 text.mark_set("insert", first)
 text.undo_block_start()
***************
*** 155,166 ****
 self.ok = 0
 return True
- 
- 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.
- # 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):
--- 154,157 ----

AltStyle によって変換されたページ (->オリジナル) /