parent
89ea8f3bcd
commit
ce1b91899e
|
@ -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]):
|
||||
|
|
43
mode_xml.py
43
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<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):
|
||||
|
|
Loading…
Reference in New Issue