File: nix.xml

package info (click to toggle)
kf6-syntax-highlighting 6.13.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 47,568 kB
  • sloc: xml: 197,750; cpp: 12,850; python: 3,023; sh: 955; perl: 546; ruby: 488; pascal: 393; javascript: 161; php: 150; jsp: 132; lisp: 131; haskell: 124; ada: 119; ansic: 107; makefile: 96; f90: 94; ml: 85; cobol: 81; yacc: 71; csh: 62; erlang: 54; sql: 51; java: 47; objc: 37; awk: 31; asm: 30; tcl: 29; fortran: 18; cs: 10
file content (290 lines) | stat: -rw-r--r-- 14,721 bytes parent folder | download
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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language [
    <!ENTITY ident "[a-zA-Z_][a-zA-Z0-9_\-']*">
]>

<!--
    SPDX-FileCopyrightText: 2024 Marco Rebhan <me@dblsaiko.net>
    SPDX-FileContributor: Tuan Le <webmaster@michivi.com>

    SPDX-License-Identifier: MIT
-->

<language
    name="Nix"
    version="4"
    kateversion="5.79"
    section="Scripts"
    extensions="*.nix"
    casesensitive="1"
    author="Marco Rebhan &lt;me@dblsaiko.net&gt;"
    license="MIT"
    priority="1"
