From ce1b91899e3879b945e10eed4f26193a07c3849a Mon Sep 17 00:00:00 2001 From: moculus Date: Mon, 25 Jun 2007 20:35:21 +0000 Subject: [PATCH] --HG-- branch : pmacs2 --- method.py | 1 - mode_xml.py | 43 ++++++++----------------------------------- 2 files changed, 8 insertions(+), 36 deletions(-) diff --git a/method.py b/method.py index 4b4f1cc..bb488fb 100644 --- a/method.py +++ b/method.py @@ -1338,7 +1338,6 @@ class CloseTag(Method): if token.x == x and token.string == self.mytag: break elif token.x <= x and token.end_x() > x: - app.set_error('found non-match: %r %d,%d' % (token.string, i, y)) return i += 1 if i >= len(tokens[y]): diff --git a/mode_xml.py b/mode_xml.py index c54d502..2a7cfb8 100644 --- a/mode_xml.py +++ b/mode_xml.py @@ -1,46 +1,19 @@ import color, mode2 from lex2 import Grammar, PatternRule, RegionRule -class TagGrammar(Grammar): +class OpenTagGrammar(Grammar): rules = [ - RegionRule( - name=r'string', - start=r'(?P["\'])', - grammar=Grammar(), - end=r'%(tag)s', - ), - PatternRule( - name=r'namespace', - pattern=r'[a-zA-Z_]+:', - ), - PatternRule( - name=r'attrname', - pattern=r'[^ =>\n]+(?==)', - ), - PatternRule( - name=r'name', - pattern=r'[^ =>\n]+', - ), + RegionRule(name=r'string', start=r'(?P["\'])', grammar=Grammar(), end=r'%(tag)s'), + PatternRule(name=r'namespace', pattern=r'[a-zA-Z_]+:'), + PatternRule(name=r'attrname', pattern=r'[^ =>\n]+(?==)'), + PatternRule(name=r'name', pattern=r'[^ =>\n]+'), ] class XMLGrammar(Grammar): rules = [ - RegionRule( - name=r'comment', - start=r'', - ), - RegionRule( - name=r'opentag', - start=r'<', - grammar=TagGrammar(), - end=r'/?>', - ), - PatternRule( - name=r'closetag', - pattern=r'< */ *[ =>\n]+ *>', - ), + RegionRule(name=r'comment', start=r''), + RegionRule(name=r'opentag', start=r'<', grammar=OpenTagGrammar(), end=r'/?>'), + PatternRule(name=r'closetag', pattern=r'< */ *[ =>\n]+ *>'), ] class XML(mode2.Fundamental):