Skip to content

Instantly share code, notes, and snippets.

@yoursunny
Last active December 12, 2015 02:28
Show Gist options
  • Save yoursunny/4699175 to your computer and use it in GitHub Desktop.
Save yoursunny/4699175 to your computer and use it in GitHub Desktop.
Oberon0 syntax highlighter for gtksourceview-3.0 Place this file in ~/.local/share/gtksourceview-3.0/language-specs/ Limitation: does not support nested comments.
<?xml version="1.0" encoding="UTF-8"?>
<language id="oberon0" _name="Oberon0" version="2.0" _section="Sources">
<metadata>
<property name="globs">*.ob0;*.ob</property>
</metadata>
<styles>
<style id="comment" _name="Comment" map-to="def:comment"/>
<style id="error" _name="Error" map-to="def:error"/>
<style id="string" _name="String" map-to="def:string"/>
<style id="included-file" _name="Included File" map-to="def:string"/>
<style id="char" _name="Character" map-to="def:character"/>
<style id="keyword" _name="Keyword" map-to="def:keyword"/>
<style id="type" _name="Data Type" map-to="def:type"/>
<style id="storage-class" _name="Storage Class" map-to="def:type"/>
<style id="escaped-character" _name="Escaped Character" map-to="def:special-char"/>
<style id="floating-point" _name="Floating point number" map-to="def:floating-point"/>
<style id="decimal" _name="Decimal number" map-to="def:decimal"/>
<style id="octal" _name="Octal number" map-to="def:base-n-integer"/>
<style id="hexadecimal" _name="Hexadecimal number" map-to="def:base-n-integer"/>
<style id="boolean" _name="Boolean value" map-to="def:boolean"/>
</styles>
<definitions>
<context id="comment-multiline" style-ref="comment" class-disabled="no-spell-check">
<start>\(\*</start>
<end>\*\)</end>
<include>
<context ref="def:in-comment"/>
</include>
</context>
<context id="quoted-string" style-ref="string" end-at-line-end="true" class-disabled="no-spell-check">
<start>"</start>
<end>"</end>
<include>
<context ref="def:line-continue"/>
</include>
</context>
<context id="char-string" style-ref="char">
<match extended="true">
(?&lt;![\w\.])
[0-9][0-9A-F]*X
(?![\w\.])
</match>
</context>
<context id="hexadecimal" style-ref="hexadecimal">
<match extended="true">
(?&lt;![\w\.])
[0-9][0-9A-F]*H
(?![\w\.])
</match>
</context>
<context id="decimal" style-ref="decimal">
<match extended="true">
(?&lt;![\w\.])
[0-9]+
(?![\w\.])
</match>
</context>
<context id="boolean" style-ref="boolean">
<match extended="true">
(?&lt;![\w\.])
(TRUE|FALSE)
(?![\w\.])
</match>
</context>
<context id="keywords" style-ref="keyword">
<keyword>ARRAY</keyword>
<keyword>BEGIN</keyword>
<keyword>BY</keyword>
<keyword>CASE</keyword>
<keyword>CONST</keyword>
<keyword>DIV</keyword>
<keyword>DO</keyword>
<keyword>ELSE</keyword>
<keyword>ELSIF</keyword>
<keyword>END</keyword>
<keyword>FALSE</keyword>
<keyword>FOR</keyword>
<keyword>IF</keyword>
<keyword>IMPORT</keyword>
<keyword>IN</keyword>
<keyword>IS</keyword>
<keyword>MOD</keyword>
<keyword>MODULE</keyword>
<keyword>NIL</keyword>
<keyword>OF</keyword>
<keyword>OR</keyword>
<keyword>POINTER</keyword>
<keyword>PROCEDURE</keyword>
<keyword>RECORD</keyword>
<keyword>REPEAT</keyword>
<keyword>RETURN</keyword>
<keyword>THEN</keyword>
<keyword>TO</keyword>
<keyword>TYPE</keyword>
<keyword>UNTIL</keyword>
<keyword>VAR</keyword>
<keyword>WHILE</keyword>
</context>
<context id="types" style-ref="type">
<keyword>BOOLEAN</keyword>
<keyword>CHAR</keyword>
<keyword>INTEGER</keyword>
</context>
<context id="builtin-function" style-ref="keyword">
<keyword>CHR</keyword>
<keyword>COPY</keyword>
<keyword>LEN</keyword>
<keyword>ORD</keyword>
</context>
<context id="oberon0" class="no-spell-check">
<include>
<context ref="comment-multiline"/>
<context ref="quoted-string"/>
<context ref="char-string"/>
<context ref="hexadecimal"/>
<context ref="decimal"/>
<context ref="boolean"/>
<context ref="keywords"/>
<context ref="types"/>
<context ref="builtin-function"/>
</include>
</context>
</definitions>
</language>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment