Skip to content

Instantly share code, notes, and snippets.

@aw
Last active May 10, 2018 02:19
Show Gist options
  • Save aw/ebe7a24c280751fe410a6c76fc4e11aa to your computer and use it in GitHub Desktop.
Save aw/ebe7a24c280751fe410a6c76fc4e11aa to your computer and use it in GitHub Desktop.
PicoLisp syntax highlighting for Pluma / gtksourceview
<?xml version="1.0" encoding="UTF-8"?>
<!--
This file is part of GtkSourceView
Author: Paolo Borelli <[email protected]>
Copyright (C) 2006-2007 Paolo Borelli
GtkSourceView 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.1 of the License, or (at your option) any later version.
GtkSourceView 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, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-->
<language id="picolisp" _name="PicoLisp" version="2.0" _section="Source">
<metadata>
<property name="mimetypes">text/x-picolisp</property>
<property name="globs">*.l</property>
<property name="line-comment-start">#</property>
</metadata>
<styles>
<style id="comment" _name="Comment" map-to="def:comment"/>
<style id="string" _name="String" map-to="def:string"/>
<style id="keyword" _name="Keyword" map-to="def:keyword"/>
<style id="function" _name="Function" map-to="def:function"/>
<style id="decimal" _name="Decimal number" map-to="def:decimal"/>
</styles>
<definitions>
<context id="line-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="string" style-ref="string" class="string" class-disabled="no-spell-check">
<start>"</start>
<end>"</end>
<include>
<context ref="def:escape"/>
</include>
</context>
<context id="keyword" style-ref="keyword">
<prefix>(?&lt;![\w\d_-])</prefix>
<suffix>(?![\w\d_-])</suffix>
<keyword>and</keyword>
<keyword>case</keyword>
<keyword>casq</keyword>
<keyword>cond</keyword>
<keyword>de</keyword>
<keyword>def</keyword>
<keyword>do</keyword>
<keyword>for</keyword>
<keyword>if</keyword>
<keyword>if2</keyword>
<keyword>in</keyword>
<keyword>let</keyword>
<keyword>load</keyword>
<keyword>native</keyword>
<keyword>prog</keyword>
<keyword>setq</keyword>
<keyword>sys</keyword>
<keyword>or</keyword>
<keyword>out</keyword>
<keyword>quote</keyword>
<keyword>unless</keyword>
<keyword>until</keyword>
<keyword>when</keyword>
<keyword>while</keyword>
</context>
<context id="function" style-ref="function">
<prefix>(?&lt;![\w\d_-])</prefix>
<suffix>(?![\w\d_-])</suffix>
<keyword>abs</keyword>
<keyword>accu</keyword>
<keyword>append</keyword>
<keyword>apply</keyword>
<keyword>assoc</keyword>
<keyword>asoq</keyword>
<keyword>atom</keyword>
<keyword>bin</keyword>
<keyword>bool</keyword>
<keyword>car</keyword>
<keyword>cdr</keyword>
<keyword>caar</keyword>
<keyword>cadr</keyword>
<keyword>caddr</keyword>
<keyword>call</keyword>
<keyword>catch</keyword>
<keyword>cdaar</keyword>
<keyword>cddar</keyword>
<keyword>cdddr</keyword>
<keyword>cddr</keyword>
<keyword>char</keyword>
<keyword>conc</keyword>
<keyword>cons</keyword>
<keyword>eof</keyword>
<keyword>eof</keyword>
<keyword>eval</keyword>
<keyword>inc</keyword>
<keyword>length</keyword>
<keyword>list</keyword>
<keyword>load</keyword>
<keyword>make</keyword>
<keyword>map</keyword>
<keyword>mapc</keyword>
<keyword>mapcar</keyword>
<keyword>max</keyword>
<keyword>member</keyword>
<keyword>memq</keyword>
<keyword>min</keyword>
<keyword>money</keyword>
<keyword>NIL</keyword>
<keyword>T</keyword>
<keyword>not</keyword>
<keyword>num\?</keyword>
<keyword>pair\?</keyword>
<keyword>port</keyword>
<keyword>read</keyword>
<keyword>round</keyword>
<keyword>sqrt</keyword>
<keyword>str\?</keyword>
<keyword>symbol</keyword>
<keyword>sym\?</keyword>
<keyword>wait</keyword>
</context>
<context id="decimal" style-ref="decimal">
<match>([0-9])</match>
</context>
<context id="picolisp" class="no-spell-check">
<include>
<context ref="line-comment"/>
<context ref="string"/>
<context ref="keyword"/>
<context ref="function"/>
<context ref="decimal"/>
</include>
</context>
</definitions>
</language>
@aw
Copy link
Author

aw commented Dec 26, 2017

Usage: Add this file to /usr/share/gtksourceview-3.0/language-specs, or wherever your gtksourceview lang files belong.

Note: I hacked this up in ~10 minutes to quickly add some PicoLisp syntax highlighting in Pluma (Gedit).

It's clearly missing a ton of functions, and it doesn't quite make sense to differentiate between keywords and functions in PicoLisp, but it's better than nothing. Feel free to submit revisions/improvements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment