File: sed.xml

package info (click to toggle)
kf6-syntax-highlighting 6.20.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 49,872 kB
  • sloc: xml: 205,656; cpp: 12,882; python: 3,055; sh: 965; perl: 814; ruby: 494; 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; exp: 61; erlang: 54; sql: 51; java: 47; sed: 45; objc: 37; tcl: 36; awk: 31; asm: 30; fortran: 18; cs: 10
file content (441 lines) | stat: -rw-r--r-- 15,252 bytes parent folder | download | duplicates (2)
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
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language[
  <!ENTITY literal_escape "\\([afnrtv\\]|c[0-9a-zA-Z]|x[0-9a-fA-F]{1,2}|d[0-9]{1,3}|o[0-7]{1,3})">
]>
<language name="sed" section="Scripts" version="9" kateversion="5.79" extensions="*.sed" mimetype="text/x-sed" author="Bart Sas (bart.sas@gmail.com);Jonathan Poelen (jonathan.poelen@gmail.com)" license="GPL">
<highlighting>
<contexts>
  <!--
  reference:
    $ man sed
    $ info sed
  -->
  <context name="BeginningOfLine" attribute="Normal" fallthroughContext="Error">
    <IncludeRules context="Start"/>
    <IncludeRules context="FindCommand"/>
  </context>

  <!--
    Context to be used in other <IncludeRules> syntaxes,
    because the FindCommand in BeginningOfLine makes an extra #pop,
    but it avoids context switch
  -->
  <context name="Start" attribute="Normal" fallthroughContext="Command">
    <DetectSpaces/>
    <DetectChar char="#"  attribute="Comment"   context="Comment"/>
    <!-- N -->
    <!-- N~N -->
    <!-- N,N -->
    <!-- N,+N -->
    <!-- N,~N -->
    <Int                  attribute="Line Number" context="FirstNumberAddress"/>
    <!--  /<regex>/ -->
    <!-- \C<regex>C -->
    <RegExpr String="(?|(/)|\\([\t -~]))" attribute="Separator" context="FirstAddressRegex"/>
    <DetectChar char="$"  attribute="Last Line" context="AfterFirstAddress"/>
    <DetectChar char="}"  attribute="Brace"     context="AfterCommand" endRegion="block"/>
    <DetectChar char=":"  attribute="Label"     context="Label"/>
    <DetectChar char="!"  attribute="Negation"  context="Command"/>
    <DetectChar char=";"  attribute="Normal"/>
  </context>


  <!--
    N
     ^
  -->
  <context name="FirstNumberAddress" attribute="Regex" lineEndContext="#pop" fallthroughContext="#pop!Command">
    <DetectChar char="~" attribute="Normal"   context="Step"/>
    <DetectChar char="!" attribute="Negation" context="#pop!Command"/>
    <DetectChar char="," attribute="Normal"   context="SecondNumberAddress"/>
    <DetectSpaces/>
  </context>

  <!--
     N~N
    N,~N
    N,+N
       ^
  -->
  <context name="Step" attribute="Normal" lineEndContext="#pop#pop" fallthroughContext="#pop#pop!Error">
    <DetectSpaces/>
    <Int attribute="Step" context="#pop#pop!Command"/>
  </context>

  <!--
    N,
      ^
  -->
  <context name="SecondNumberAddress" attribute="Normal" lineEndContext="#pop#pop" fallthroughContext="#pop#pop!Error">
    <AnyChar String="+~" attribute="Normal" context="#pop!Step"/>
    <IncludeRules context="SecondAddress"/>
  </context>


  <!--
    \C<regex>C
     /<regex>/
      ^
  -->
  <context name="FirstAddressRegex" attribute="Regex" lineEndContext="#pop">
    <StringDetect String="\%1" dynamic="1" attribute="Regex Escape"/>
    <DetectChar     char="1"   dynamic="1" attribute="Separator"    context="#pop!AfterFirstAddress"/>
    <IncludeRules context="Regex"/>
  </context>

  <!--
    addr
        ^
  -->
  <context name="AfterFirstAddress" attribute="Normal" lineEndContext="#pop" fallthroughContext="#pop!Command">
    <DetectChar char="!" attribute="Negation" context="#pop!Command"/>
    <DetectChar char="," attribute="Normal"   context="SecondAddress"/>
    <DetectSpaces/>
  </context>

  <!--
    addr,
         ^
  -->
  <context name="SecondAddress" attribute="Normal" lineEndContext="#pop#pop" fallthroughContext="#pop#pop!Error">
    <DetectChar char="$" attribute="Last Line"   context="AfterSecondAddress"/>
    <Int                 attribute="Line Number" context="AfterSecondAddress"/>
    <DetectSpaces/>
    <RegExpr String="(?|(/)|\\([\t -~]))" attribute="Separator" context="SecondAddressRegex"/>
  </context>

  <!--
    addr,\C<regex>C
     addr,/<regex>/
           ^
  -->
  <context name="SecondAddressRegex" attribute="Regex" lineEndContext="Error">
    <StringDetect String="\%1" dynamic="1" attribute="Regex Escape"/>
    <StringDetect String="%1"  dynamic="1" attribute="Separator"    context="#pop!AfterSecondAddress"/>
    <IncludeRules context="Regex"/>
  </context>

  <!--
    addr,addr
             ^
  -->
  <context name="AfterSecondAddress" attribute="Normal" lineEndContext="#pop#pop#pop" fallthroughContext="#pop#pop#pop!Command">
    <DetectChar char="!" attribute="Negation" context="#pop#pop#pop!Command"/>
    <DetectSpaces/>
  </context>


  <context name="Command" attribute="Normal" lineEndContext="#pop" fallthroughContext="#pop!Error">
    <DetectSpaces/>
    <IncludeRules context="FindCommand"/>
  </context>
  <context name="FindCommand" attribute="Normal">
    <DetectChar char="s"        attribute="Command" context="SCommand"/>
    <DetectChar char="y"        attribute="Command" context="YCommand"/>
    <AnyChar String="dpnDNPhHgGxFvz=" attribute="Command" context="#pop!AfterCommand"/>
    <AnyChar String="aic"       attribute="Command" context="AICCommand"/>
    <AnyChar String="bTt"       attribute="Command" context="#pop!Label"/>
    <AnyChar String="WwrR"      attribute="Command" context="WRCommand"/>
    <AnyChar String="lL"        attribute="Command" context="LCommand"/>
    <AnyChar String="qQ"        attribute="Command" context="QCommand"/>
    <DetectChar char="{"        attribute="Brace"   context="#pop" beginRegion="block"/>
    <DetectChar char="e"        attribute="Command" context="ECommand"/>
  </context>


  <!--
    s/regex/rep/
     ^
  -->
  <context name="SCommand" attribute="Normal" lineEndContext="#pop#pop" fallthroughContext="#pop#pop!Error">
    <RegExpr String="([\t -~])" attribute="Separator" context="SRegex"/>
  </context>

  <!--
    s/regex/rep/
      ^
  -->
  <context name="SRegex" attribute="Regex" lineEndContext="#pop#pop#pop">
    <StringDetect String="\%1" dynamic="1" attribute="Regex Escape"/>
    <!-- Avoid a dynamic regex for performance reasons -->
    <DetectChar     char="1"   dynamic="1" lookAhead="1" context="SRegexSep"/>
    <IncludeRules context="Regex"/>
  </context>

  <!--
    s/regex/rep/
           ^
  -->
  <context name="SRegexSep" attribute="Regex">
    <RegExpr String="(.)" attribute="Separator" context="SReplacement"/>
  </context>

  <!--
    s/regex/rep/
            ^
  -->
  <context name="SReplacement" attribute="Replacement" lineEndContext="#pop#pop#pop#pop#pop">
    <StringDetect String="\%1" dynamic="1" attribute="Repl Escape"/>
    <DetectChar     char="1"   dynamic="1" attribute="Separator"   context="SFlags"/>
    <DetectSpaces/>
    <DetectChar     char="&amp;"           attribute="Repl Substitution"/>
    <DetectChar     char="\"   lookAhead="1"  context="SReplacementEscape"/>
  </context>
  <!--
    on \ in rep
               ^
  -->
  <context name="SReplacementEscape" attribute="Repl Escape" lineEndContext="#pop#pop#pop#pop#pop">
    <LineContinue         attribute="Repl Escape" context="#pop"/>
    <RegExpr String="&literal_escape;" attribute="Repl Escape" context="#pop"/>
    <RegExpr String="\\[0-9LlUuE]" attribute="Repl Substitution" context="#pop"/>
    <RegExpr String="\\." attribute="Unknown Escape" context="#pop"/>
  </context>

  <!--
    s/regex/rep/
                ^
  -->
  <context name="SFlags" attribute="Normal" lineEndContext="#pop#pop#pop#pop#pop#pop" fallthroughContext="#pop#pop#pop#pop#pop#pop!AfterCommand">
    <DetectSpaces/>
    <AnyChar String="gpeIiMm"     attribute="Flag" />
    <!-- Do not use <Int>, because the number can be surrounded by any character -->
    <AnyChar String="0123456789"  attribute="Repl Number"/>
    <DetectChar char="w"          attribute="Flag" context="#pop#pop#pop#pop#pop!WRCommand"/>
  </context>


  <!--
    y/source/dest/
     ^
  -->
  <context name="YCommand" attribute="Normal" lineEndContext="#pop#pop" fallthroughContext="#pop#pop!Error">
    <RegExpr String="([\t -~])" attribute="Separator" context="YSourceList"/>
  </context>

  <!--
    y/source/dest/
      ^
  -->
  <context name="YSourceList" attribute="Char List" lineEndContext="#pop#pop#pop">
    <StringDetect String="\%1" dynamic="1" attribute="Char List Escape"/>
    <!-- Avoid a dynamic regex for performance reasons -->
    <DetectChar     char="1"   dynamic="1" lookAhead="1" context="YDestSep"/>
    <DetectChar     char="\"   lookAhead="1" context="YLiteralEscape"/>
  </context>

  <!--
    y/source/dest/
            ^
  -->
  <context name="YDestSep" attribute="Regex">
    <RegExpr String="(.)" attribute="Separator" context="YDestList"/>
  </context>

  <!--
    y/source/dest/
             ^
  -->
  <context name="YDestList" attribute="Char List" lineEndContext="#pop#pop#pop#pop#pop">
    <StringDetect String="\%1" dynamic="1" attribute="Char List Escape"/>
    <DetectChar     char="1"   dynamic="1" attribute="Separator"   context="#pop#pop#pop#pop#pop!AfterCommand"/>
    <DetectChar     char="\"   lookAhead="1" context="YLiteralEscape"/>
  </context>
  <!--
    on \ in dest
  -->
  <context name="YLiteralEscape" attribute="Char List Escape">
    <LineContinue attribute="Char List Escape" context="#pop"/>
    <RegExpr String="&literal_escape;" attribute="Char List Escape" context="#pop"/>
    <RegExpr String="\\." attribute="Unknown Escape" context="#pop"/>
  </context>


  <!--
    atext
    itext
    ctext
     ^
  -->
  <context name="AICCommand" attribute="Normal" lineEndContext="#pop#pop" fallthroughContext="LiteralText">
    <DetectSpaces/>
    <LineContinue          attribute="Line Continue" context="LiteralText"/>
    <DetectChar   char="\" attribute="Line Continue" context="LiteralText"/>
  </context>

  <!--
    a\text
    i\text
    c\text
     atext
     itext
     ctext
      ^
  -->
  <context name="LiteralText" attribute="Literal Text" lineEndContext="#pop#pop#pop">
    <DetectSpaces/>
    <DetectIdentifier/>
    <DetectChar char="\" lookAhead="1" context="LiteralTextEscape"/>
  </context>
  <!--
    on \ in text
  -->
  <context name="LiteralTextEscape" attribute="Literal Escape">
    <LineContinue attribute="Line Continue" context="#pop"/>
    <RegExpr String="&literal_escape;" attribute="Literal Escape" context="#pop"/>
    <RegExpr String="\\." attribute="Unknown Escape" context="#pop"/>
  </context>


  <!--
    s/regex/rep/w<filename>
                w<filename>
                r<filename>
                W<filename>
                R<filename>
                 ^
  -->
  <context name="WRCommand" attribute="Normal" lineEndContext="#pop#pop" fallthroughContext="Filename">
    <DetectSpaces attribute="Normal" context="Filename"/>
  </context>
  <context name="Filename" attribute="Filename" lineEndContext="#pop#pop#pop"/>


  <!--
    l[width]
    L          # What does this command do?
     ^
  -->
  <context name="LCommand" attribute="Normal" lineEndContext="#pop#pop" fallthroughContext="#pop#pop!AfterCommand">
    <DetectSpaces/>
    <Int attribute="Wrap Length" context="#pop#pop!AfterCommand" additionalDeliminator="lL"/>
  </context>


  <!--
    q[exit-code]
    Q[exit-code]
     ^
  -->
  <context name="QCommand" attribute="Normal" lineEndContext="#pop#pop" fallthroughContext="#pop#pop!AfterCommand">
    <DetectSpaces/>
    <Int attribute="Exit Code" context="#pop#pop!AfterCommand" additionalDeliminator="qQ"/>
  </context>


  <!--
    e[command]
     ^
  -->
  <context name="ECommand" attribute="Shell Command" lineEndContext="#pop#pop">
    <LineContinue          attribute="Line Continue"/>
  </context>


  <!--
    blabel
    tlabel
    Tlabel
    :label
     ^
  -->
  <context name="Label" attribute="Normal" lineEndContext="#pop" fallthroughContext="#pop!AfterCommand">
    <DetectSpaces/>
    <RegExpr String="[^\s;}#]+" attribute="Label" context="#pop"/>
  </context>


  <context name="AfterCommand" attribute="Normal" lineEndContext="#pop" fallthroughContext="#pop!Error">
    <DetectSpaces/>
    <DetectChar char=";" attribute="Normal" context="#pop"/>
    <DetectChar char="}" attribute="Brace"   context="#pop" endRegion="block"/>
    <DetectChar char="#" attribute="Comment" context="#pop!Comment"/>
  </context>


  <!--
    regex special char
  -->
  <context name="Regex" attribute="Regex">
    <DetectSpaces/>
    <AnyChar    String="*.^$[]"   attribute="Regex Special"/>
    <AnyChar    String="+?|{}()"  attribute="Regex Special Extended"/>
    <DetectChar char="\" lookAhead="1" context="RegexEscape"/>
  </context>

  <!--
    on \
  -->
  <context name="RegexEscape" attribute="Regex" fallthroughContext="#pop">
    <LineContinue         attribute="Regex Escape" context="#pop"/>
    <RegExpr String="\\([afnrtv\\()+?|{}\[\].*^$]|c.|x[0-9a-fA-F]{1,2}|d[0-9]{1,3}|o[0-7]{1,3})"
                          attribute="Regex Escape" context="#pop"/>
    <RegExpr String="\\([0-9wWbBsS&lt;>`'])"
                          attribute="Regex Escape Special" context="#pop"/>
    <RegExpr String="\\." attribute="Unknown Escape" context="#pop"/>
  </context>


  <!--
    #comment
     ^
  -->
  <context name="Comment" attribute="Comment" lineEndContext="#pop">
    <DetectSpaces/>
    <IncludeRules context="##Comments"/>
    <DetectIdentifier/>
  </context>


  <context name="Error" attribute="Error" lineEndContext="#pop"/>

</contexts>

<itemDatas>
  <itemData name="Normal"     defStyleNum="dsNormal"/>

  <itemData name="Regex"                  defStyleNum="dsString"/>
  <itemData name="Regex Escape"           defStyleNum="dsChar"/>
  <itemData name="Regex Escape Special"   defStyleNum="dsSpecialChar"/>
  <itemData name="Regex Special"          defStyleNum="dsSpecialChar"/>
  <itemData name="Regex Special Extended" defStyleNum="dsSpecialString"/>
  <itemData name="Replacement"            defStyleNum="dsString"/>
  <itemData name="Repl Escape"            defStyleNum="dsChar"/>
  <itemData name="Repl Substitution"      defStyleNum="dsSpecialChar"/>
  <itemData name="Char List"              defStyleNum="dsString"/>
  <itemData name="Char List Escape"       defStyleNum="dsChar"/>
  <itemData name="Separator"              defStyleNum="dsConstant"/>

  <itemData name="Line Number"  defStyleNum="dsDecVal"/>
  <itemData name="Step"         defStyleNum="dsDecVal"/>
  <itemData name="Last Line"    defStyleNum="dsFunction" bold="1"/>
  <itemData name="Negation"     defStyleNum="dsFunction" bold="1"/>

  <itemData name="Command"        defStyleNum="dsKeyword"/>
  <itemData name="Shell Command"  defStyleNum="dsPreprocessor"/>
  <itemData name="Label"          defStyleNum="dsControlFlow"/>
  <itemData name="Brace"          defStyleNum="dsNormal"/>

  <itemData name="Flag"         defStyleNum="dsDataType"/>
  <itemData name="Repl Number"  defStyleNum="dsDecVal"/>
  <itemData name="Exit Code"    defStyleNum="dsDecVal"/>
  <itemData name="Filename"     defStyleNum="dsBaseN"/>
  <itemData name="Wrap Length"  defStyleNum="dsDecVal"/>

  <itemData name="Line Continue"  defStyleNum="dsAttribute" bold="1"/>
  <itemData name="Literal Text"   defStyleNum="dsImport" italic="1"/>
  <itemData name="Literal Escape" defStyleNum="dsOperator" italic="1"/>

  <itemData name="Unknown Escape" defStyleNum="dsChar"/>
  <itemData name="Comment"        defStyleNum="dsComment"/>
  <itemData name="Error"          defStyleNum="dsError"/>
</itemDatas>
</highlighting>

<general>
  <comments>
    <comment name="singleLine" start="#"/>
  </comments>
</general>
</language>
<!-- kate: replace-tabs on; tab-width 2; indent-width 2; -->