medit/moo/mooedit/language-specs/dtd.lang

120 lines
3.8 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<language id="dtd" _name="DTD" version="2.0" _section="Markup">
<metadata>
<property name="mimetypes">text/x-dtd</property>
<property name="globs">*.dtd</property>
<property name="block-comment-start">&lt;!--</property>
<property name="block-comment-end">--&gt;</property>
</metadata>
<styles>
<style id="entity" name="entity" map-to="xml:entity"/>
<style id="decl" name="decl" map-to="xml:doctype"/>
<style id="error" name="error" map-to="xml:error"/>
<style id="quoted-value" name="quoted-value" map-to="xml:attribute-value"/>
</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="decl-element">
<start>&lt;!ELEMENT\b</start>
<end>&gt;</end>
<include>
<context sub-pattern="0" where="start" style-ref="decl"/>
<context sub-pattern="0" where="end" style-ref="decl"/>
<context ref="entity"/>
<context ref="quoted-value"/>
</include>
</context>
<context id="quoted-value" style-ref="quoted-value">
<start>"</start>
<end>"</end>
<include>
<context style-ref="entity">
<match>[%&amp;]\%{name};</match>
</context>
<context style-ref="error" extend-parent="false">
<match>[%&amp;]\S*</match>
</context>
</include>
</context>
<context id="NDATA" extend-parent="false">
<start>\bNDATA\b</start>
<include>
<context sub-pattern="0" where="start" style-ref="decl"/>
<context>
<match>\%{name}</match>
</context>
<context ref="error"/>
</include>
</context>
<context id="decl-entity">
<start>&lt;!ENTITY\s+(%\s+)?\%{name}\b</start>
<end>&gt;</end>
<include>
<context sub-pattern="0" where="start" style-ref="decl"/>
<context sub-pattern="0" where="end" style-ref="decl"/>
<context ref="quoted-value"/>
<context extend-parent="false">
<start>(SYSTEM|PUBLIC)(?=\s|$)</start>
<include>
<context sub-pattern="0" where="start" style-ref="decl"/>
<context ref="quoted-value"/>
<context ref="NDATA"/>
<context ref="error"/>
</include>
</context>
<context ref="error"/>
</include>
</context>
<context id="decl-attlist">
<start>&lt;!ATTLIST\b</start>
<end>&gt;</end>
<include>
<context sub-pattern="0" where="start" style-ref="decl"/>
<context sub-pattern="0" where="end" style-ref="decl"/>
<context ref="entity"/>
<context ref="quoted-value"/>
</include>
</context>
<context id="decl-notation">
<start>&lt;!NOTATION\b</start>
<end>&gt;</end>
<include>
<context sub-pattern="0" where="start" style-ref="decl"/>
<context sub-pattern="0" where="end" style-ref="decl"/>
<context ref="entity"/>
<context ref="quoted-value"/>
</include>
</context>
<context id="error" style-ref="error" extend-parent="false">
<match>\S+</match>
</context>
<context id="dtd">
<include>
<context ref="xml:comment"/>
<context ref="decl-element"/>
<context ref="decl-entity"/>
<context ref="decl-attlist"/>
<context ref="decl-notation"/>
<context ref="error"/>
</include>
</context>
</definitions>
</language>