162 lines
6.6 KiB
XML
162 lines
6.6 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<language id="xml" _name="XML" version="2.0" _section="Markup">
|
|
<metadata>
|
|
<property name="mimetypes">application/xml;text/xml</property>
|
|
<property name="globs">*.xml;*.xspf;*.siv;*.smil;*.smi;*.sml;*.kino;*.xul;*.xbel;*.abw;*.zabw;*.glade;*.jnlp;*.xhtml;*.svg;*.docbook;*.mml;*.rdf;*.rss;*.wml;*.xmi;*.fo;*.xslfo;*.xslt;*.xsl</property>
|
|
<property name="block-comment-start"><!--</property>
|
|
<property name="block-comment-end">--></property>
|
|
</metadata>
|
|
|
|
<styles>
|
|
<style id="comment" _name="Comment" map-to="def:comment"/>
|
|
<style id="doctype" _name="DOCTYPE"/>
|
|
<style id="cdata-delim" _name="CDATA Delimiters"/>
|
|
<style id="processing-instruction" _name="Processing Instruction"/>
|
|
<style id="attribute-name" _name="Attribute Name"/> <!--map-to="def:others3"-->
|
|
<style id="attribute-value" _name="Attribute Value" map-to="def:string"/>
|
|
<style id="entity" _name="Entity" map-to="def:escape"/>
|
|
<style id="tags" _name="Tag"/> <!--map-to="def:others2"-->
|
|
<style id="namespace" _name="Namespace"/> <!--map-to="def:others"-->
|
|
<style id="error" _name="Error" map-to="def:error"/>
|
|
</styles>
|
|
|
|
<definitions>
|
|
<define-regex id="prefix">[a-zA-Z_][a-zA-Z0-9._-]*</define-regex>
|
|
|
|
<define-regex id="name">[a-zA-Z_][a-zA-Z0-9.:_-]*</define-regex>
|
|
|
|
<context id="entity" style-ref="entity">
|
|
<match>&\%{name};</match>
|
|
</context>
|
|
|
|
<context id="unallowed-chars" style-ref="error" extend-parent="false">
|
|
<match>[&<]</match>
|
|
</context>
|
|
|
|
<context id="attribute" style-ref="attribute-value">
|
|
<start>((\%{prefix}:)?\%{name}\s*=\s*)"</start>
|
|
<end>"</end>
|
|
<include>
|
|
<context sub-pattern="1" where="start" style-ref="attribute-name" />
|
|
<context sub-pattern="2" where="start" style-ref="namespace" />
|
|
<context ref="entity"/>
|
|
<context ref="unallowed-chars"/>
|
|
</include>
|
|
</context>
|
|
|
|
<!-- FIXME: having almost identical "attribute" and "attribute2" is not nice -->
|
|
<context id="attribute2" style-ref="attribute-value">
|
|
<start>((\%{prefix}:)?\%{name}\s*=\s*)'</start>
|
|
<end>'</end>
|
|
<include>
|
|
<context sub-pattern="1" where="start" style-ref="attribute-name" />
|
|
<context sub-pattern="2" where="start" style-ref="namespace" />
|
|
<context ref="entity"/>
|
|
<context ref="unallowed-chars"/>
|
|
</include>
|
|
</context>
|
|
|
|
<context id="comment" style-ref="comment">
|
|
<start><!--</start>
|
|
<end>--></end>
|
|
<include>
|
|
<context style-ref="error" extend-parent="false">
|
|
<match>--+</match>
|
|
</context>
|
|
<context ref="def:comment:*"/>
|
|
</include>
|
|
</context>
|
|
|
|
<context id="doctype" style-ref="doctype">
|
|
<start><!DOCTYPE</start>
|
|
<end>></end>
|
|
</context>
|
|
|
|
<context id="cdata">
|
|
<start><!\[CDATA\[</start>
|
|
<end>\]\]></end>
|
|
<include>
|
|
<context sub-pattern="0" where="start" style-ref="cdata-delim"/>
|
|
<context sub-pattern="0" where="end" style-ref="cdata-delim"/>
|
|
</include>
|
|
</context>
|
|
|
|
<context id="prolog">
|
|
<start><\?xml</start>
|
|
<end>\?></end>
|
|
<include>
|
|
<context sub-pattern="0" where="start" style-ref="processing-instruction"/>
|
|
<context sub-pattern="0" where="end" style-ref="processing-instruction"/>
|
|
<context ref="attribute"/>
|
|
<context ref="attribute2"/>
|
|
</include>
|
|
</context>
|
|
|
|
<context id="processing-instruction" style-ref="processing-instruction">
|
|
<start><\?</start>
|
|
<end>\?></end>
|
|
</context>
|
|
|
|
<!-- Tags are divided in two parts, one external and one internal
|
|
- <tag attr="foo"> [...] <tag>
|
|
- |____________________________| external
|
|
- |_________| internal
|
|
- |________| attributes
|
|
-->
|
|
<context id="tag">
|
|
<!-- This matches the external portion
|
|
- <tag [...] tag>
|
|
-->
|
|
<start><\s*(\%{prefix}:)?\%{name}</start>
|
|
<end>\/\s*((\%{prefix}:)?\%{name}\s*>)|/></end>
|
|
<include>
|
|
<context sub-pattern="1" where="start" style-ref="namespace" />
|
|
<context sub-pattern="0" where="start" style-ref="tags" />
|
|
<context sub-pattern="2" where="end" style-ref="namespace" />
|
|
<context sub-pattern="0" where="end" style-ref="tags" />
|
|
|
|
<context ref="attribute"/>
|
|
<context ref="attribute2"/>
|
|
|
|
<context id="tag-internal">
|
|
<!-- This matches the internal portion
|
|
- > [...] <
|
|
-->
|
|
<start>></start>
|
|
<end><(?=/)</end>
|
|
<include>
|
|
<context sub-pattern="0" where="start" style-ref="tags" />
|
|
<context sub-pattern="0" where="end" style-ref="tags" />
|
|
<context ref="tag"/>
|
|
<context ref="comment"/>
|
|
<context ref="entity"/>
|
|
<context ref="cdata"/>
|
|
<context ref="processing-instruction"/>
|
|
<context ref="unallowed-chars"/>
|
|
</include>
|
|
</context>
|
|
|
|
<context style-ref="error" extend-parent="false">
|
|
<match>\S</match>
|
|
</context>
|
|
</include>
|
|
</context>
|
|
|
|
<context id="xml">
|
|
<include>
|
|
<context ref="comment"/>
|
|
<context ref="doctype"/>
|
|
<context ref="cdata"/>
|
|
<context ref="prolog"/>
|
|
<context ref="processing-instruction"/>
|
|
|
|
<context ref="tag"/>
|
|
|
|
<context style-ref="error">
|
|
<match>\S</match>
|
|
</context>
|
|
</include>
|
|
</context>
|
|
</definitions>
|
|
</language>
|