blame bugfix and close-tag bugfix

--HG--
branch : pmacs2
This commit is contained in:
moculus 2007-07-23 21:07:43 +00:00
parent b033788a84
commit 95526f36ae
2 changed files with 7 additions and 5 deletions

View File

@ -1346,6 +1346,7 @@ class CloseTag(Method):
highlighter = buffer.highlights[w.mode.name()] highlighter = buffer.highlights[w.mode.name()]
tokens = highlighter.tokens tokens = highlighter.tokens
# REFACTOR: we have methods in window to do this now
i = 0 i = 0
while i < len(tokens[y]): while i < len(tokens[y]):
token = tokens[y][i] token = tokens[y][i]
@ -1361,15 +1362,16 @@ class CloseTag(Method):
while y >= 0: while y >= 0:
while i >= 0 and i < len(tokens[y]): while i >= 0 and i < len(tokens[y]):
token = tokens[y][i] token = tokens[y][i]
n = token.name
s = token.string s = token.string
if token.string in self.closetags: if n in w.mode.closetokens and s in w.mode.closetags:
tag_stack.append(s) tag_stack.append(s)
elif token.string in self.opentags: elif n in w.mode.opentokens and s in w.mode.opentags:
if tag_stack[-1] == self.opentags[s]: if tag_stack[-1] == w.mode.opentags[s]:
del tag_stack[-1] del tag_stack[-1]
else: else:
app.set_error("tag mismatch; got %r expected %r" % app.set_error("tag mismatch; got %r expected %r" %
s, self.close_tags[tag_stack[-1]]) (s, w.mode.closetags[tag_stack[-1]]))
return return
if len(tag_stack) == 0: if len(tag_stack) == 0:
p = Point(token.x, y) p = Point(token.x, y)

View File

@ -10,7 +10,7 @@ class MetadataGrammar(Grammar):
class BlameGrammar(Grammar): class BlameGrammar(Grammar):
rules = [ rules = [
RegionRule(r'metadata', r'^[0-9\.]+', MetadataGrammar, r'[0-9]{4}-[0-9]{2}-[0-9]{2}'), RegionRule(r'metadata', r'^[0-9\.]+', MetadataGrammar, r'(?:[0-9]{4}-[0-9]{2}-[0-9]{2}|[0-9]{2}-[A-Z][a-z]{2}-[0-9]{2})'),
PatternRule(r'data', r'.+$'), PatternRule(r'data', r'.+$'),
] ]