[Idle-dev] CVS: idle ReplaceDialog.py,1.3,1.4

Kurt B. Kaiser kbk@users.sourceforge.net
Fri, 13 Sep 2002 19:53:07 -0700


Update of /cvsroot/idlefork/idle
In directory usw-pr-cvs1:/tmp/cvs-serv24710

Modified Files:
	ReplaceDialog.py 
Log Message:
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


Index: ReplaceDialog.py
===================================================================
RCS file: /cvsroot/idlefork/idle/ReplaceDialog.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** ReplaceDialog.py	12 Jul 2001 06:54:16 -0000	1.3
--- ReplaceDialog.py	14 Sep 2002 02:53:05 -0000	1.4
***************
*** 91,95 ****
              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)
***************
*** 143,147 ****
          if not prog:
              return 0
!         new = self._expand(m, self.replvar.get())
          text.mark_set("insert", first)
          text.undo_block_start()
--- 143,147 ----
          if not prog:
              return 0
!         new = m.expand(self.replvar.get())
          text.mark_set("insert", first)
          text.undo_block_start()
***************
*** 154,173 ****
          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):
--- 154,157 ----