1<?xml version="1.0" encoding="UTF-8"?>
2<!--
3
4 This file is part of GtkSourceView
5
6 Authors: Marco Barisione, Emanuele Aina
7 Copyright (C) 2005-2007 Marco Barisione <barisione@gmail.com>
8 Copyright (C) 2005-2007 Emanuele Aina
9
10 GtkSourceView is free software; you can redistribute it and/or
11 modify it under the terms of the GNU Lesser General Public
12 License as published by the Free Software Foundation; either
13 version 2.1 of the License, or (at your option) any later version.
14
15 GtkSourceView is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18 Lesser General Public License for more details.
19
20 You should have received a copy of the GNU Lesser General Public License
21 along with this library; if not, see <http://www.gnu.org/licenses/>.
22
23-->
24<language id="def" name="Defaults" hidden="true" version="2.0">
25  <styles>
26
27    <!-- styles defined here are all the styles that
28         a language can use as default for its styles.
29         The styles are defined in logical groups.
30         A style scheme has to at least define the style
31         for the first item of each group and if desired
32         define the style for the other items to achieve a
33         more finegrained control on the apperance.
34         Finally a style scheme may also define language
35         specific styles. -->
36
37    <!-- Comment group -->
38    <!-- Any comment -->
39    <style id="comment"             name="Comment"/>
40    <!-- A shebang: #!/bin/sh -->
41    <style id="shebang"             name="Shebang"               map-to="def:comment"/>
42    <!-- A special comment containing documentation like in javadoc or
43         gtk-doc -->
44    <style id="doc-comment"         name="Documentation comment" map-to="def:comment"/>
45    <!-- A element inside a documentation comment: @author -->
46    <!-- This style doesn't map to anything since it must be used as an additional
47         style for text which is already styled as a "doc-comment" -->
48    <style id="doc-comment-element" name="Documentation comment element" />
49
50    <!-- Constant group -->
51    <!-- Any constant -->
52    <style id="constant"            name="Constant"/>
53    <!-- A character constant: 'c' -->
54    <style id="character"           name="Character"             map-to="def:constant"/>
55    <!-- A string constant: "this is a string" -->
56    <style id="string"              name="String"                map-to="def:constant"/>
57    <!-- Special character in a string constant: "%s", "\t" -->
58    <!-- This style doesn't map to anything since it must be used as an additional
59         style for text which is already styled as a "string" -->
60    <style id="special-char"        name="Special character (inside a string)" />
61    <!-- A generic number constant -->
62    <style id="number"              name="Number"                map-to="def:constant"/>
63    <!-- A floating point constant: 2.3e10 -->
64    <style id="floating-point"      name="Floating point number" map-to="def:number"/>
65    <!-- A decimal number: 1234 -->
66    <style id="decimal"             name="Decimal number"        map-to="def:number"/>
67    <!-- A base-N number: 0xFFFF -->
68    <style id="base-n-integer"      name="Base-N number"         map-to="def:number"/>
69    <!-- A complex number -->
70    <style id="complex"             name="Complex number"        map-to="def:number"/>
71    <!-- A special constant like NULL in C or null in Java -->
72    <style id="special-constant"    name="Special constant"      map-to="def:constant"/>
73    <!-- A boolean constant: TRUE, false -->
74    <style id="boolean"             name="Boolean value"         map-to="def:special-constant"/>
75
76    <!-- Identifier group -->
77    <!-- Any variable name -->
78    <style id="identifier"          name="Identifier" />
79    <!-- A function name (also: methods for classes) -->
80    <style id="function"            name="Function" map-to="def:identifier"/>
81    <!-- A builtin name: like __import__, abs in Python
82        (see http://docs.python.org/lib/built-in-funcs.html) -->
83    <style id="builtin"             name="Built-in identifier" map-to="def:identifier"/>
84
85    <!-- Statement group -->
86    <!-- Any statement -->
87    <style id="statement"           name="Statement"/>
88    <!-- Operators: "+", "*", etc. -->
89    <style id="operator"            name="Operator" map-to="def:statement" />
90    <!-- keywords: "if", "for", "while", etc. -->
91    <style id="keyword"             name="Keyword" map-to="def:statement" />
92
93    <!-- Type group -->
94    <!--A primitive data type: int, long, char, etc. -->
95    <style id="type"                name="Data type"/>
96
97    <!-- Others -->
98    <!-- This one is for '#include <foo.h>' and "#pragma blah", or 'use foobar', etc.. -->
99    <style id="preprocessor"        name="Preprocessor directive"/>
100    <!-- Any erroneous construct -->
101    <style id="error"               name="Error"/>
102    <!-- to mark possibily errors or unrecommended syntax  -->
103    <style id="warning"             name="Warning"/>
104    <!--Reserved keywords: like "const" and "goto" in Java -->
105    <style id="reserved"            name="Reserved keyword" map-to="def:error" />
106    <!-- Anything that needs extra attention; mostly the keywords TODO, FIXME and XXX -->
107    <style id="note"                name="Note (FIXME, TODO, XXX, etc.)"/>
108    <!-- Text that stands out, HTML links, e-mail addresses, etc. -->
109    <style id="underlined"          name="Underlined"/>
110    <!-- Text that acts as some kind of heading, such as h1, h2, ... in html. -->
111    <style id="heading0"            name="Heading 0"/>
112    <style id="heading1"            name="Heading 1"/>
113    <style id="heading2"            name="Heading 2"/>
114    <style id="heading3"            name="Heading 3"/>
115    <style id="heading4"            name="Heading 4"/>
116    <style id="heading5"            name="Heading 5"/>
117    <style id="heading6"            name="Heading 6"/>
118  </styles>
119
120  <definitions>
121    <!-- An empty string always matches. -->
122    <define-regex id="always-match"></define-regex>
123
124    <!-- $^ never matches. -->
125    <define-regex id="never-match">$^</define-regex>
126
127    <define-regex id="decimal" extended="true">
128      (?&lt;![\w\.]) ([1-9][0-9]* | 0) (?![\w\.])
129    </define-regex>
130    <define-regex id="octal" extended="true">
131      (?&lt;![\w\.]) 0 [0-7]+ (?![\w\.])
132    </define-regex>
133    <define-regex id="hexadecimal" extended="true">
134      (?&lt;![\w\.]) 0 [xX] [0-9a-fA-F]+ (?![\w\.])
135    </define-regex>
136    <define-regex id="float" extended="true" case-sensitive="false">
137      \b
138      ([0-9]+ e [-+]? [0-9]+ |
139       ([0-9]* \. [0-9]+ | [0-9]+ \.)
140       (e [-+]? [0-9]+)?) [fl]?
141      \b
142    </define-regex>
143
144    <context id="decimal" style-ref="decimal">
145      <match>\%{decimal}</match>
146    </context>
147    <context id="octal" style-ref="base-n-integer">
148      <match>\%{octal}</match>
149    </context>
150    <context id="hexadecimal" style-ref="base-n-integer">
151      <match>\%{hexadecimal}</match>
152    </context>
153    <context id="float" style-ref="floating-point">
154      <match>\%{float}</match>
155    </context>
156
157    <!-- FIXME is it working at line end? -->
158    <define-regex id="net-address" extended="true" case-sensitive="false">
159      \%[                                         # separator
160      (https?|ftp|nntp|news|javascript|about):    # protocol
161      [^\ \\]* [^\ \\.:;,?&gt;&lt;)]              # address
162          (?![a-z0-9_.-])                             # separator
163    </define-regex>
164
165    <define-regex id="email-address" extended="true" case-sensitive="false">
166      \%[                 # separator
167      (mailto:)?          # optional "mailto:"
168      [a-z0-9_.+-]+       # user name
169      @                   # at
170      [a-z0-9_.+-]+       # domain
171          \%]                 # separator
172    </define-regex>
173
174    <context id="in-comment" class-disabled="no-spell-check">
175      <include>
176        <context id="net-address" extend-parent="false" style-ref="underlined" class="no-spell-check">
177          <match>\%{net-address}</match>
178        </context>
179        <context id="email-address" extend-parent="false" style-ref="underlined" class="no-spell-check">
180          <match>\%{email-address}</match>
181        </context>
182        <context id="comment-note" extend-parent="false" style-ref="note" class="no-spell-check comment-note">
183          <match>\b(FIXME|TODO|XXX)\b</match>
184        </context>
185      </include>
186    </context>
187
188    <!-- A line comment starting with # -->
189    <context id="shell-like-comment" style-ref="comment" end-at-line-end="true" class-disabled="no-spell-check" class="comment">
190      <start>#</start>
191      <include>
192        <context ref="in-comment"/>
193      </include>
194    </context>
195
196    <!-- C style comments -->
197    <context id="c-like-comment" style-ref="comment" end-at-line-end="true" class-disabled="no-spell-check" class="comment" >
198      <start>//</start>
199      <include>
200        <context ref="in-line-comment"/>
201      </include>
202    </context>
203    <context id="c-like-comment-multiline" style-ref="comment" class-disabled="no-spell-check" class="comment" >
204      <start>/\*</start>
205      <end>\*/</end>
206      <include>
207        <context ref="in-comment"/>
208      </include>
209    </context>
210    <context id="c-like-close-comment-outside-comment" style-ref="error">
211      <match>\*/(?!\*)</match>
212    </context>
213
214    <context id="line-continue" style-ref="preprocessor">
215      <start>\\$</start>
216      <end>^</end>
217    </context>
218
219    <!-- this is intended to be used from line comments
220         that can continue on a different line after "\" -->
221    <context id="in-line-comment" class-disabled="no-spell-check" class="comment">
222      <include>
223        <context ref="line-continue" ignore-style="true"/>
224        <context ref="in-comment"/>
225      </include>
226    </context>
227
228    <context id="shebang" style-ref="shebang" first-line-only="true" class="no-spell-check">
229      <start>^#!</start>
230      <end>$</end>
231    </context>
232
233    <context id="escape" style-ref="special-char">
234      <match>\\.</match>
235    </context>
236
237    <!-- usual quoted string, ends at line end, \ is an escape char -->
238    <context id="string" style-ref="string" end-at-line-end="true" class="string" class-disabled="no-spell-check">
239      <start>"</start>
240      <end>"</end>
241      <include>
242        <context ref="escape"/>
243        <context ref="line-continue"/>
244      </include>
245    </context>
246
247    <!-- same thing but with single quote marks -->
248    <context id="single-quoted-string" style-ref="string" end-at-line-end="true" class="string" class-disabled="no-spell-check">
249      <start>'</start>
250      <end>'</end>
251      <include>
252        <context ref="escape"/>
253        <context ref="line-continue"/>
254      </include>
255    </context>
256
257    <!-- Dummy context, needed to load the style mappings when parsing v1 files -->
258    <context id="def"/>
259
260  </definitions>
261</language>
262