Skip to content

Commit

Permalink
Add "gtksourceview-3.0" language spec for *.lpp files
Browse files Browse the repository at this point in the history
This can be used to enable syntax highlighting for *.lp files in some
text editors (e.g. Gedit on Ubuntu). Just execute the shell script to
install the language specs.
  • Loading branch information
ubruhin committed Oct 28, 2017
1 parent 9d160a7 commit 4a75934
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
57 changes: 57 additions & 0 deletions dev/gtksourceview-3.0/language-specs/librepcb-file.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<language id="librepcb" _name="LibrePCB" version="2.0" _section="Other">

<metadata>
<property name="mimetypes">application/x-librepcb-file</property>
<property name="globs">*.lp</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="element" _name="Element" map-to="def:keyword"/>
<style id="token" _name="Token" map-to="def:identifier"/>
</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>

<define-regex id="name">[[:alpha:]_][[:alnum:].:_-]*</define-regex>
<context id="element" style-ref="element">
<match>\(\b\%{name}\s*</match>
</context>

<context id="endtag" style-ref="element">
<match>\)</match>
</context>

<context id="catchall" style-ref="token" extend-parent="false">
<match>\S</match>
</context>

<context id="librepcb" class="no-spell-check">
<include>
<context ref="line-comment"/>
<context ref="string"/>
<context ref="element"/>
<context ref="endtag"/>
<context ref="catchall"/>
</include>
</context>

</definitions>
</language>
4 changes: 4 additions & 0 deletions dev/install_gtksourceview_language_spec.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash

cp -r ./gtksourceview-3.0 $HOME/.local/share/

0 comments on commit 4a75934

Please sign in to comment.