intial upload of lartu's original code

This commit is contained in:
John Paul Wohlscheid 2024-02-21 01:24:58 -05:00
parent 5475498753
commit 544c9bdb88
7 changed files with 320 additions and 2 deletions

View File

@ -1,3 +1,5 @@
# ldpl-highlighter
# LDPL Code Highlighter
LDPL syntax highlighting for nano and gedit code editors
LDPL syntax highlighting for nano and gedit code editors
This code was originally removed from the LDPL 5 release by lartu with the goal of moving it to a separate repo. I'm creating a backup of this code because I have not been able to find the separate on GitHub.

2
gedit/install.sh Executable file
View File

@ -0,0 +1,2 @@
#!/usr/bin/env bash
sudo cp ldpl.lang /usr/share/gtksourceview-3.0/language-specs/

223
gedit/ldpl.lang Normal file
View File

@ -0,0 +1,223 @@
<?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>

15
gedit/readme Normal file
View File

@ -0,0 +1,15 @@
+---------------------------------------------------+
| LDPL Syntax Highlighting for Gedit / Pluma / Etc. |
+---------------------------------------------------+
[Installing]
To install LDPL syntax highlighting for the gedit / pluma / etc editors just
run the install.sh file found in the same folder as this README.
[Installing (by hand)]
1. Copy the file ldpl.lang to /usr/share/gtksourceview-3.0/language-specs/
2. Restart Gedit / Pluma / Etc.
[Uninstalling]
Delete /usr/share/gtksourceview-3.0/language-specs/ldpl.lang

12
nano/README Normal file
View File

@ -0,0 +1,12 @@
+-----------------------------------+
| LDPL Syntax Highlighting for nano |
| by Martín del Río |
+-----------------------------------+
[Installing]
To install LDPL syntax highlighting for the nano editor just
run the install.sh file found in the same folder as this README.
[Uninstalling]
Remove LDPL releated lines from ~/.nanorc
Delete ~/.nano/ldpl.nanorc

14
nano/install.sh Executable file
View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
# Check if ~/.nano directory exists
if [ ! -d "$HOME/.nano" ]; then
echo "Creating ~/.nano directory..."
mkdir ~/.nano
fi
# Copy ldpl.nanorc to ~/.nano
echo "Copying ldpl.nanorc to ~/.nano"
cp ldpl.nanorc ~/.nano/ldpl.nanorc
# Add ldpl.nanorc to .nanorc
echo "include $HOME/.nano/ldpl.nanorc" >> ~/.nanorc

50
nano/ldpl.nanorc Normal file
View File

@ -0,0 +1,50 @@
syntax "LDPL" ".(ldpl|lsc)$"
color red "\".*?\""
color red "(|-)[0-9][0-9]*"
# Numbers, Strings & Constants
color magenta "(end if|if|then|while|do|repeat|for each|for|else)"
# Blocks
color yellow "(substring|length|trim|push|clear|copy|accept|execute|write|append)"
color yellow "(floor|modulo|by|display|get|random|replace|split|count)"
color yellow "(return|call|with|exit|wait|milliseconds|goto|solve|join)"
color yellow "(is|of|store|in|:|return|and|or|from|to|step|break|continue)"
color yellow "(and store exit code in|to file|until eof|load file)"
color yellow "(get key count of|get keys of|and store ouput in)"
color yellow "(store quote|end quote|get index of|delete last element of)"
color yellow "(get character at|get length of|get ascii character)"
# Statements
color magenta "(is greater than or equal to|is less than or equal to)"
color magenta "(is greater than|is less than|is equal to|is not equal to)"
# Comparisons
color cyan "(number|text|list|map)"
color cyan "(numbers|texts|lists|maps)"
# Data types
color green "(crlf|lf)"
color green "(linux|macos|android|bsd|emscripten)"
# OS
color green "(using package|flag|extension|label)"
color green "(external|local data|data|procedure|parameters|include)"
# Sections
color cyan "(create statement|executing)"
color cyan "(end sub|sub)"
color cyan "(end sub-procedure|sub-procedure)"
# Sub-Procedure Stuff
color cyan "(\:|\+|\-|\*|\/|\(|\)|\%)"
# Operators
color red "\".*\""
color red "(|-)[0-9][0-9]*"
# Numbers, Strings & Constants
color green "\#.*"
# Comments