aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/3rdparty/syntax-highlighting/data/generators/cmake.xml.tpl
blob: 33cc7511aa8ab7c0f60b92d42c3c886128558386 (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
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
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd"
[
  <!ENTITY id_re "[_A-Za-z][\-_0-9A-Za-z]*">
]>
<!--
  This file is part of KDE's kate project.

  Copyright 2004 Alexander Neundorf (neundorf@kde.org)
  Copyright 2005 Dominik Haumann (dhdev@gmx.de)
  Copyright 2007,2008,2013,2014 Matthew Woehlke (mw_triad@users.sourceforge.net)
  Copyright 2013-2015,2017-2018 Alex Turbov (i.zaufi@gmail.com)

 **********************************************************************
 * This library 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 of the License, or (at your option) any later version.   *
 *                                                                    *
 * This library 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, write to the              *
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,   *
 * Boston, MA  02110-1301, USA.                                       *
 **********************************************************************
 -->

<language
    name="CMake"
    version="11"
    kateversion="2.4"
    section="Other"
    extensions="CMakeLists.txt;*.cmake;*.cmake.in"
    style="CMake"
    mimetype="text/x-cmake"
    author="Alex Turbov (i.zaufi@gmail.com)"
    license="LGPLv2+"
  >
  <highlighting>

    <list name="commands">
    {%- for command in commands %}
        <item>{{command.name}}</item>
    {%- endfor %}
    </list>
    {% for command in commands -%}
      {%- if command.named_args and command.named_args.kw %}
    <list name="{{command.name}}_nargs">
        {%- for arg in command.named_args.kw %}
      <item>{{arg}}</item>
        {%- endfor %}
    </list>
      {%- endif %}
      {%- if command.special_args and command.special_args.kw %}
    <list name="{{command.name}}_sargs">
        {%- for arg in command.special_args.kw %}
      <item>{{arg}}</item>
        {%- endfor %}
    </list>
      {%- endif %}
    {%- endfor %}

    <list name="variables">
    {%- for var in variables.kw %}
      <item>{{var}}</item>
    {%- endfor %}
    </list>

    {%- for kind in properties.kinds %}
    <list name="{{ kind|replace('_', '-') }}">
      {%- for prop in properties[kind].kw %}
      <item>{{prop}}</item>
      {%- endfor %}
    </list>
    {%- endfor %}

    <list name="generator-expressions">
      {%- for expr in generator_expressions %}
      <item>{{ expr }}</item>
      {%- endfor %}
    </list>

    <contexts>

      <context attribute="Normal Text" lineEndContext="#stay" name="Normal Text">
        <DetectSpaces/>
        {% for command in commands -%}
        <WordDetect String="{{command.name}}" insensitive="true" attribute="Command" context="{{command.name}}_ctx" />
        {% endfor -%}
        <RegExpr attribute="Region Marker" context="RST Documentation" String="^#\[(=*)\[\.rst:" column="0" />
        <RegExpr attribute="Comment" context="Bracketed Comment" String="#\[(=*)\[" />
        <DetectChar attribute="Comment" context="Comment" char="#" />
        <DetectIdentifier attribute="User Function/Macro" context="User Function" />
        <RegExpr attribute="@Variable Substitution" context="@VarSubst" String="@&id_re;@" lookAhead="true" />
        <!-- Include keywords matching for language autocompleter work -->
        <keyword attribute="Command" context="#stay" String="commands" />
      </context>

      {% for command in commands -%}
      {#
      <!--
        {{ command|pprint }}
      -->
      -#}
      <context attribute="Normal Text" lineEndContext="#stay" name="{{command.name}}_ctx">
        <DetectChar attribute="Normal Text" context="{{command.name}}_ctx_op" char="(" />
      </context>
      <context attribute="Normal Text" lineEndContext="#stay" name="{{command.name}}_ctx_op">
        {%- if command.nested_parentheses %}
        <DetectChar attribute="Normal Text" context="{{command.name}}_ctx_op_nested" char="(" />
        {%- endif %}
        <IncludeRules context="EndCmdPop2" />
        {%- if command.named_args and command.named_args.kw %}
        <keyword attribute="Named Args" context="#stay" String="{{command.name}}_nargs" />
        {%- endif %}
        {%- if command.special_args and command.special_args.kw %}
        <keyword attribute="Special Args" context="#stay" String="{{command.name}}_sargs" />
        {%- endif %}
        {%- if command.property_args and command.property_args.kw %}
          {%- for kind in command.property_args.kw %}
        <keyword attribute="Property" context="#stay" String="{{kind}}" />
            {%- if properties[kind|replace('-', '_')].re %}
        <IncludeRules context="Detect More {{kind}}" />
            {%- endif %}
          {%- endfor %}
        {%- endif %}
        {%- if command is not nulary %}
        <IncludeRules context="User Function Args" />
          {%- if command.name == 'cmake_policy' %}
        <!-- NOTE Handle CMP<NNN> as a special arg of `cmake_policy` command -->
        <RegExpr attribute="Special Args" context="#stay" String="\bCMP[0-9]+\b" />
          {%- endif %}
        {%- endif %}
      </context>
        {%- if command.nested_parentheses %}
      <context attribute="Normal Text" lineEndContext="#stay" name="{{command.name}}_ctx_op_nested">
        <IncludeRules context="EndCmdPop" />
        {%- if command.named_args and command.named_args.kw %}
        <keyword attribute="Named Args" context="#stay" String="{{command.name}}_nargs" />
        {%- endif %}
        {%- if command.special_args and command.special_args.kw %}
        <keyword attribute="Special Args" context="#stay" String="{{command.name}}_sargs" />
        {%- endif %}
        {%- if command.property_args and command.property_args.kw %}
          {%- for kind in command.property_args.kw %}
        <keyword attribute="Property" context="#stay" String="{{kind}}" />
              {%- if properties[kind|replace('-', '_')].re %}
        <IncludeRules context="Detect More {{kind}}" />
            {%- endif %}
          {%- endfor %}
        {%- endif %}
        <IncludeRules context="User Function Args" />
      </context>
        {%- endif %}
      {% endfor -%}

      {% for kind in properties.kinds if properties[kind].re -%}
      <context attribute="Normal Text" lineEndContext="#stay" name="Detect More {{ kind|replace('_', '-') }}">
        {%- for prop in properties[kind].re %}
        <RegExpr attribute="Property" context="#stay" String="{{prop}}" />
        {%- endfor %}
      </context>{{ '\n' }}
      {% endfor -%}

      <context attribute="Normal Text" lineEndContext="#stay" name="EndCmdPop">
        <DetectChar attribute="Normal Text" context="#pop" char=")" />
      </context>

      <context attribute="Normal Text" lineEndContext="#stay" name="EndCmdPop2">
        <DetectChar attribute="Normal Text" context="#pop#pop" char=")" />
      </context>

      <context attribute="User Function/Macro" lineEndContext="#stay" name="User Function">
        <DetectChar attribute="Normal Text" context="User Function Opened" char="(" />
        <IncludeRules context="EndCmdPop2" />
      </context>

      <context attribute="Normal Text" lineEndContext="#stay" name="User Function Opened">
        <IncludeRules context="EndCmdPop2" />
        <IncludeRules context="User Function Args" />
      </context>

      <context attribute="Normal Text" lineEndContext="#stay" name="Detect Builtin Variables">
        <keyword attribute="Builtin Variable" context="#stay" String="variables" insensitive="false" />
        <IncludeRules context="Detect More Builtin Variables" />
        <RegExpr attribute="Internal Name" context="#stay" String="\b_&id_re;\b" />
      </context>

      <context attribute="Normal Text" lineEndContext="#stay" name="Detect More Builtin Variables">
        {%- for var in variables.re %}
        <RegExpr attribute="Builtin Variable" context="#stay" String="{{var}}" />
        {%- endfor %}
      </context>

      <context attribute="Normal Text" lineEndContext="#stay" name="Detect Variable Substitutions">
        <RegExpr attribute="Environment Variable Substitution" context="#stay" String="\$ENV\{\s*[\w-]+\s*\}" />
        <Detect2Chars attribute="Variable Substitution" context="VarSubst" char="$" char1="{" />
        <RegExpr attribute="@Variable Substitution" context="@VarSubst" String="@&id_re;@" lookAhead="true" />
      </context>

      <context attribute="Variable Substitution" lineEndContext="#pop" name="VarSubst">
        <IncludeRules context="Detect Builtin Variables" />
        <DetectIdentifier />
        <DetectChar attribute="Variable Substitution" context="#pop" char="}" />
        <IncludeRules context="Detect Variable Substitutions" />
      </context>

      <context attribute="@Variable Substitution" lineEndContext="#pop" name="@VarSubst">
        <DetectChar attribute="@Variable Substitution" context="VarSubst@" char="@" />
      </context>

      <context attribute="@Variable Substitution" lineEndContext="#pop#pop" name="VarSubst@">
        <IncludeRules context="Detect Builtin Variables" />
        <DetectIdentifier />
        <DetectChar attribute="@Variable Substitution" context="#pop#pop" char="@" />
      </context>

      <context attribute="Normal Text" lineEndContext="#stay" name="User Function Args">
        <Detect2Chars attribute="Normal Text" context="#stay" char="\" char1="(" />
        <Detect2Chars attribute="Normal Text" context="#stay" char="\" char1=")" />
        <RegExpr attribute="Escapes" context="#stay" String="\\[&quot;$n\\]" />
        <DetectChar attribute="Strings" context="String" char="&quot;" />
        <RegExpr attribute="Strings" context="Bracketed String" String="\[(=*)\[" />
        <RegExpr attribute="Comment" context="Bracketed Comment" String="#\[(=*)\[" />
        <DetectChar attribute="Comment" context="Comment" char="#" />
        <IncludeRules context="Detect Builtin Variables" />
        <IncludeRules context="Detect Variable Substitutions" />
        <IncludeRules context="Detect Special Values" />
        <IncludeRules context="Detect Aliased Targets" />
        <IncludeRules context="Detect Generator Expressions" />
      </context>

      <context attribute="Normal Text" lineEndContext="#stay" name="Detect Special Values">
        <RegExpr attribute="True Special Arg" context="#stay" String="\b(TRUE|ON)\b" />
        <RegExpr attribute="False Special Arg" context="#stay" String="\b(FALSE|OFF|(&id_re;-)?NOTFOUND)\b" />
        <RegExpr attribute="Special Args" context="#stay" String="\bCMP[0-9][0-9][0-9]\b" />
      </context>

      <context attribute="Normal Text" lineEndContext="#stay" name="Detect Aliased Targets">
        <RegExpr attribute="Aliased Targets" context="#stay" String="\b&id_re;::&id_re;(::&id_re;)*\b" />
      </context>

      <context attribute="Comment" lineEndContext="#pop" name="Comment">
        <LineContinue attribute="Comment" context="#pop" />
        <IncludeRules context="##Alerts" />
        <IncludeRules context="##Modelines" />
      </context>

      <context attribute="Comment" lineEndContext="#stay" name="RST Documentation" dynamic="true">
        <RegExpr attribute="Region Marker" context="#pop" String="^#?\]%1\]" dynamic="true" column="0" />
        <IncludeRules context="##reStructuredText" />
      </context>

      <context attribute="Comment" lineEndContext="#stay" name="Bracketed Comment" dynamic="true">
        <RegExpr attribute="Comment" context="#pop" String=".*\]%1\]" dynamic="true" />
        <IncludeRules context="##Alerts" />
        <IncludeRules context="##Modelines" />
      </context>

      <context attribute="Strings" lineEndContext="#stay" name="String">
        <RegExpr attribute="Strings" context="#pop" String="&quot;(?=[ );]|$)" />
        <RegExpr attribute="Escapes" context="#stay" String="\\[&quot;$nrt\\]" />
        <IncludeRules context="Detect Variable Substitutions" />
        <IncludeRules context="Detect Generator Expressions" />
      </context>

      <context attribute="Strings" lineEndContext="#stay" name="Bracketed String" dynamic="true">
        <RegExpr attribute="Strings" context="#pop" String="\]%1\]" dynamic="true" />
      </context>

      <context attribute="Normal Text" lineEndContext="#stay" name="Detect Generator Expressions">
        <Detect2Chars attribute="Generator Expression" context="Generator Expression" char="$" char1="&lt;" />
      </context>

      <context attribute="Generator Expression" lineEndContext="#stay" name="Generator Expression">
        <IncludeRules context="Detect Generator Expressions" />
        <DetectChar attribute="Comment" context="Comment" char="#" />
        <DetectChar attribute="Generator Expression" context="#pop" char="&gt;" />
        <keyword attribute="Generator Expression Keyword" context="#stay" String="generator-expressions" insensitive="false" />
        <IncludeRules context="Detect Aliased Targets" />
        <IncludeRules context="Detect Variable Substitutions" />
      </context>

    </contexts>

    <itemDatas>
      <itemData name="Normal Text" defStyleNum="dsNormal" spellChecking="false" />
      <itemData name="Command" defStyleNum="dsKeyword" spellChecking="false" />
      <itemData name="User Function/Macro"  defStyleNum="dsFunction" spellChecking="false" />
      <itemData name="Property" defStyleNum="dsOthers" spellChecking="false" />
      <itemData name="Aliased Targets" defStyleNum="dsBaseN" spellChecking="false" />
      <itemData name="Named Args" defStyleNum="dsOthers" spellChecking="false" />
      <itemData name="Special Args" defStyleNum="dsOthers" spellChecking="false" />
      <itemData name="True Special Arg" defStyleNum="dsOthers" color="#30a030" selColor="#30a030" spellChecking="false" />
      <itemData name="False Special Arg" defStyleNum="dsOthers" color="#e05050" selColor="#e05050" spellChecking="false" />
      <itemData name="Strings" defStyleNum="dsString" spellChecking="true" />
      <itemData name="Escapes" defStyleNum="dsChar" spellChecking="false" />
      <itemData name="Builtin Variable" defStyleNum="dsDecVal" color="#c09050" selColor="#c09050" spellChecking="false" />
      <itemData name="Variable Substitution" defStyleNum="dsDecVal" spellChecking="false" />
      <itemData name="@Variable Substitution" defStyleNum="dsBaseN" spellChecking="false" />
      <itemData name="Internal Name" defStyleNum="dsDecVal" color="#303030" selColor="#303030" spellChecking="false" />
      <itemData name="Environment Variable Substitution" defStyleNum="dsFloat" spellChecking="false" />
      <itemData name="Generator Expression Keyword" defStyleNum="dsKeyword" color="#b84040" selColor="#b84040" spellChecking="false" />
      <itemData name="Generator Expression" defStyleNum="dsOthers" color="#b86050" selColor="#b86050" spellChecking="false" />
      <itemData name="Comment" defStyleNum="dsComment" spellChecking="true" />
      <itemData name="Region Marker" defStyleNum="dsRegionMarker" spellChecking="false" />
    </itemDatas>

  </highlighting>

  <general>
    <comments>
      <comment name="singleLine" start="#" />
    </comments>
    <keywords casesensitive="1" />
  </general>
</language>

<!-- kate: indent-width 2; tab-width 2; -->