[pypy-svn] r39758 - pypy/branch/rope-branch/pypy/objspace/std
arigo at codespeak.net
arigo at codespeak.net
Sat Mar 3 08:57:19 CET 2007
Author: arigo
Date: Sat Mar 3 08:57:17 2007
New Revision: 39758
Modified:
pypy/branch/rope-branch/pypy/objspace/std/rope.py
Log:
* translation fixes
* remove tabs
Modified: pypy/branch/rope-branch/pypy/objspace/std/rope.py
==============================================================================
--- pypy/branch/rope-branch/pypy/objspace/std/rope.py (original)
+++ pypy/branch/rope-branch/pypy/objspace/std/rope.py Sat Mar 3 08:57:17 2007
@@ -73,6 +73,7 @@
return self.s[index]
def getitem_slice(self, start, stop):
+ assert 0 <= start <= stop
return LiteralStringNode(self.s[start:stop])
def dot(self, seen, toplevel=False):
@@ -90,7 +91,7 @@
class BinaryConcatNode(StringNode):
def __init__(self, left, right):
self.left = left
- self.right = right
+ self.right = right
self.len = left.length() + right.length()
self._depth = max(left.depth(), right.depth()) + 1
self.balanced = False
@@ -150,9 +151,10 @@
class SliceNode(StringNode):
def __init__(self, start, stop, node):
+ assert 0 <= start <= stop
self.start = start
- self.stop = stop
- self.node = node
+ self.stop = stop
+ self.node = node
def length(self):
return self.stop - self.start
@@ -385,6 +387,7 @@
offset = start - newstart
start = newstart
stop = newstop
+ assert 0 <= start <= stop
if isinstance(node, LiteralStringNode):
result = node.s.find(c, start, stop)
if result == -1:
@@ -537,7 +540,7 @@
class FringeIterator(object):
def __init__(self, node):
self.stack = [node]
-
+
def next(self):
while self.stack:
curr = self.stack.pop()
@@ -563,7 +566,7 @@
self.stack = [node]
self.fringestack = []
self.fringe = []
-
+
def next(self):
if self.fringestack:
result = self.fringestack.pop()
More information about the Pypy-commit
mailing list