on master help sign in
added a gtksourceview-2.0 and gtksourceview-3.0 idris language highlighting grammar for use with gedit and other gnome based text editors. used the existing haskell language specification as a base
commit126ab04b0b43ce732ebdcb5e2685afe7190f35f2 authorDominic Mulligan <dominic.p.mulligan@googlemail.com> dateThu 19 Jan 2012, 11:50 (15 years ago) parente39254c
1 file changed+246
contribs/gtksourceview-2.0-language-spec/idris.lang+246
contribs/gtksourceview-2.0-language-spec/idris.langnew file+246
@@ -0,0 +1,246 @@
1+<?xml version="1.0" encoding="UTF-8"?>
2+<!--
3+
4+ Author: Dominic Mulligan
5+ Copyright (C) 2012 Dominic Mulligan <dominic.p.mulligan@gmail.com>
6+
7+ Lexemes taken from src/Idris/Parser.hs.
8+
9+ Based on the gtksourceview-2.0 Haskell style by:
10+
11+ Authors: Duncan Coutts, Anders Carlsson
12+ Copyright (C) 2004, 2007 Duncan Coutts <duncan@haskell.org>
13+ Copyright (C) 2004 Anders Carlsson <andersca@gnome.org>
14+
15+ This library is free software; you can redistribute it and/or
16+ modify it under the terms of the GNU Library General Public
17+ License as published by the Free Software Foundation; either
18+ version 2 of the License, or (at your option) any later version.
19+
20+ This library is distributed in the hope that it will be useful,
21+ but WITHOUT ANY WARRANTY; without even the implied warranty of
22+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23+ Library General Public License for more details.
24+
25+ You should have received a copy of the GNU Library General Public
26+ License along with this library; if not, write to the
27+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
28+ Boston, MA 02111-1307, USA.
29+
30+-->
31+<language id="idris" _name="Idris" version="2.0" _section="Sources">
32+ <metadata>
33+ <property name="mimetypes">text/x-idris</property>
34+ <property name="globs">*.idr</property>
35+ </metadata>
36+
37+ <styles>
38+ <style id="preprocessor" _name="Preprocessor" map-to="def:preprocessor"/>
39+ <style id="comment" _name="Comment" map-to="def:comment"/>
40+ <style id="variable" _name="Variable" />
41+ <style id="symbol" _name="Symbol" />
42+ <style id="keyword" _name="Keyword" map-to="def:keyword"/>
43+ <style id="type" _name="Data Type" map-to="def:type"/>
44+ <style id="string" _name="String" map-to="def:string"/>
45+ <style id="character" _name="Character" map-to="def:character"/>
46+ <style id="char-escape" _name="Escaped Character" map-to="def:special-char"/>
47+ <style id="decimal" _name="Decimal" map-to="def:decimal"/>
48+ <style id="float" _name="Float" map-to="def:floating-point"/>
49+ </styles>
50+
51+ <definitions>
52+ <define-regex id="symbolchar">[!#$%&amp;*+./&gt;=&lt;?@:\\^|~-]</define-regex>
53+
54+ <context id="line-comment" style-ref="comment" end-at-line-end="true" class="comment" class-disabled="no-spell-check">
55+ <start>(?&lt;!\%{symbolchar})--+(?!\%{symbolchar})</start>
56+ <include>
57+ <context ref="def:in-comment"/>
58+ <context ref="haddock:line-paragraph"/>
59+ <context ref="haddock:directive"/>
60+ </include>
61+ </context>
62+
63+ <context id="block-comment" style-ref="comment" class="comment" class-disabled="no-spell-check">
64+ <start>\{-</start>
65+ <end>-\}</end>
66+ <include>
67+ <context ref="def:in-comment"/>
68+ <context ref="haddock:block-paragraph"/>
69+ <context ref="haddock:directive"/>
70+ <context ref="block-comment"/>
71+ </include>
72+ </context>
73+
74+ <context id="variable" style-ref="variable">
75+ <match>\b[a-z_][0-9a-zA-Z_'#]*</match>
76+ </context>
77+
78+ <context id="type-or-constructor" style-ref="type">
79+ <match>\b[A-Z][0-9a-zA-Z._'#]*</match>
80+ </context>
81+
82+ <context id="symbol" style-ref="symbol" extend-parent="false">
83+ <match>\%{symbolchar}+</match>
84+ </context>
85+
86+ <context id="keysymbol" style-ref="keyword">
87+ <prefix>(?&lt;!\%{symbolchar})</prefix>
88+ <suffix>(?!\%{symbolchar})</suffix>
89+ <keyword>\.</keyword>
90+ <keyword>:</keyword>
91+ <keyword>%</keyword>
92+ <keyword>=</keyword>
93+ <keyword>\|</keyword>
94+ <keyword>\</keyword>
95+ <keyword>-&gt;</keyword>
96+ <keyword>@</keyword>
97+ <keyword>~</keyword>
98+ <keyword>=&gt;</keyword>
99+ <keyword>\(\)</keyword>
100+ <keyword>\_\|\_</keyword>
101+ <keyword>\*\*</keyword>
102+ </context>
103+
104+ <define-regex id="escaped-character" extended="true">
105+ \\( # leading backslash
106+ [abfnrtv\\"\'&amp;] | # escaped character
107+ [0-9]+ | # decimal digits
108+ o[0-7]+ | # 'o' followed by octal digits
109+ x[0-9A-Fa-f]+ | # 'x' followed by hex digits
110+ \^[A-Z@\[\\\]^_] | # control character codes
111+ NUL | SOH | STX | ETX | EOT | ENQ | ACK |
112+ BEL | BS | HT | LF | VT | FF | CR | SO |
113+ SI | DLE | DC1 | DC2 | DC3 | DC4 | NAK |
114+ SYN | ETB | CAN | EM | SUB | ESC | FS | GS |
115+ RS | US | SP | DEL # control char names
116+ )
117+ </define-regex>
118+
119+ <context id="string" style-ref="string" end-at-line-end="true" class="string" class-disabled="no-spell-check">
120+ <start>"</start>
121+ <end>"</end>
122+ <include>
123+ <context ref="def:line-continue"/>
124+ <context style-ref="char-escape">
125+ <match>\%{escaped-character}</match>
126+ </context>
127+ </include>
128+ </context>
129+
130+ <context id="char" style-ref="character" end-at-line-end="true">
131+ <start>'</start>
132+ <end>'</end>
133+ <include>
134+ <context style-ref="char-escape" once-only="true">
135+ <match>\%{escaped-character}</match>
136+ </context>
137+ <context once-only="true" extend-parent="false">
138+ <match>.</match>
139+ </context>
140+ <context style-ref="def:error" extend-parent="false">
141+ <match>.</match>
142+ </context>
143+ </include>
144+ </context>
145+
146+ <context id="float" style-ref="float">
147+ <match extended="true">
148+ [0-9]+ \. [0-9]+ ([eE][+-]?[0-9]+)?
149+ | [0-9]+ [eE][+-]?[0-9]+
150+ </match>
151+ </context>
152+
153+ <context id="decimal" style-ref="decimal">
154+ <match>[0-9]+</match>
155+ </context>
156+
157+ <context id="keyword" style-ref="keyword">
158+ <keyword>Set</keyword>
159+ <keyword>case</keyword>
160+ <keyword>class</keyword>
161+ <keyword>data</keyword>
162+ <keyword>default</keyword>
163+ <keyword>do</keyword>
164+ <keyword>record</keyword>
165+ <keyword>foreign</keyword>
166+ <keyword>lib</keyword>
167+ <keyword>link</keyword>
168+ <keyword>include</keyword>
169+ <keyword>hide</keyword>
170+ <keyword>freeze</keyword>
171+ <keyword>access</keyword>
172+ <keyword>logging</keyword>
173+ <keyword>abstract</keyword>
174+ <keyword>public</keyword>
175+ <keyword>private</keyword>
176+ <keyword>namespace</keyword>
177+ <keyword>syntax</keyword>
178+ <keyword>term</keyword>
179+ <keyword>pattern</keyword>
180+ <keyword>params</keyword>
181+ <keyword>import</keyword>
182+ <keyword>using</keyword>
183+ <keyword>in</keyword>
184+ <keyword>infix</keyword>
185+ <keyword>infixl</keyword>
186+ <keyword>infixr</keyword>
187+ <keyword>prefix</keyword>
188+ <keyword>instance</keyword>
189+ <keyword>let</keyword>
190+ <keyword>module</keyword>
191+ <keyword>of</keyword>
192+ <keyword>qualified</keyword>
193+ <keyword>then</keyword>
194+ <keyword>where</keyword>
195+ <keyword>with</keyword>
196+ <keyword>type</keyword>
197+ <keyword>proof</keyword>
198+ <keyword>rewrite</keyword>
199+ <keyword>exact</keyword>
200+ <keyword>intros</keyword>
201+ <keyword>intro</keyword>
202+ <keyword>refine</keyword>
203+ <keyword>trivial</keyword>
204+ <keyword>focus</keyword>
205+ <keyword>try</keyword>
206+ <keyword>compute</keyword>
207+ <keyword>solve</keyword>
208+ <keyword>attack</keyword>
209+ <keyword>refl</keyword>
210+ <keyword>state</keyword>
211+ <keyword>term</keyword>
212+ <keyword>undo</keyword>
213+ <keyword>qed</keyword>
214+ <keyword>abandon</keyword>
215+ <keyword>tactics</keyword>
216+ <keyword>static</keyword>
217+ <keyword>impossible</keyword>
218+ </context>
219+
220+ <context id="body">
221+ <include>
222+ <context ref="line-comment"/>
223+ <context ref="block-comment"/>
224+ <context ref="keyword"/>
225+ <context ref="variable"/>
226+ <context ref="type-or-constructor"/>
227+ <context ref="keysymbol"/>
228+ <context ref="symbol"/>
229+ <context ref="string"/>
230+ <context ref="char"/>
231+ <context ref="float"/>
232+ <context ref="decimal"/>
233+ </include>
234+ </context>
235+
236+ <context id="idris" class="no-spell-check">
237+ <include>
238+ <context ref="c:if0-comment"/>
239+ <context ref="c:include"/>
240+ <context ref="c:preprocessor"/>
241+ <context ref="body"/>
242+ </include>
243+ </context>
244+
245+ </definitions>
246+</language>