ldpl-highlighter/gedit/ldpl.lang

224 lines
7.7 KiB
Plaintext
Raw Normal View History

2024-02-21 06:24:58 +00:00
<?xml version="1.0" encoding="UTF-8"?>
<!--
LDPL Syntax Highlighting for Gedit, Pluma and friends
Author: Martín del Río
Copyright (C) 2019 Martín del Río <martin@ldpl-lang.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, see <http://www.gnu.org/licenses/>.
-->
<language id="ldpl" name="LDPL" version="2.0" _section="Source">
<metadata>
<property name="globs">*.ldpl</property>
<property name="line-comment-start">#</property>
</metadata>
<styles>
<style id="comment" name="Comment" map-to="def:comment"/>
<style id="keyword" name="Keyword" map-to="def:keyword"/>
<style id="type" name="Type" map-to="def:type"/>
<style id="section" name="Section" map-to="def:special-constant"/>
<style id="sub" name="Sub" map-to="def:function"/>
<style id="string" name="String" map-to="def:string"/>
<style id="os" name="OS Name" map-to="def:special-constant"/>
<style id="block" name="Block" map-to="def:function"/>
<style id="escaped-char" name="Escaped Character" map-to="def:special-char"/>
<style id="comp" name="Comparison" map-to="def:identifier"/>
<style id="floating-point" name="Floating Point" map-to="def:floating-point"/>
<style id="decimal" name="Decimal" map-to="def:decimal"/>
</styles>
<definitions>
<context id="comment" style-ref="comment" end-at-line-end="true" class="comment" class-disabled="no-spell-check">
<start>#</start>
<include>
<context ref="def:in-comment"/>
</include>
</context>
<context id="sub" style-ref="sub">
<keyword>end sub-procedure</keyword>
<keyword>sub-procedure</keyword>
<keyword>end sub</keyword>
<keyword>sub</keyword>
<keyword>create statement</keyword>
<keyword>executing</keyword>
</context>
<context id="section" style-ref="section">
<keyword>external</keyword>
<keyword>local data</keyword>
<keyword>data</keyword>
<keyword>procedure</keyword>
<keyword>parameters</keyword>
<keyword>include</keyword>
<keyword>using package</keyword>
<keyword>flag</keyword>
<keyword>extension</keyword>
<keyword>label</keyword>
</context>
<context id="os" style-ref="os">
<keyword>linux</keyword>
<keyword>macos</keyword>
<keyword>android</keyword>
<keyword>bsd</keyword>
<keyword>emscripten</keyword>
<keyword>crlf</keyword>
<keyword>lf</keyword>
</context>
<context id="type" style-ref="type">
<keyword>numbers</keyword>
<keyword>number</keyword>
<keyword>texts</keyword>
<keyword>text</keyword>
<keyword>lists</keyword>
<keyword>list</keyword>
<keyword>maps</keyword>
<keyword>map</keyword>
</context>
<context id="comp" style-ref="comp">
<keyword>is greater than</keyword>
<keyword>is less than</keyword>
<keyword>is equal to</keyword>
<keyword>is not equal to</keyword>
<keyword>is greater than or equal to</keyword>
<keyword>is less than or equal to</keyword>
</context>
<context id="keyword" style-ref="keyword">
<keyword>get character at</keyword>
<keyword>get length of</keyword>
<keyword>get ascii character</keyword>
<keyword>get character code of</keyword>
<keyword>store quote</keyword>
<keyword>end quote</keyword>
<keyword>get index of</keyword>
<keyword>delete last element of</keyword>
<keyword>get key count of</keyword>
<keyword>get keys of</keyword>
<keyword>and store output in</keyword>
<keyword>and store exit code in</keyword>
<keyword>to file</keyword>
<keyword>until eof</keyword>
<keyword>load file</keyword>
<keyword>is</keyword>
<keyword>of</keyword>
<keyword>store</keyword>
<keyword>in</keyword>
<keyword>:</keyword>
<keyword>return</keyword>
<keyword>and</keyword>
<keyword>or</keyword>
<keyword>from</keyword>
<keyword>to</keyword>
<keyword>step</keyword>
<keyword>break</keyword>
<keyword>continue</keyword>
<keyword>return</keyword>
<keyword>call</keyword>
<keyword>with</keyword>
<keyword>exit</keyword>
<keyword>wait</keyword>
<keyword>milliseconds</keyword>
<keyword>goto</keyword>
<keyword>solve</keyword>
<keyword>join</keyword>
<keyword>floor</keyword>
<keyword>modulo</keyword>
<keyword>by</keyword>
<keyword>display</keyword>
<keyword>get</keyword>
<keyword>random</keyword>
<keyword>replace</keyword>
<keyword>split</keyword>
<keyword>count</keyword>
<keyword>substring</keyword>
<keyword>length</keyword>
<keyword>trim</keyword>
<keyword>push</keyword>
<keyword>clear</keyword>
<keyword>copy</keyword>
<keyword>accept</keyword>
<keyword>execute</keyword>
<keyword>write</keyword>
<keyword>append</keyword>
</context>
<context id="block" style-ref="block">
<keyword>end if</keyword>
<keyword>if</keyword>
<keyword>then</keyword>
<keyword>while</keyword>
<keyword>do</keyword>
<keyword>repeat</keyword>
<keyword>for each</keyword>
<keyword>for</keyword>
<keyword>else</keyword>
</context>
<context id="decimal" style-ref="decimal">
<match>\b([1-9][0-9]*|0)([Uu]([Ll]|LL|ll)?|([Ll]|LL|ll)[Uu]?)?\b</match>
</context>
<context id="floating-point" style-ref="floating-point">
<match>\b([0-9]+[Ee][-]?[0-9]+|([0-9]*\.[0-9]+|[0-9]+\.)([Ee][-]?[0-9]+)?)[fFlL]?</match>
</context>
<context id="escaped-char" style-ref="escaped-char" extend-parent="true">
<match extended="true">
\\( # leading backslash
[\\'"abfnrtv] | # single escaped char
N\{[0-9A-Z\ -]+\} | # named unicode character
u[0-9A-Fa-f]{4} | # xxxx - character with 16-bit hex value xxxx
U[0-9A-Fa-f]{8} | # xxxxxxxx - character with 32-bit hex value xxxxxxxx
x[0-9A-Fa-f]{1,2} | # \xhh - character with hex value hh
[0-7]{1,3} # \ooo - character with octal value ooo
)
</match>
</context>
<context id="string" style-ref="string" end-at-line-end="true" class="string" class-disabled="no-spell-check">
<start>"</start>
<end>"</end>
<include>
<context ref="escaped-char"/>
</include>
</context>
<context id="ldpl" class="no-spell-check">
<include>
<context ref="def:shell-like-comment"/>
<context ref="section"/>
<context ref="sub"/>
<context ref="os"/>
<context ref="type"/>
<context ref="comp"/>
<context ref="keyword"/>
<context ref="block"/>
<context ref="decimal"/>
<context ref="floating-point"/>
<context ref="escaped-char"/>
<context ref="string"/>
</include>
</context>
</definitions>
</language>