296 lines
8.9 KiB
XML
296 lines
8.9 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!--
|
|
|
|
Author: Martin Szulecki <compiz@sukimashita.com>
|
|
Copyright (C) 2006 Martin Szulecki <compiz@sukimashita.com>
|
|
|
|
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.
|
|
|
|
-->
|
|
<!--
|
|
D Language specification
|
|
|
|
Reference:
|
|
http://www.digitalmars.com/d/lex.html
|
|
-->
|
|
<language id="d" _name="D" version="2.0" _section="Sources">
|
|
<metadata>
|
|
<property name="mimetypes">text/x-dsrc</property>
|
|
<property name="globs">*.d</property>
|
|
<property name="line-comment-start">//</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="error" _name="Error" map-to="def:error"/>
|
|
<style id="string" _name="String" map-to="def:string"/>
|
|
<style id="keyword" _name="Keyword" map-to="def:keyword"/>
|
|
<style id="type" _name="Data Type" map-to="def:type"/>
|
|
<style id="special-token" _name="Special Token" map-to="def:preprocessor"/>
|
|
<style id="null-value" _name="Null Value" map-to="def:special-constant"/>
|
|
<style id="boolean" _name="Boolean" map-to="def:boolean"/>
|
|
<style id="floating-point" _name="Floating point number" map-to="def:floating-point"/>
|
|
<style id="decimal" _name="Decimal number" map-to="def:decimal"/>
|
|
<style id="binary" _name="Binary number" map-to="def:base-n-integer"/>
|
|
<style id="octal" _name="Octal number" map-to="def:base-n-integer"/>
|
|
<style id="hexadecimal" _name="Hexadecimal number" map-to="def:base-n-integer"/>
|
|
</styles>
|
|
|
|
<definitions>
|
|
|
|
<context id="line-comment" style-ref="comment" end-at-line-end="true">
|
|
<start>//</start>
|
|
<include>
|
|
<context ref="def:in-line-comment"/>
|
|
</include>
|
|
</context>
|
|
|
|
<context id="block-comment" style-ref="comment">
|
|
<start>/\*</start>
|
|
<end>\*/</end>
|
|
<include>
|
|
<context ref="def:in-comment"/>
|
|
</include>
|
|
</context>
|
|
|
|
<context id="close-comment-outside-comment" style-ref="error">
|
|
<match>\*/(?!\*)</match>
|
|
</context>
|
|
|
|
<context id="nesting-comment" style-ref="comment">
|
|
<start>/\+</start>
|
|
<end>\+/</end>
|
|
<include>
|
|
<context ref="nesting-comment"/>
|
|
<context ref="def:in-comment"/>
|
|
</include>
|
|
</context>
|
|
|
|
<context id="double-quoted-string" style-ref="string">
|
|
<start>"</start>
|
|
<end>"</end>
|
|
<include>
|
|
<context ref="def:escape"/>
|
|
<context ref="def:line-continue"/>
|
|
</include>
|
|
</context>
|
|
|
|
<context id="single-quoted-string" style-ref="string" end-at-line-end="true">
|
|
<start>'</start>
|
|
<end>'</end>
|
|
<include>
|
|
<context ref="def:escape"/>
|
|
<context ref="def:line-continue"/>
|
|
</include>
|
|
</context>
|
|
|
|
<context id="backtick-quoted-string" style-ref="string">
|
|
<start>`</start>
|
|
<end>`</end>
|
|
<include>
|
|
<context ref="def:escape"/>
|
|
<context ref="def:line-continue"/>
|
|
</include>
|
|
</context>
|
|
|
|
<context id="keywords" style-ref="keyword">
|
|
<keyword>abstract</keyword>
|
|
<keyword>align</keyword>
|
|
<keyword>asm</keyword>
|
|
<keyword>assert</keyword>
|
|
<keyword>body</keyword>
|
|
<keyword>break</keyword>
|
|
<keyword>case</keyword>
|
|
<keyword>cast</keyword>
|
|
<keyword>catch</keyword>
|
|
<keyword>continue</keyword>
|
|
<keyword>debug</keyword>
|
|
<keyword>default</keyword>
|
|
<keyword>delegate</keyword>
|
|
<keyword>delete</keyword>
|
|
<keyword>deprecated</keyword>
|
|
<keyword>do</keyword>
|
|
<keyword>else</keyword>
|
|
<keyword>final</keyword>
|
|
<keyword>finally</keyword>
|
|
<keyword>for</keyword>
|
|
<keyword>foreach</keyword>
|
|
<keyword>function</keyword>
|
|
<keyword>goto</keyword>
|
|
<keyword>if</keyword>
|
|
<keyword>import</keyword>
|
|
<keyword>in</keyword>
|
|
<keyword>inout</keyword>
|
|
<keyword>is</keyword>
|
|
<keyword>mixin</keyword>
|
|
<keyword>new</keyword>
|
|
<keyword>out</keyword>
|
|
<keyword>override</keyword>
|
|
<keyword>pragma</keyword>
|
|
<keyword>private</keyword>
|
|
<keyword>protected</keyword>
|
|
<keyword>public</keyword>
|
|
<keyword>return</keyword>
|
|
<keyword>scope</keyword>
|
|
<keyword>super</keyword>
|
|
<keyword>switch</keyword>
|
|
<keyword>synchronized</keyword>
|
|
<keyword>this</keyword>
|
|
<keyword>throw</keyword>
|
|
<keyword>try</keyword>
|
|
<keyword>typeid</keyword>
|
|
<keyword>typeof</keyword>
|
|
<keyword>unittest</keyword>
|
|
<keyword>version</keyword>
|
|
<keyword>while</keyword>
|
|
<keyword>with</keyword>
|
|
</context>
|
|
|
|
<context id="types" style-ref="type">
|
|
<keyword>alias</keyword>
|
|
<keyword>bool</keyword>
|
|
<keyword>byte</keyword>
|
|
<keyword>cdouble</keyword>
|
|
<keyword>cent</keyword>
|
|
<keyword>cfloat</keyword>
|
|
<keyword>char</keyword>
|
|
<keyword>class</keyword>
|
|
<keyword>creal</keyword>
|
|
<keyword>dchar</keyword>
|
|
<keyword>double</keyword>
|
|
<keyword>enum</keyword>
|
|
<keyword>export</keyword>
|
|
<keyword>float</keyword>
|
|
<keyword>idouble</keyword>
|
|
<keyword>ifloat</keyword>
|
|
<keyword>int</keyword>
|
|
<keyword>interface</keyword>
|
|
<keyword>invariant</keyword>
|
|
<keyword>ireal</keyword>
|
|
<keyword>long</keyword>
|
|
<keyword>module</keyword>
|
|
<keyword>package</keyword>
|
|
<keyword>real</keyword>
|
|
<keyword>short</keyword>
|
|
<keyword>struct</keyword>
|
|
<keyword>template</keyword>
|
|
<keyword>typedef</keyword>
|
|
<keyword>ubyte</keyword>
|
|
<keyword>ucent</keyword>
|
|
<keyword>uint</keyword>
|
|
<keyword>ulong</keyword>
|
|
<keyword>union</keyword>
|
|
<keyword>ushort</keyword>
|
|
<keyword>void</keyword>
|
|
<keyword>wchar</keyword>
|
|
|
|
<!-- split these ones? -->
|
|
<keyword>auto</keyword>
|
|
<keyword>const</keyword>
|
|
<keyword>extern</keyword>
|
|
<keyword>static</keyword>
|
|
<keyword>volatile</keyword>
|
|
</context>
|
|
|
|
<context id="special-tokens" style-ref="special-token">
|
|
<keyword>#line</keyword>
|
|
<keyword>__FILE__</keyword>
|
|
<keyword>__LINE__</keyword>
|
|
<keyword>__DATE__</keyword>
|
|
<keyword>__TIME__</keyword>
|
|
<keyword>__TIMESTAMP__</keyword>
|
|
<keyword>__VENDOR__</keyword>
|
|
<keyword>__VERSION__</keyword>
|
|
</context>
|
|
|
|
<context id="null-value" style-ref="null-value">
|
|
<keyword>null</keyword>
|
|
</context>
|
|
|
|
<context id="boolean" style-ref="boolean">
|
|
<keyword>false</keyword>
|
|
<keyword>true</keyword>
|
|
</context>
|
|
|
|
<context id="float" style-ref="floating-point">
|
|
<match extended="true">
|
|
(?<![\w\.])
|
|
([0-9_]+[Ee][-]?[0-9_]+|([0-9_]*\.[0-9_]+|[0-9_]+\.)([Ee][-]?[0-9_]+)?)[fFLi]?
|
|
(?![\w\.])
|
|
</match>
|
|
</context>
|
|
|
|
<context id="decimal" style-ref="decimal">
|
|
<match extended="true">
|
|
(?<![\w\.])
|
|
([1-9][0-9_]*|0)([Uu]([Ll]|LL|ll)?|([Ll]|LL|ll)[Uu]?)?
|
|
(?![\w\.])
|
|
</match>
|
|
</context>
|
|
|
|
<context id="binary" style-ref="binary">
|
|
<match extended="true">
|
|
(?<![\w\.])
|
|
0[bB][01_]*
|
|
(?![\w\.])
|
|
</match>
|
|
</context>
|
|
|
|
<context id="octal" style-ref="octal">
|
|
<match extended="true">
|
|
(?<![\w\.])
|
|
0[0-7_]+([Uu]([Ll]|LL|ll)?|([Ll]|LL|ll)[Uu]?)?
|
|
(?![\w\.])
|
|
</match>
|
|
</context>
|
|
|
|
<context id="hexadecimal" style-ref="hexadecimal">
|
|
<match extended="true">
|
|
(?<![\w\.])
|
|
0[xX][0-9a-fA-F_]+([Uu]([Ll]|LL|ll)?|([Ll]|LL|ll)[Uu]?)?
|
|
(?![\w\.])
|
|
</match>
|
|
</context>
|
|
|
|
<context id="d">
|
|
<include>
|
|
<context ref="def:shebang"/>
|
|
<context ref="line-comment"/>
|
|
<context ref="block-comment"/>
|
|
<context ref="close-comment-outside-comment"/>
|
|
<context ref="nesting-comment"/>
|
|
<context ref="double-quoted-string"/>
|
|
<context ref="single-quoted-string"/>
|
|
<context ref="backtick-quoted-string"/>
|
|
<context ref="keywords"/>
|
|
<context ref="types"/>
|
|
<context ref="special-tokens"/>
|
|
<context ref="null-value"/>
|
|
<context ref="boolean"/>
|
|
<context ref="float"/>
|
|
<context ref="binary"/>
|
|
<context ref="octal"/>
|
|
<context ref="decimal"/>
|
|
<context ref="hexadecimal"/>
|
|
</include>
|
|
</context>
|
|
|
|
</definitions>
|
|
|
|
</language>
|