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

217 lines
8.8 KiB
Plaintext
Raw Normal View History

2006-08-26 02:46:29 -07:00
<?xml version="1.0" encoding="UTF-8"?>
2007-06-17 22:03:03 -07:00
<!--
2007-09-09 12:21:19 -07:00
Authors: Marco Barisione, Emanuele Aina, Paolo Borelli
2007-06-17 22:03:03 -07:00
Copyright (C) 2005-2007 Marco Barisione <barisione@gmail.com>
Copyright (C) 2005-2007 Emanuele Aina
2007-09-09 12:21:19 -07:00
Copyright (C) 2007 Paolo Borelli
2007-06-17 22:03:03 -07:00
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
-->
<language id="xml" _name="XML" version="2.0" _section="Markup">
<metadata>
2007-09-09 12:21:19 -07:00
<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;*.mml;*.rdf;*.rss;*.wml;*.xmi;*.fo;*.xslfo;*.xslt;*.xsl</property>
<property name="block-comment-start">&lt;!--</property>
<property name="block-comment-end">--&gt;</property>
</metadata>
2006-08-26 02:46:29 -07:00
<styles>
<style id="comment" _name="Comment" map-to="def:comment"/>
2007-09-09 12:21:19 -07:00
<style id="doctype" _name="DOCTYPE" map-to="def:preprocessor"/>
<style id="cdata-delim" _name="CDATA delimiter" map-to="def:preprocessor"/>
<style id="processing-instruction" _name="Processing instruction" map-to="def:preprocessor"/>
<style id="element-name" _name="Element name" map-to="def:identifier"/>
<style id="attribute-name" _name="Attribute name" map-to="def:type"/>
<style id="attribute-value" _name="Attribute value" map-to="def:string"/>
<style id="entity" _name="Entity" map-to="def:preprocessor"/>
<style id="tag" _name="Tag"/>
<style id="namespace" _name="Namespace" map-to="xml:element-name"/>
2006-08-26 02:46:29 -07:00
<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>&amp;\%{name};</match>
</context>
2007-05-16 20:48:23 -07:00
<context id="character-reference" style-ref="entity">
<match>&amp;#([0-9]+|x[a-fA-F0-9]+);</match>
</context>
2006-08-26 02:46:29 -07:00
<context id="unallowed-chars" style-ref="error" extend-parent="false">
<match>[&amp;&lt;]</match>
</context>
<context id="comment" style-ref="comment">
<start>&lt;!--</start>
<end>--&gt;</end>
<include>
<context style-ref="error" extend-parent="false">
<match>--+</match>
</context>
2006-12-31 02:54:51 -08:00
<context ref="def:in-comment"/>
2006-08-26 02:46:29 -07:00
</include>
</context>
<context id="doctype">
<start>(&lt;!DOCTYPE)\s+(\%{name})</start>
2006-08-26 02:46:29 -07:00
<end>&gt;</end>
<include>
<context sub-pattern="1" where="start" style-ref="doctype"/>
<context sub-pattern="2" where="start" style-ref="doctype"/>
<context sub-pattern="0" where="end" style-ref="doctype"/>
<context>
<match>(SYSTEM)\s+(\"[^\"]*\")</match>
<include>
<context sub-pattern="1" style-ref="doctype"/>
<context sub-pattern="2" style-ref="attribute-value"/>
</include>
</context>
<context>
<match>(PUBLIC)\s+(\"[^\"]*\")\s+(\"[^\"]*\")</match>
<include>
<context sub-pattern="1" style-ref="doctype"/>
<context sub-pattern="2" style-ref="attribute-value"/>
<context sub-pattern="3" style-ref="attribute-value"/>
</include>
</context>
<context>
<start>\[</start>
<end>\]</end>
<include>
<context sub-pattern="0" where="start" style-ref="doctype"/>
<context sub-pattern="0" where="end" style-ref="doctype"/>
<context ref="dtd:dtd"/>
</include>
</context>
</include>
2006-08-26 02:46:29 -07:00
</context>
<context id="cdata">
<start>&lt;!\[CDATA\[</start>
<end>\]\]&gt;</end>
<include>
<context sub-pattern="0" where="start" style-ref="cdata-delim"/>
<context sub-pattern="0" where="end" style-ref="cdata-delim"/>
</include>
</context>
2007-09-09 12:21:19 -07:00
<context id="processing-instruction" style-ref="processing-instruction">
<start>&lt;\?</start>
<end>\?&gt;</end>
</context>
<!-- The following three contexts can be <replace>d in xml
dialect lang files, to custommize highlighting, e.g.
highlighting docbook tags as keywords -->
<context id="namespace" style-ref="namespace">
<match>(?&lt;!:)\%{prefix}:</match>
</context>
<context id="element-name" once-only="true" style-ref="element-name">
<match>\b\%{name}\b(?!\s*=)</match>
</context>
<context id="attribute-name" style-ref="attribute-name">
<match>\b\%{name}\s*=</match>
</context>
<context id="attribute-value" style-ref="attribute-value">
<start>["']</start>
<end>\%{0@start}</end>
<include>
<context ref="entity"/>
<context ref="character-reference"/>
<context ref="unallowed-chars"/>
</include>
</context>
2006-08-26 02:46:29 -07:00
<context id="prolog">
<start>&lt;\?xml</start>
<end>\?&gt;</end>
<include>
<context sub-pattern="0" where="start" style-ref="processing-instruction"/>
<context sub-pattern="0" where="end" style-ref="processing-instruction"/>
2007-09-09 12:21:19 -07:00
<context ref="attribute-value"/>
<context ref="attribute-name"/>
2006-08-26 02:46:29 -07:00
</include>
</context>
2007-09-09 12:21:19 -07:00
<context id="start-tag" style-ref="tag">
<start>&lt;(?!/)</start>
<end>/?&gt;</end>
2006-08-26 02:46:29 -07:00
<include>
2007-09-09 12:21:19 -07:00
<context sub-pattern="0" where="start" style-ref="element-name"/>
<context sub-pattern="0" where="end" style-ref="element-name"/>
<context ref="entity"/>
<context ref="character-reference"/>
<context ref="unallowed-chars"/>
<context ref="namespace"/>
<context ref="element-name"/>
<context ref="attribute-name"/>
<context ref="attribute-value"/>
<context style-ref="error" extend-parent="false">
<match>\S</match>
2006-08-26 02:46:29 -07:00
</context>
2007-09-09 12:21:19 -07:00
</include>
</context>
2006-08-26 02:46:29 -07:00
2007-09-09 12:21:19 -07:00
<context id="end-tag" style-ref="tag">
<start>&lt;/</start>
<end>&gt;</end>
<include>
<context sub-pattern="0" where="start" style-ref="element-name"/>
<context sub-pattern="0" where="end" style-ref="element-name"/>
<context ref="entity"/>
<context ref="character-reference"/>
<context ref="unallowed-chars"/>
<context ref="namespace"/>
<context ref="element-name"/>
2006-08-26 02:46:29 -07:00
<context style-ref="error" extend-parent="false">
2007-09-09 12:21:19 -07:00
<match>\S</match>
2006-08-26 02:46:29 -07:00
</context>
</include>
</context>
2007-09-09 12:21:19 -07:00
<context id="close-tag-outside-tag" style-ref="error">
<match>/&gt;</match>
</context>
2006-08-26 02:46:29 -07:00
<context id="xml">
<include>
<context ref="comment"/>
<context ref="doctype"/>
<context ref="cdata"/>
<context ref="prolog"/>
<context ref="processing-instruction"/>
2007-09-09 12:21:19 -07:00
<context ref="start-tag"/>
<context ref="end-tag"/>
<context ref="entity"/>
<context ref="character-reference"/>
<context ref="unallowed-chars"/>
<context ref="close-tag-outside-tag"/>
2006-08-26 02:46:29 -07:00
</include>
</context>
</definitions>
</language>