parent
89ea8f3bcd
commit
ce1b91899e
|
@ -1338,7 +1338,6 @@ class CloseTag(Method):
|
||||||
if token.x == x and token.string == self.mytag:
|
if token.x == x and token.string == self.mytag:
|
||||||
break
|
break
|
||||||
elif token.x <= x and token.end_x() > x:
|
elif token.x <= x and token.end_x() > x:
|
||||||
app.set_error('found non-match: %r %d,%d' % (token.string, i, y))
|
|
||||||
return
|
return
|
||||||
i += 1
|
i += 1
|
||||||
if i >= len(tokens[y]):
|
if i >= len(tokens[y]):
|
||||||
|
|
43
mode_xml.py
43
mode_xml.py
|
@ -1,46 +1,19 @@
|
||||||
import color, mode2
|
import color, mode2
|
||||||
from lex2 import Grammar, PatternRule, RegionRule
|
from lex2 import Grammar, PatternRule, RegionRule
|
||||||
|
|
||||||
class TagGrammar(Grammar):
|
class OpenTagGrammar(Grammar):
|
||||||
rules = [
|
rules = [
|
||||||
RegionRule(
|
RegionRule(name=r'string', start=r'(?P<tag>["\'])', grammar=Grammar(), end=r'%(tag)s'),
|
||||||
name=r'string',
|
PatternRule(name=r'namespace', pattern=r'[a-zA-Z_]+:'),
|
||||||
start=r'(?P<tag>["\'])',
|
PatternRule(name=r'attrname', pattern=r'[^ =>\n]+(?==)'),
|
||||||
grammar=Grammar(),
|
PatternRule(name=r'name', pattern=r'[^ =>\n]+'),
|
||||||
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):
|
class XMLGrammar(Grammar):
|
||||||
rules = [
|
rules = [
|
||||||
RegionRule(
|
RegionRule(name=r'comment', start=r'<!--', grammar=Grammar(), end=r'-->'),
|
||||||
name=r'comment',
|
RegionRule(name=r'opentag', start=r'<', grammar=OpenTagGrammar(), end=r'/?>'),
|
||||||
start=r'<!--',
|
PatternRule(name=r'closetag', pattern=r'< */ *[ =>\n]+ *>'),
|
||||||
grammar=Grammar(),
|
|
||||||
end=r'-->',
|
|
||||||
),
|
|
||||||
RegionRule(
|
|
||||||
name=r'opentag',
|
|
||||||
start=r'<',
|
|
||||||
grammar=TagGrammar(),
|
|
||||||
end=r'/?>',
|
|
||||||
),
|
|
||||||
PatternRule(
|
|
||||||
name=r'closetag',
|
|
||||||
pattern=r'< */ *[ =>\n]+ *>',
|
|
||||||
),
|
|
||||||
]
|
]
|
||||||
|
|
||||||
class XML(mode2.Fundamental):
|
class XML(mode2.Fundamental):
|
||||||
|
|
Loading…
Reference in New Issue