branch : pmacs2
This commit is contained in:
moculus 2008-04-05 14:05:57 +00:00
parent 23d2543198
commit b9786298e9
2 changed files with 8 additions and 2 deletions

View File

@ -699,6 +699,11 @@ class Application(object):
token_done = x_offset + len(s) <= slot.width token_done = x_offset + len(s) <= slot.width
token_wrap = x_offset + len(s) > slot.width token_wrap = x_offset + len(s) > slot.width
attr = color.build(*token.color) attr = color.build(*token.color)
#xyz
#if hasattr(token, 'resume') and token.resume:
# attr = color.build('blue', 'green')
#else:
# attr = color.build(*token.color)
self.win.addstr(slot.offset + count, x_offset, s[:slot.width - x_offset], attr) self.win.addstr(slot.offset + count, x_offset, s[:slot.width - x_offset], attr)
if token_wrap: if token_wrap:

5
lex.py
View File

@ -13,6 +13,7 @@ class Token(object):
self.parent = parent self.parent = parent
self.matchd = matchd self.matchd = matchd
self.link = link self.link = link
#self.resume = False #xyz
assert parent is None or hasattr(parent, 'name'), 'oh no %r' % parent assert parent is None or hasattr(parent, 'name'), 'oh no %r' % parent
def parents(self): def parents(self):
if self.parent is not None: if self.parent is not None:
@ -238,8 +239,6 @@ class RegionRule(Rule):
del lexer.mode.gstack[fqname] del lexer.mode.gstack[fqname]
else: else:
mode = lexer.mode mode = lexer.mode
# XYZ
#grammar = self.pairs[i][0]
if self.pairs[i][0] is not None: if self.pairs[i][0] is not None:
grammar = self.pairs[i][0] grammar = self.pairs[i][0]
else: else:
@ -408,8 +407,10 @@ class Lexer(object):
if toresume: if toresume:
for t in toresume[0].rule.resume(self, toresume): for t in toresume[0].rule.resume(self, toresume):
#t.resume = True #xyz
yield t yield t
for t in self._lex(): for t in self._lex():
#t.resume = True #xyz
yield t yield t
del self.action del self.action
raise StopIteration raise StopIteration