branch : pmacs2
This commit is contained in:
moculus 2007-06-25 20:35:21 +00:00
parent 89ea8f3bcd
commit ce1b91899e
2 changed files with 8 additions and 36 deletions

View File

@ -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]):

View File

@ -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<tag>["\'])',
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<tag>["\'])', 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'<!--',
grammar=Grammar(),
end=r'-->',
),
RegionRule(
name=r'opentag',
start=r'<',
grammar=TagGrammar(),
end=r'/?>',
),
PatternRule(
name=r'closetag',
pattern=r'< */ *[ =>\n]+ *>',
),
RegionRule(name=r'comment', start=r'<!--', grammar=Grammar(), end=r'-->'),
RegionRule(name=r'opentag', start=r'<', grammar=OpenTagGrammar(), end=r'/?>'),
PatternRule(name=r'closetag', pattern=r'< */ *[ =>\n]+ *>'),
]
class XML(mode2.Fundamental):