Ejemplo n.º 1
0
def mark2(hole):
    if isinstance(hole, dot):
        return dotmarker(hole, True)
    if isinstance(hole, star):
        return starmarker(hole, hole.last, hole.first)
    if isinstance(hole, holepartial):
        return starmarker(hole.hole, hole.stop, hole.start)
Ejemplo n.º 2
0
def mark0(hole):
    if isinstance(hole, dot):
        return dotmarker(hole, False)
    if isinstance(hole, star):
        return starmarker(hole, 0, 0)
    if isinstance(hole, holepartial):
        return starmarker(hole.hole, hole.start, hole.start)
Ejemplo n.º 3
0
def mark1(hole):
    if isinstance(hole, dot):
        return dotmarker(hole, True)
    if isinstance(hole, star):
        cursor = hole.last
        return starmarker(hole, cursor, cursor)
    if isinstance(hole, holepartial):
        return starmarker(hole.hole, hole.stop, hole.stop)
Ejemplo n.º 4
0
 def replace(self, data, branch_in=False):
     length = sum(editlength(obj) for obj in data)
     self.buffer.do(self.marker, replace(data))
     if self.marker.dot:
         self.marker = dotmarker(self.marker.hole, visited = not branch_in)
     else:
         cursor = self.marker.start + length * (not branch_in)
         self.marker = starmarker(self.marker.hole, cursor, cursor)
     if branch_in:
         self.walk()