comment and small optimization

--HG--
branch : pmacs2
This commit is contained in:
moculus 2008-04-05 18:38:06 +00:00
parent 0defded454
commit 6f6a666d99
1 changed files with 3 additions and 2 deletions

5
lex.py
View File

@ -49,12 +49,13 @@ class Token(object):
self.string += s self.string += s
def end_x(self): def end_x(self):
return self.x + len(self.string) return self.x + len(self.string)
# note that if parent is not none, then this is recursive
def __eq__(self, other): def __eq__(self, other):
return (other is not None and return (other is not None and
self.y == other.y and self.x == other.x and self.y == other.y and self.x == other.x and
self.name == other.name and self.name == other.name and
self.parent == other.parent and self.string == other.string and
self.string == other.string) self.parent == other.parent)
def __repr__(self): def __repr__(self):
if len(self.string) < 10: if len(self.string) < 10:
s = self.string s = self.string