>
    <highlighting>
        <list name="keywords">
            <item>assert</item>
            <item>rec</item>
            <item>and</item>
            <item>or</item>
        </list>
        <list name="builtins">
            <item>abort</item>
            <item>baseNameOf</item>
            <item>builtins</item>
            <item>derivation</item>
            <item>dirOf</item>
            <item>fetchTarball</item>
            <item>import</item>
            <item>isNull</item>
            <item>map</item>
            <item>removeAttrs</item>
            <item>throw</item>
            <item>toString</item>
        </list>
        <contexts>
            <context name="Expression" attribute="Normal Text" lineEndContext="#stay">
                <IncludeRules context="Single Expression" />

                <keyword String="keywords" attribute="Keyword" />
                <WordDetect String="let" attribute="Keyword" context="Let" />
                <WordDetect String="if" attribute="Keyword" context="If" />
                <WordDetect String="with" attribute="Keyword" context="With" />
                <Detect2Chars char="/" char1="/" attribute="Operator" />
                <Detect2Chars char="?" char1="?" attribute="Operator" />
                <Detect2Chars char="+" char1="+" attribute="Operator" />
                <Detect2Chars char="|" char1="|" attribute="Operator" />
                <Detect2Chars char="&amp;" char1="&amp;" attribute="Operator" />
                <AnyChar String="+-*/?!" attribute="Operator" />
                <RegExpr String="\b&ident;(?=\s*:)" context="Function" attribute="Identifier" />

                <DetectIdentifier />
            </context>
            <context name="Single Expression" attribute="Normal Text" lineEndContext="#stay">
                <DetectSpaces />
                <IncludeRules context="Comment Rules" />

                <keyword String="builtins" attribute="Builtin" />
                <DetectChar char="&quot;" attribute="String" context="String" />
                <Detect2Chars char="'" char1="'" attribute="String" context="String2" />
                <DetectChar char="{" attribute="Symbol" context="Any Brace" beginRegion="Set" />
                <DetectChar char="[" attribute="Symbol" context="List" beginRegion="List" />
                <DetectChar char="(" attribute="Symbol" context="Parentheses" />
                <RegExpr String="[a-zA-Z0-9-_.]*(/[a-zA-Z0-9-_.]+)+" attribute="Path" />
                <Float attribute="Float" />
                <Int attribute="Int" />
                <DetectChar char="." attribute="Symbol" context="Set Access" />
                <WordDetect String="true" attribute="Constant" />
                <WordDetect String="false" attribute="Constant" />
                <WordDetect String="null" attribute="Constant" />
            </context>
            <context name="Set Access" attribute="Normal Text" lineEndContext="#stay">
                <Detect2Chars char="$" char1="{" attribute="Special Char" context="#pop!Interpolated String" />
                <DetectChar char="&quot;" attribute="String" context="#pop!String" />
                <DetectIdentifier context="#pop" />
            </context>
            <context name="Parentheses" attribute="Normal Text" lineEndContext="#stay">
                <DetectChar char=")" attribute="Symbol" context="#pop" />

                <IncludeRules context="Expression" />
            </context>

            <context name="Comment Rules" attribute="Normal Text" lineEndContext="#stay">
                <DetectChar char="#" attribute="Comment" context="Comment" />
                <Detect2Chars char="/" char1="*" attribute="Comment" context="Multi-Line Comment" beginRegion="Comment" />
            </context>
            <context name="Comment" attribute="Comment" lineEndContext="#pop">
                <DetectSpaces attribute="Comment"/>
                <IncludeRules context="##Comments"/>
                <DetectIdentifier attribute="Comment" context="#stay" />
            </context>
            <context name="Multi-Line Comment" attribute="Comment" lineEndContext="#stay">
                <Detect2Chars char="*" char1="/" attribute="Comment" context="#pop" endRegion="Comment" />
                <IncludeRules context="Comment"/>
            </context>

            <context name="String" attribute="String" lineEndContext="#stay">
                <RegExpr String="\\." attribute="Special Char" />
                <DetectChar char="&quot;" attribute="String" context="#pop" />

                <Detect2Chars char="$" char1="{" attribute="Special Char" context="Interpolated String" />
            </context>
            <context name="String2" attribute="String" lineEndContext="#stay">
                <RegExpr String="''(?:['$]|\\.)" attribute="Special Char" />
                <Detect2Chars char="'" char1="'" attribute="String" context="#pop" />

                <Detect2Chars char="$" char1="{" attribute="Special Char" context="Interpolated String" />
            </context>
            <context name="Interpolated String" attribute="Normal Text" lineEndContext="#stay">
                <DetectChar char="}" attribute="Special Char" context="#pop" />

                <IncludeRules context="Expression" />
            </context>

            <!--
                we don't know whether this is a set { k = v; k1 = v1; ... } or
                the beginning of a function declaration { x1, x2, x3, ... }: ...
                yet
            -->
            <context name="Any Brace" attribute="Normal Text" lineEndContext="#stay">
                <DetectSpaces />
                <DetectChar char="}" attribute="Symbol" context="#pop" endRegion="Set"/>

                <WordDetect String="inherit" attribute="Keyword" context="Any Brace - Inherit" />
                <DetectChar char=";" attribute="Symbol" context="#pop!Set" />
                <DetectChar char="=" attribute="Operator" context="Any Brace - Set Value" />
                <DetectChar char="&quot;" attribute="String" context="Any Brace - String" />
                <Detect2Chars char="'" char1="'" attribute="String" context="Any Brace - String2" />
                <Detect2Chars char="$" char1="{" attribute="Special Char" context="Any Brace - Interpolated String" />

                <DetectChar char="," attribute="Symbol" context="#pop!Set Expansion" />
                <DetectChar char="?" attribute="Symbol" context="Any Brace - Default Value" />
                <StringDetect String="..." attribute="Symbol" context="#pop!Set Expansion" />

                <RegExpr String="&ident;" attribute="Identifier" />

                <IncludeRules context="Comment Rules" />
            </context>
            <!--
                can't push two contexts so we need separate ones specifically
                for this
            -->
            <context name="Any Brace - Set Value" attribute="Normal Text" lineEndContext="#stay">
                <DetectChar char=";" attribute="Symbol" context="#pop#pop!Set" />
                <IncludeRules context="Set Value" />
            </context>
            <context name="Any Brace - String" attribute="String" lineEndContext="#stay">
                <DetectChar char="&quot;" attribute="String" context="#pop#pop!Set" />
                <IncludeRules context="String" />
            </context>
            <context name="Any Brace - String2" attribute="String" lineEndContext="#stay">
                <Detect2Chars char="'" char1="'" attribute="String" context="#pop#pop!Set" />
                <IncludeRules context="String" />
            </context>
            <context name="Any Brace - Inherit" attribute="Normal Text" lineEndContext="#stay">
                <DetectChar char=";" attribute="Symbol" context="#pop#pop!Set" />
                <IncludeRules context="Inherit" />
            </context>
            <context name="Any Brace - Interpolated String" attribute="Normal Text">
                <DetectChar char="}" attribute="Special Char" context="#pop!Set" />
                <IncludeRules context="Interpolated String" />
            </context>
            <context name="Any Brace - Default Value" attribute="Normal Text" lineEndContext="#stay">
                <DetectChar char="," attribute="Symbol" context="#pop#pop!Set Expansion" />
                <IncludeRules context="Default Value" />
            </context>

            <!-- include for sets and let expressions -->
            <context name="Set-Like" attribute="Normal Text" lineEndContext="#stay">
                <DetectChar char="&quot;" attribute="String" context="String" />
                <Detect2Chars char="'" char1="'" attribute="String" context="String2" />
                <DetectChar char="=" attribute="Operator" context="Set Value" />
                <Detect2Chars char="$" char1="{" attribute="Special Char" context="Interpolated String" />
                <RegExpr String="&ident;" attribute="Identifier" />
                <IncludeRules context="Comment Rules" />
            </context>
            <context name="Inherit" attribute="Normal Text" lineEndContext="#stay">
                <DetectChar char="(" attribute="Symbol" context="Inherit - Source" />
                <DetectIdentifier attribute="Identifier" context="Inherit - Keys" />
            </context>
            <context name="Inherit - Source" attribute="Normal Text" lineEndContext="#stay">
                <DetectChar char=")" attribute="Symbol" context="#pop!Inherit - Keys" />

                <IncludeRules context="Parentheses" />
            </context>
            <context name="Inherit - Keys" attribute="Normal Text" lineEndContext="#stay">
                <DetectChar char=";" attribute="Symbol" context="#pop#pop" />
                <DetectChar char="(" attribute="Error" />
                <DetectIdentifier attribute="Identifier" />
            </context>

            <context name="Set" attribute="Normal Text" lineEndContext="#stay">
                <DetectSpaces />
                <DetectChar char="}" attribute="Symbol" context="#pop" endRegion="Set" />
                <WordDetect String="inherit" attribute="Keyword" context="Inherit" />

                <IncludeRules context="Set-Like" />
            </context>
            <context name="Set Value" attribute="Normal Text" lineEndContext="#stay">
                <DetectChar char=";" attribute="Symbol" context="#pop" />
                <DetectChar char="}" attribute="Error" context="#pop#pop" endRegion="Set" />

                <IncludeRules context="Expression" />
            </context>

            <context name="Set Expansion" attribute="Normal Text" lineEndContext="#stay">
                <DetectSpaces />
                <DetectChar char="}" attribute="Symbol" context="#pop" endRegion="Set"/>

                <DetectChar char="," attribute="Symbol" />
                <DetectChar char="?" attribute="Symbol" context="Default Value" />
                <StringDetect String="..." attribute="Symbol" />
                <RegExpr String="&ident;" attribute="Identifier" />
                <IncludeRules context="Comment Rules" />
            </context>
            <context name="Default Value" attribute="Normal Text" lineEndContext="#stay">
                <DetectChar char="," attribute="Symbol" context="#pop" />
                <DetectChar char="}" attribute="Symbol" context="#pop#pop" />

                <IncludeRules context="Expression" />
            </context>

            <context name="List" attribute="Normal Text" lineEndContext="#stay">
                <DetectChar char="]" attribute="Symbol" context="#pop" endRegion="List" />

                <IncludeRules context="Single Expression" />
            </context>

            <context name="Function" attribute="Normal Text" lineEndContext="#stay">
                <DetectChar char=":" attribute="Symbol" context="#pop" />
                <DetectSpaces attribute="Normal Text" />
            </context>

            <context name="Let" attribute="Normal Text" lineEndContext="#stay">
                <DetectSpaces />
                <WordDetect String="in" attribute="Keyword" context="#pop" />

                <IncludeRules context="Set-Like" />
            </context>

            <context name="If" attribute="Normal Text" lineEndContext="#stay">
                <WordDetect String="then" attribute="Keyword" context="#pop!Then" />

                <IncludeRules context="Expression" />
            </context>
            <context name="Then" attribute="Normal Text" lineEndContext="#stay">
                <WordDetect String="else" attribute="Keyword" context="#pop" />

                <IncludeRules context="Expression" />
            </context>

            <context name="With" attribute="Normal Text" lineEndContext="#stay">
                <DetectChar char=";" attribute="Symbol" context="#pop" />
                <IncludeRules context="Expression" />
            </context>
        </contexts>
        <itemDatas>
            <itemData name="Normal Text" defStyleNum="dsNormal" />
            <itemData name="Builtin" defStyleNum="dsBuiltIn" />
            <itemData name="Int" defStyleNum="dsDecVal" />
            <itemData name="Float" defStyleNum="dsFloat" />
            <itemData name="Constant" defStyleNum="dsConstant" />
            <itemData name="String" defStyleNum="dsString" />
            <itemData name="Special Char" defStyleNum="dsSpecialChar" />
            <itemData name="Path" defStyleNum="dsSpecialString" />
            <itemData name="Keyword" defStyleNum="dsKeyword" />
            <itemData name="Comment" defStyleNum="dsComment" />
            <itemData name="Symbol" defStyleNum="dsOperator" />
            <itemData name="Operator" defStyleNum="dsOperator" />
            <itemData name="Identifier" defStyleNum="dsVariable" />
            <itemData name="Error" defStyleNum="dsError" />
        </itemDatas>
    </highlighting>
    <general>
        <comments>
            <comment name="singleLine" start="#" />
            <comment name="multiLine" start="/*" end="*/" region="Comment" />
        </comments>
        <keywords casesensitive="1" />
    </general>
</language>