Own-Programming-Language-Tu.../editors/gtksourceview/ownlang.lang
2024-02-17 21:48:09 +02:00

90 lines
2.9 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<language id="ownlang" name="OwnLang" version="2.0" _section="Source">
<metadata>
<property name="mimetypes">text/x-own</property>
<property name="globs">*.own</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="escaped-character" name="Escaped Character" map-to="def:special-char"/>
<style id="string" name="String" map-to="def:string"/>
<style id="keyword" name="Keyword" map-to="def:keyword"/>
<style id="boolean" name="Boolean value" map-to="def:boolean"/>
<style id="number" name="Number" map-to="def:decimal"/>
<style id="type" name="Data Type" map-to="def:type"/>
</styles>
<definitions>
<define-regex id="escaped-character" extended="true">
\\( # leading backslash
[\\\"\'nrbtf] | # escaped character
[0-9]{1,3} | # latin encoded char
u[0-9]{1,4} # unicode char
)
</define-regex>
<context id="string" style-ref="string" end-at-line-end="true" class="string"
class-disabled="no-spell-check">
<start>"</start>
<end>"</end>
<include>
<context id="escaped-character" style-ref="escaped-character">
<match>\%{escaped-character}</match>
</context>
</include>
</context>
<context id="keywords" style-ref="keyword">
<keyword>print</keyword>
<keyword>println</keyword>
<keyword>if</keyword>
<keyword>else</keyword>
<keyword>while</keyword>
<keyword>for</keyword>
<keyword>do</keyword>
<keyword>break</keyword>
<keyword>continue</keyword>
<keyword>def</keyword>
<keyword>return</keyword>
<keyword>use</keyword>
<keyword>match</keyword>
<keyword>case</keyword>
<keyword>extract</keyword>
<keyword>include</keyword>
<keyword>class</keyword>
<keyword>new</keyword>
</context>
<context id="boolean" style-ref="boolean">
<keyword>false</keyword>
<keyword>true</keyword>
</context>
<context id="numeric" style-ref="number">
<match extended="true">
(\b([0-9]+|0[xX][0-9a-fA-F]+)[Ll]?\b|
\b(([0-9]+[Ee][-]?[0-9]+|
([0-9]*\.[0-9]+|[0-9]+\.)([Ee][-]?[0-9]+)?)))
</match>
</context>
<context id="ownlang" class="no-spell-check">
<include>
<context ref="def:c-like-comment" style-ref="comment"/>
<context ref="def:c-like-comment-multiline" style-ref="comment"/>
<context ref="def:c-like-close-comment-outside-comment"/>
<context ref="boolean"/>
<context ref="numeric"/>
<context ref="string"/>
<context ref="keywords"/>
</include>
</context>
</definitions>
</language>