summaryrefslogtreecommitdiff
path: root/data/language-specs/nix.lang
blob: f98e1deae76cc5ccd86f23bdade620bbb692e9d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
<?xml version="1.0" encoding="UTF-8"?>
<!--

 This file is part of GtkSourceView

 Author: Luca Bruno <lucabru@src.gnome.org>
 Copyright (C) 2014 Luca Bruno <lucabru@src.gnome.org>

 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, see <http://www.gnu.org/licenses/>.

-->
<language id="nix" _name="Nix" version="2.0" _section="Others">
  <metadata>
    <property name="globs">*.nix</property>
    <property name="line-comment-start">#</property>
    <property name="block-comment-start">/*</property>
    <property name="block-comment-end">*/</property>
  </metadata>

  <styles>
    <style id="escape" _name="Escaped Character" map-to="def:special-char"/>
    <style id="null-value" _name="Null Value" map-to="def:special-constant"/>
    <style id="boolean" _name="Boolean Value" map-to="def:boolean"/>
    <style id="keyword" _name="Keyword" map-to="def:keyword"/>
    <style id="string" _name="String" map-to="def:string"/>
    <style id="function" _name="Function" map-to="def:builtin"/>
    <style id="indented-string" _name="Indented string" map-to="def:string"/>
    <style id="path" _name="Path" map-to="def:underlined"/>
    <style id="uri" _name="URI" map-to="def:underlined"/>
  </styles>

  <definitions>

    <!--contexts NOT used in the main context-->
    <context id="antiquotation" style-ref="def:statement">
      <start>\${</start>
      <end>}</end>
      <include>
        <context ref="nix"/>
      </include>
    </context>

    <context id="null-value" style-ref="null-value">
      <keyword>null</keyword>
    </context>

    <context id="boolean" style-ref="boolean">
      <keyword>false</keyword>
      <keyword>true</keyword>
    </context>

    <context id="keywords" style-ref="keyword">
      <keyword>builtins</keyword>
      <keyword>assert</keyword>
      <keyword>if</keyword>
      <keyword>then</keyword>
      <keyword>else</keyword>
      <keyword>let</keyword>
      <keyword>in</keyword>
      <keyword>with</keyword>
      <keyword>import</keyword>
      <keyword>rec</keyword>
      <keyword>inherit</keyword>
    </context>

    <context id="functions" style-ref="function">
      <keyword>abort</keyword>
      <keyword>add</keyword>
      <keyword>attrNames</keyword>
      <keyword>baseNameOf</keyword>
      <keyword>compareVersions</keyword>
      <keyword>concatLists</keyword>
      <keyword>currentSystem</keyword>
      <keyword>derivation</keyword>
      <keyword>dirOf</keyword>
      <keyword>div</keyword>
      <keyword>elem</keyword>
      <keyword>elemAt</keyword>
      <keyword>filter</keyword>
      <keyword>filterSource</keyword>
      <keyword>getAttr</keyword>
      <keyword>getEnv</keyword>
      <keyword>hasAttr</keyword>
      <keyword>hashString</keyword>
      <keyword>head</keyword>
      <keyword>intersectAttrs</keyword>
      <keyword>isAttrs</keyword>
      <keyword>isList</keyword>
      <keyword>isFunction</keyword>
      <keyword>isString</keyword>
      <keyword>isInt</keyword>
      <keyword>isBool</keyword>
      <keyword>isNull</keyword>
      <keyword>length</keyword>
      <keyword>lessThan</keyword>
      <keyword>listToAttrs</keyword>
      <keyword>map</keyword>
      <keyword>mul</keyword>
      <keyword>parseDrvName</keyword>
      <keyword>pathExists</keyword>
      <keyword>readFile</keyword>
      <keyword>removeAttrs</keyword>
      <keyword>stringLength</keyword>
      <keyword>sub</keyword>
      <keyword>substring</keyword>
      <keyword>tail</keyword>
      <keyword>throw</keyword>
      <keyword>toFile</keyword>
      <keyword>toJSON</keyword>
      <keyword>toPath</keyword>
      <keyword>toString</keyword>
      <keyword>toXML</keyword>
      <keyword>trace</keyword>
      <keyword>typeOf</keyword>
    </context>

    <context id="indented-string" style-ref="indented-string" class="string" class-disabled="no-spell-check">
      <start>''</start>
      <end>''</end>
      <include>
        <context id="indented-string-escape-antiquotation" style-ref="escape">
          <match>''\${</match>
        </context>
        <context id="indented-string-escape" style-ref="escape">
          <match>''\\.</match>
        </context>
        <context ref="antiquotation"/>
      </include>
    </context>

    <context id="string" style-ref="indented-string" class="string" class-disabled="no-spell-check">
      <start>"</start>
      <end>"</end>
      <include>
        <context ref="def:escape"/>
        <context ref="antiquotation"/>
      </include>
    </context>

    <context id="operators" style-ref="def:operator" extend-parent="false">
      <match>@|:|(//)|\+|\?|(==)|(\|\|)|(&amp;&amp;)|!|(->)</match>
    </context>

    <context id="path" style-ref="path" class="path">
      <match case-sensitive="false">(/|\./|\.\./)[a-zA-Z0-9\./\-_]*</match>
    </context>

    <context id="uri" style-ref="uri" class="uri">
      <match case-sensitive="false">\%{def:net-address}</match>
    </context>

    <!--main context-->
    <context id="nix" class="no-spell-check">
      <include>
        <context ref="def:shell-like-comment"/>
        <context ref="def:c-like-comment-multiline"/>
        <context ref="def:c-like-close-comment-outside-comment"/>
        <context ref="indented-string"/>
        <context ref="string" style-ref="string"/>
        <context ref="def:float"/>
        <context ref="def:decimal"/>
        <context ref="boolean"/>
        <context ref="keywords"/>
        <context ref="functions"/>
        <context ref="null-value"/>
        <context ref="operators"/>
        <context ref="path"/>
        <context ref="uri"/>
      </include>
    </context>
    <!--main context-->

  </definitions>
</language>