Debian Codegraph @

data/syntax/c.xml

raw
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE language
3 [
4 <!ENTITY int "(?:[0-9](?:'?[0-9]++)*+)">
5 <!ENTITY hex_int "(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f]++)*+)">
6 <!ENTITY exp_float "(?:[eE][+-]?&int;)">
7 <!ENTITY exp_hexfloat "(?:[pP][-+]?&int;)">
8
9 <!ENTITY symbols ":!&#37;&amp;()+,-/.*&lt;=&gt;?[]|~^;">
10
11 <!-- printf-like format strings conversion specifiers -->
12 <!ENTITY printf_like "&#37;[-+ #0]*+(?:[0-9]++|\*)?(?:\.(?:[0-9]++|\*))?(?:(?:hh|ll|[hljzt]|wf?(?:8|16|32|64))?[dioxXubn]|(?:DD|[lLHD])?[fFeEaAgG]|l?[cs]|[p&#37;])">
13
14 <!ENTITY ispphash "(?:#|&#37;\:|\?\?=)">
15 <!ENTITY pphash "&ispphash;\s*">
16 ]>
17 <language name="C" section="Sources"
18 version="18" kateversion="5.79"
19 indenter="cstyle"
20 extensions="*.c;*.C;*.h"
21 mimetype="text/x-csrc;text/x-c++src;text/x-chdr"
22 priority="5">
23 <!--
24
25 Fixes by Sebastian Pipping ([email protected])
26
27 NOTE: Keep in sync with C++ highlighter! (cpp.xml)
28
29 Version 6: add more versatile numbers highlighting, taken from isocpp.xml
30 -->
31 <highlighting>
32 <list name="controlflow">
33 <item>break</item>
34 <item>case</item>
35 <item>continue</item>
36 <item>default</item>
37 <item>do</item>
38 <item>else</item>
39 <item>for</item>
40 <item>goto</item>
41 <item>if</item>
42 <item>return</item>
43 <item>switch</item>
44 <item>while</item>
45 </list>
46
47 <list name="keywords">
48 <item>alignas</item> <!-- C23 -->
49 <item>alignof</item> <!-- C23 -->
50 <item>auto</item>
51 <item>constexpr</item> <!-- C23 -->
52 <item>enum</item>
53 <item>extern</item>
54 <item>false</item> <!-- C23 -->
55 <item>inline</item>
56 <item>nullptr</item> <!-- C23 -->
57 <item>sizeof</item>
58 <item>static_assert</item> <!-- C23 -->
59 <item>struct</item>
60 <item>true</item> <!-- C23 -->
61 <item>typedef</item>
62 <item>typeof</item> <!-- C23 -->
63 <item>typeof_unqual</item> <!-- C23 -->
64 <item>union</item>
65 <item>_Alignas</item>
66 <item>_Alignof</item>
67 <item>_Atomic</item>
68 <item>_Noreturn</item>
69 <item>_Static_assert</item>
70 <item>_Thread_local</item>
71 </list>
72
73 <!-- https://en.cppreference.com/w/c/language/attributes -->
74 <list name="attributes">
75 <item>noreturn</item>
76 <item>deprecated</item>
77 <item>fallthrough</item>
78 <item>nodiscard</item>
79 <item>maybe_unused</item>
80 <item>unsequenced</item>
81 <item>reproducible</item>
82 </list>
83
84 <list name="types">
85 <item>bool</item> <!-- C23 -->
86 <item>char</item>
87 <item>char16_t</item>
88 <item>char32_t</item>
89 <item>double</item>
90 <item>float</item>
91 <item>int</item>
92 <item>long</item>
93 <item>short</item>
94 <item>signed</item>
95 <item>unsigned</item>
96 <item>void</item>
97 <item>int8_t</item>
98 <item>int16_t</item>
99 <item>int32_t</item>
100 <item>int64_t</item>
101 <item>uint8_t</item>
102 <item>uint16_t</item>
103 <item>uint32_t</item>
104 <item>uint64_t</item>
105 <item>int_least8_t</item>
106 <item>int_least16_t</item>
107 <item>int_least32_t</item>
108 <item>int_least64_t</item>
109 <item>uint_least8_t</item>
110 <item>uint_least16_t</item>
111 <item>uint_least32_t</item>
112 <item>uint_least64_t</item>
113 <item>int_fast8_t</item>
114 <item>int_fast16_t</item>
115 <item>int_fast32_t</item>
116 <item>int_fast64_t</item>
117 <item>uint_fast8_t</item>
118 <item>uint_fast16_t</item>
119 <item>uint_fast32_t</item>
120 <item>uint_fast64_t</item>
121 <item>size_t</item>
122 <item>ssize_t</item>
123 <item>wchar_t</item>
124 <item>intptr_t</item>
125 <item>uintptr_t</item>
126 <item>intmax_t</item>
127 <item>uintmax_t</item>
128 <item>ptrdiff_t</item>
129 <item>sig_atomic_t</item>
130 <item>wint_t</item>
131 <item>_BitInt</item> <!-- C23 -->
132 <item>_Bool</item>
133 <item>bool</item>
134 <item>_Decimal32</item> <!-- C23 -->
135 <item>_Decimal64</item> <!-- C23 -->
136 <item>_Decimal128</item> <!-- C23 -->
137 <item>_Complex</item>
138 <item>complex</item>
139 <item>_Imaginary</item>
140 <item>imaginary</item>
141 <item>_Generic</item>
142 <item>va_list</item>
143 <item>FILE</item>
144 <item>fpos_t</item>
145 <item>time_t</item>
146 <item>max_align_t</item>
147
148 <!-- modifiers -->
149 <item>const</item>
150 <item>register</item>
151 <item>restrict</item>
152 <item>static</item>
153 <item>thread_local</item> <!-- C23 -->
154 <item>volatile</item>
155 </list>
156
157 <list name="preprocessor">
158 <item>if</item>
159 <item>ifdef</item>
160 <item>ifndef</item>
161 <item>elif</item>
162 <item>elifdef</item> <!-- C23 -->
163 <item>elifndef</item> <!-- C23 -->
164 <item>else</item>
165 <item>endif</item>
166 <item>define</item>
167 <item>include</item>
168 <item>error</item>
169 <item>line</item>
170 <item>pragma</item>
171 <item>undef</item>
172 <item>warning</item>
173 <item>embed</item>
174 </list>
175
176 <contexts>
177 <context attribute="Normal Text" lineEndContext="#stay" name="Normal">
178 <DetectSpaces />
179 <!-- Match symbols (partial for fast path) -->
180 <AnyChar attribute="Symbol" context="#stay" String=":()]+-*=&gt;!|&amp;~^,;" />
181
182 <IncludeRules context="match keywords" />
183 <AnyChar context="SelectString" String="UuL&quot;'" lookAhead="1"/>
184 <DetectIdentifier />
185
186 <DetectChar attribute="Symbol" context="#stay" char="{" beginRegion="Brace1" />
187 <DetectChar attribute="Symbol" context="#stay" char="}" endRegion="Brace1" />
188 <Detect2Chars attribute="Symbol" context="#stay" char="&lt;" char1="%" beginRegion="Brace1" /> <!-- Digraph: { -->
189 <Detect2Chars attribute="Symbol" context="#stay" char="%" char1="&gt;" endRegion="Brace1" /> <!-- Digraph: } -->
190
191 <!-- Detect attributes -->
192 <Detect2Chars attribute="Symbol" context="Attribute" char="[" char1="[" />
193 <StringDetect attribute="Symbol" context="Attribute" String="&lt;:&lt;:" /> <!-- Digraph: [[ -->
194
195 <!-- Match numbers -->
196 <RegExpr context="Number" String="\.?[0-9]" lookAhead="1" />
197
198 <IncludeRules context="FindComments" />
199 <RegExpr context="AfterHash" String="&ispphash;|" firstNonSpace="1" lookAhead="1" />
200 <AnyChar attribute="Symbol" context="#stay" String="&symbols;"/>
201 </context>
202
203 <context name="match keywords" attribute="Normal Text" lineEndContext="#pop">
204 <keyword attribute="Control Flow" context="#stay" String="controlflow"/>
205 <keyword attribute="Keyword" context="#stay" String="keywords"/>
206 <keyword attribute="Data Type" context="#stay" String="types"/>
207 </context>
208
209
210 <context name="SelectStringPP" attribute="Preprocessor" lineEndContext="#pop">
211 <IncludeRules context="SelectString"/>
212 </context>
213 <context name="SelectString" attribute="Normal Text" lineEndContext="#pop">
214 <DetectChar attribute="String" context="#pop!String8" char="&quot;"/>
215 <DetectChar attribute="Char" context="#pop!Char8" char="'"/>
216 <Detect2Chars context="#pop!SelectStringPrefix" char="U" char1="&quot;" lookAhead="1"/>
217 <Detect2Chars context="#pop!SelectStringPrefix" char="u" char1="&quot;" lookAhead="1"/>
218 <Detect2Chars context="#pop!SelectStringPrefix" char="L" char1="&quot;" lookAhead="1"/>
219 <StringDetect context="#pop!SelectStringPrefix" String="u8&quot;" lookAhead="1"/>
220 <Detect2Chars context="#pop!SelectCharPrefix" char="U" char1="'" lookAhead="1"/>
221 <Detect2Chars context="#pop!SelectCharPrefix" char="u" char1="'" lookAhead="1"/>
222 <Detect2Chars context="#pop!SelectCharPrefix" char="L" char1="'" lookAhead="1"/>
223 <StringDetect context="#pop!SelectCharPrefix" String="u8'" lookAhead="1"/>
224
225 <!-- match identifier -->
226 <keyword attribute="Data Type" context="#pop" String="types"/>
227 <DetectIdentifier context="#pop"/>
228 </context>
229
230
231 <context name="SelectStringPrefix" attribute="String" lineEndContext="#pop">
232 <Detect2Chars attribute="String Literal Prefix" context="#pop!StringPrefix8" char="u" char1="8"/>
233 <AnyChar attribute="String Literal Prefix" context="#pop!StringPrefix16" String="uL"/>
234 <DetectChar attribute="String Literal Prefix" context="#pop!StringPrefix32" char="U"/>
235 </context>
236 <context name="StringPrefix8" attribute="String" lineEndContext="#pop">
237 <DetectChar attribute="String" context="#pop!String8" char="&quot;"/>
238 </context>
239 <context name="StringPrefix16" attribute="String" lineEndContext="#pop">
240 <DetectChar attribute="String" context="#pop!String16" char="&quot;"/>
241 </context>
242 <context name="StringPrefix32" attribute="String" lineEndContext="#pop">
243 <DetectChar attribute="String" context="#pop!String32" char="&quot;"/>
244 </context>
245
246 <context name="SelectCharPrefix" attribute="String" lineEndContext="#pop">
247 <Detect2Chars attribute="Char Literal Prefix" context="#pop!CharPrefix8" char="u" char1="8"/>
248 <AnyChar attribute="Char Literal Prefix" context="#pop!CharPrefix16" String="uL"/>
249 <DetectChar attribute="Char Literal Prefix" context="#pop!CharPrefix32" char="U"/>
250 </context>
251 <context name="CharPrefix8" attribute="Char" lineEndContext="#pop">
252 <DetectChar attribute="Char" context="#pop!Char8" char="'"/>
253 </context>
254 <context name="CharPrefix16" attribute="Char" lineEndContext="#pop">
255 <DetectChar attribute="Char" context="#pop!Char16" char="'"/>
256 </context>
257 <context name="CharPrefix32" attribute="Char" lineEndContext="#pop">
258 <DetectChar attribute="Char" context="#pop!Char32" char="'"/>
259 </context>
260
261
262 <context name="String8" attribute="String" lineEndContext="#pop">
263 <IncludeRules context="string normal char" />
264 <Detect2Chars context="String8EscapeX" char="\" char1="x" lookAhead="1"/>
265 <IncludeRules context="string special char" />
266 </context>
267 <context name="String8EscapeX" attribute="String" lineEndContext="#pop">
268 <HlCStringChar attribute="String Char" context="#pop!StringNoHex"/>
269 <Detect2Chars context="#pop" attribute="Error" char="\" char1="x"/>
270 </context>
271
272 <context name="String16" attribute="String" lineEndContext="#pop">
273 <IncludeRules context="string normal char" />
274 <Detect2Chars context="String16EscapeX" char="\" char1="x" lookAhead="1"/>
275 <IncludeRules context="string special char" />
276 </context>
277 <context name="String16EscapeX" attribute="String" lineEndContext="#pop">
278 <RegExpr attribute="String Char" context="#pop!StringNoHex" String="\\x[0-9A-Fa-f]{1,4}" />
279 <Detect2Chars context="#pop" attribute="Error" char="\" char1="x"/>
280 </context>
281
282 <context name="String32" attribute="String" lineEndContext="#pop">
283 <IncludeRules context="string normal char" />
284 <Detect2Chars context="String32EscapeX" char="\" char1="x" lookAhead="1"/>
285 <IncludeRules context="string special char" />
286 </context>
287 <context name="String32EscapeX" attribute="String" lineEndContext="#pop">
288 <RegExpr attribute="String Char" context="#pop!StringNoHex" String="\\x[0-9A-Fa-f]{1,8}" />
289 <Detect2Chars context="#pop" attribute="Error" char="\" char1="x"/>
290 </context>
291
292 <context name="StringNoHex" attribute="Error" lineEndContext="#pop" fallthroughContext="#pop">
293 <RegExpr attribute="Error" context="#pop" String="[0-9A-Fa-f]{1,}" />
294 </context>
295
296
297 <context name="Char8" attribute="Char" lineEndContext="#pop" fallthroughContext="CharClose">
298 <HlCStringChar attribute="String Char" context="CharClose"/>
299 <IncludeRules context="FindSingleChar"/>
300 </context>
301
302 <context name="Char16" attribute="Char" lineEndContext="#pop" fallthroughContext="CharClose">
303 <RegExpr attribute="String Char" context="CharClose" String="\\(?:[tnvbrfa'&quot;\\?]|[0-7]{1,3}|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4})|" />
304 <IncludeRules context="FindSingleChar"/>
305 </context>
306
307 <context name="Char32" attribute="Char" lineEndContext="#pop" fallthroughContext="CharClose">
308 <RegExpr attribute="String Char" context="CharClose" String="\\(?:[tnvbrfa'&quot;\\?]|[0-7]{1,3}|x[0-9A-Fa-f]{1,8}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})|" />
309 <IncludeRules context="FindSingleChar"/>
310 </context>
311
312
313 <context name="FindSingleChar" attribute="Char" lineEndContext="#pop">
314 <DetectChar attribute="Error" context="#pop" char="'" />
315 <RegExpr attribute="Char" context="CharClose" String="." />
316 </context>
317 <context name="CharClose" attribute="Error" lineEndContext="#pop#pop">
318 <DetectChar attribute="Char" context="#pop#pop" char="'" />
319 </context>
320
321
322 <context name="FindComments" attribute="Normal Text" lineEndContext="#pop">
323 <Detect2Chars attribute="Comment" context="MatchComment" char="/" char1="/" lookAhead="true" />
324 <Detect2Chars attribute="Comment" context="MatchComment" char="/" char1="*" lookAhead="true" />
325 </context>
326
327 <context name="MatchComment" attribute="Normal Text" lineEndContext="#pop" fallthroughContext="#pop">
328 <StringDetect attribute="Region Marker" context="#pop!Region Marker" String="//BEGIN" beginRegion="Region1" firstNonSpace="true" />
329 <StringDetect attribute="Region Marker" context="#pop!Region Marker" String="//END" endRegion="Region1" firstNonSpace="true" />
330 <IncludeRules context="##Doxygen" />
331 <Detect2Chars attribute="Comment" context="#pop!Commentar 1" char="/" char1="/" />
332 <Detect2Chars attribute="Comment" context="#pop!Commentar 2" char="/" char1="*" beginRegion="Comment" />
333 </context>
334
335 <context attribute="Region Marker" lineEndContext="#pop" name="Region Marker">
336 </context>
337
338 <context attribute="Comment" lineEndContext="#pop" name="Commentar 1">
339 <LineContinue attribute="Comment" context="#stay"/>
340 <IncludeRules context="##Comments" />
341 </context>
342
343 <context attribute="Comment" lineEndContext="#stay" name="Commentar 2">
344 <Detect2Chars attribute="Comment" context="#pop" char="*" char1="/" endRegion="Comment"/>
345 <IncludeRules context="##Comments" />
346 </context>
347
348
349 <context name="string special char" attribute="String" lineEndContext="#pop">
350 <HlCStringChar attribute="String Char"/>
351 <RegExpr attribute="String Char" String="\\(?:u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})|&printf_like;"/>
352 <DetectChar attribute="String" char="%"/>
353 <RegExpr attribute="Error" String="\\(?:u[^&quot;]{0,3}|U[^&quot;]{0,7}|.)"/>
354 <LineContinue attribute="Symbol"/>
355 </context>
356
357 <context name="string normal char" attribute="String" lineEndContext="#pop">
358 <!-- fast way, can be replaced by a `UntilChars` rule if it exists -->
359 <!-- % -> printf format -->
360 <RegExpr attribute="String" context="#stay" String="[^%\\&quot;]+" />
361 <DetectChar attribute="String" context="#pop" char="&quot;" />
362 </context>
363
364
365 <context attribute="Error" lineEndContext="#pop" name="AfterHash" fallthroughContext="#pop!LineError">
366 <RegExpr attribute="Preprocessor" context="#pop!PreprocessorCmd" String="&pphash;(?=.)|" firstNonSpace="true" />
367 </context>
368
369 <context name="LineError" attribute="Error" lineEndContext="#pop">
370 <LineContinue attribute="Error" context="#stay" />
371 <RegExpr attribute="Error" context="#stay" String="[^\\]+" />
372 </context>
373
374 <context attribute="Error" lineEndContext="#pop" name="PreprocessorCmd" fallthroughContext="#pop!LineError">
375 <WordDetect attribute="Preprocessor" context="#pop!Include" String="include" insensitive="true" />
376
377 <WordDetect attribute="Preprocessor" context="#pop!Preprocessor" String="ifdef" beginRegion="PP" lookAhead="true" insensitive="true" />
378 <WordDetect attribute="Preprocessor" context="#pop!Preprocessor" String="ifndef" beginRegion="PP" lookAhead="true" insensitive="true" />
379 <RegExpr attribute="Preprocessor" context="#pop!Outscoped" String="if\s+0\s*$|" beginRegion="PP" />
380 <WordDetect attribute="Preprocessor" context="#pop!Preprocessor" String="if" beginRegion="PP" lookAhead="true" insensitive="true" />
381 <WordDetect attribute="Preprocessor" context="#pop!Preprocessor" String="elif" endRegion="PP" beginRegion="PP" lookAhead="true" insensitive="true" />
382 <WordDetect attribute="Preprocessor" context="#pop!Preprocessor" String="else" endRegion="PP" beginRegion="PP" insensitive="true" />
383 <WordDetect attribute="Preprocessor" context="#pop!Preprocessor" String="endif" endRegion="PP" insensitive="true" />
384 <WordDetect attribute="Preprocessor" context="#pop!Preprocessor" String="elifdef" endRegion="PP" beginRegion="PP" lookAhead="true" insensitive="true" />
385 <WordDetect attribute="Preprocessor" context="#pop!Preprocessor" String="elifndef" endRegion="PP" beginRegion="PP" lookAhead="true" insensitive="true" />
386
387 <WordDetect attribute="Preprocessor" context="#pop!Define" String="define"/>
388
389 <!-- folding for apple style #pragma mark - label -->
390 <RegExpr attribute="Preprocessor" context="#pop" String="&pphash;pragma\s+mark\s+-\s*|" insensitive="true" endRegion="pragma_mark" />
391 <RegExpr attribute="Preprocessor" context="Preprocessor" String="&pphash;pragma\s+mark|" insensitive="true" endRegion="pragma_mark" beginRegion="pragma_mark" />
392
393 <keyword attribute="Preprocessor" context="#pop!Preprocessor" String="preprocessor" />
394 <!-- GCC extension -->
395 <WordDetect attribute="Preprocessor" context="#pop!Include" String="include_next" />
396 <Int attribute="Preprocessor" context="#pop!Preprocessor"/>
397 </context>
398
399 <context attribute="Preprocessor" lineEndContext="#pop" name="Include">
400 <DetectSpaces />
401 <RangeDetect attribute="Prep. Lib" context="#stay" char="&quot;" char1="&quot;"/>
402 <RangeDetect attribute="Prep. Lib" context="#stay" char="&lt;" char1="&gt;"/>
403 <IncludeRules context="Preprocessor" />
404 <DetectIdentifier/>
405 </context>
406
407 <context attribute="Preprocessor" lineEndContext="#pop" name="Preprocessor">
408 <LineContinue attribute="Symbol" context="#stay"/>
409 <IncludeRules context="FindComments" />
410 </context>
411
412 <context name="Define" attribute="Preprocessor" lineEndContext="#pop">
413 <DetectSpaces/>
414 <IncludeRules context="InPreprocessor" />
415 <Detect2Chars attribute="Error" context="#pop!LineError" char="/" char1="/" />
416 <Detect2Chars attribute="Comment" context="MatchComment" char="/" char1="*" lookAhead="true" />
417 <IncludeRules context="GNUMacros##GCCExtensions" />
418 <DetectIdentifier attribute="Preprocessor" context="#pop!In Define"/>
419 </context>
420
421 <context name="In Define" attribute="Preprocessor" lineEndContext="#pop">
422 <DetectSpaces/>
423 <LineContinue attribute="Symbol" context="#stay" />
424 <!-- Match symbols (partial for fast path) -->
425 <AnyChar attribute="Symbol" context="#stay" String="#:(){}]+-*%=&gt;!|&amp;~^,;" />
426
427 <IncludeRules context="match keywords" />
428 <AnyChar context="SelectStringPP" String="UuLR&quot;'" lookAhead="1"/>
429 <DetectIdentifier />
430
431 <!-- Detect attributes -->
432 <Detect2Chars attribute="Symbol" context="Attribute In PP" char="[" char1="[" />
433 <StringDetect attribute="Symbol" context="Attribute In PP" String="&lt;:&lt;:" /> <!-- Digraph: [[ -->
434
435 <!-- Match numbers -->
436 <RegExpr context="Number" String="\.?\d" lookAhead="1" />
437
438 <IncludeRules context="FindComments" />
439 <AnyChar attribute="Symbol" context="#stay" String="#&symbols;"/>
440 </context>
441
442 <context name="Attribute In PP" attribute="Attribute" lineEndContext="#pop">
443 <IncludeRules context="InPreprocessor" />
444 <IncludeRules context="Attribute" />
445 </context>
446
447 <context name="InPreprocessor" attribute="Normal Text" lineEndContext="#pop">
448 <LineContinue attribute="Symbol" context="#stay" />
449 <DetectChar attribute="Error" context="#stay" char="\" />
450 </context>
451
452 <context attribute="Comment" lineEndContext="#stay" name="Outscoped" >
453 <DetectSpaces />
454 <IncludeRules context="##Comments" />
455 <DetectIdentifier />
456 <DetectChar attribute="String" context="String8" char="&quot;"/>
457 <IncludeRules context="FindComments" />
458 <RegExpr attribute="Comment" context="Outscoped intern" String="&pphash;if|" beginRegion="PP" firstNonSpace="true" />
459 <RegExpr attribute="Preprocessor" context="#pop" String="&pphash;el(?:se|if(n?def)?)|" firstNonSpace="true" />
460 <RegExpr attribute="Preprocessor" context="#pop" String="&pphash;endif|" endRegion="PP" firstNonSpace="true" />
461 </context>
462
463 <context attribute="Comment" lineEndContext="#stay" name="Outscoped intern">
464 <DetectSpaces />
465 <IncludeRules context="##Comments" />
466 <DetectIdentifier />
467 <DetectChar attribute="String" context="String8" char="&quot;"/>
468 <IncludeRules context="FindComments" />
469 <RegExpr attribute="Comment" context="Outscoped intern" String="&pphash;if|" beginRegion="PP" firstNonSpace="true" />
470 <RegExpr attribute="Comment" context="#pop" String="&pphash;endif|" endRegion="PP" firstNonSpace="true" />
471 </context>
472
473
474 <context name="Number" attribute="Normal Text" lineEndContext="#pop" fallthroughContext="#pop">
475 <WordDetect attribute="Decimal" context="IntSuffix" String="0" weakDeliminator="."/>
476 <RegExpr attribute="Float" context="FloatSuffix" String="\.&int;&exp_float;?|0[xX](?:\.&hex_int;&exp_hexfloat;?|&hex_int;(?:&exp_hexfloat;|\.&hex_int;?&exp_hexfloat;?))|&int;(?:&exp_float;|\.&int;?&exp_float;?)" />
477 <IncludeRules context="Integer" />
478 </context>
479
480 <context name="Integer" attribute="Normal Text" lineEndContext="#pop">
481 <DetectChar context="#pop!IntStartsWith0" char="0" lookAhead="1"/>
482 <RegExpr attribute="Decimal" context="IntSuffix" String="&int;" />
483 <RegExpr attribute="Error" context="#pop" String="[._0-9A-Za-z']++" />
484 </context>
485 <context name="IntStartsWith0" attribute="Normal Text" lineEndContext="#pop">
486 <RegExpr attribute="Hex" context="IntSuffix" String="0[xX]&hex_int;" />
487 <RegExpr attribute="Binary" context="IntSuffix" String="0[Bb][01](?:'?[01]++)*+" />
488 <RegExpr attribute="Octal" context="IntSuffix" String="0(?:'?[0-7]++)++" />
489 <DetectChar attribute="Decimal" context="IntSuffix" char="0"/>
490 </context>
491
492 <context name="IntSuffix" attribute="Error" lineEndContext="#pop#pop" fallthroughContext="NumericSuffixError">
493 <DetectChar attribute="Error" context="#stay" char="'" />
494 <!-- https://en.cppreference.com/w/c/language/integer_constant#The_type_of_the_integer_constant -->
495 <RegExpr attribute="Standard Suffix" context="NumericSuffixError" String="([Uu](LL?|ll?|wb|WB)?|(LL?|ll?|wb|WB)[Uu]?)\b"/>
496 </context>
497
498 <context name="FloatSuffix" attribute="Error" lineEndContext="#pop#pop" fallthroughContext="NumericSuffixError">
499 <DetectChar attribute="Error" context="#stay" char="'" />
500 <!-- https://en.cppreference.com/w/c/language/floating_constant#Suffixes -->
501 <AnyChar attribute="Standard Suffix" context="NumericSuffixError" String="fFlL"/>
502 <Detect2Chars attribute="Standard Suffix" context="NumericSuffixError" char="d" char1="f"/>
503 <Detect2Chars attribute="Standard Suffix" context="NumericSuffixError" char="D" char1="F"/>
504 <Detect2Chars attribute="Standard Suffix" context="NumericSuffixError" char="d" char1="d"/>
505 <Detect2Chars attribute="Standard Suffix" context="NumericSuffixError" char="D" char1="D"/>
506 <Detect2Chars attribute="Standard Suffix" context="NumericSuffixError" char="d" char1="l"/>
507 <Detect2Chars attribute="Standard Suffix" context="NumericSuffixError" char="D" char1="L"/>
508 </context>
509
510 <context name="NumericSuffixError" attribute="Error" lineEndContext="#pop#pop#pop" fallthroughContext="#pop#pop#pop">
511 <AnyChar attribute="Error" String=".'0123456789"/>
512 <DetectIdentifier attribute="Error"/>
513 </context>
514
515 <context name="Attribute" attribute="Attribute" lineEndContext="#stay">
516 <DetectSpaces/>
517 <keyword attribute="Standard Attribute" context="#stay" String="attributes" />
518 <Detect2Chars attribute="Symbol" context="#pop" char="]" char1="]" />
519 <StringDetect attribute="Symbol" context="#pop" String=":&gt;:&gt;" /> <!-- Digraph: ]] -->
520 <AnyChar attribute="Symbol" context="#stay" String="&symbols;" />
521 <!-- Attributes may contain some text: [[deprecated("Reason text")]] -->
522 <DetectChar attribute="String" context="String8" char="&quot;" />
523 <AnyChar attribute="Decimal" context="Integer" String="0123456789" lookAhead="true" />
524 <IncludeRules context="DetectGccAttributes##GCCExtensions" />
525 <DetectIdentifier />
526 </context>
527
528 </contexts>
529 <itemDatas>
530 <itemData name="Normal Text" defStyleNum="dsNormal" spellChecking="false"/>
531 <itemData name="Control Flow" defStyleNum="dsControlFlow" spellChecking="false"/>
532 <itemData name="Keyword" defStyleNum="dsKeyword" spellChecking="false"/>
533 <itemData name="Data Type" defStyleNum="dsDataType" spellChecking="false"/>
534 <itemData name="Attribute" defStyleNum="dsAttribute" spellChecking="false"/>
535 <itemData name="Standard Attribute" defStyleNum="dsAttribute" spellChecking="false"/>
536 <itemData name="Decimal" defStyleNum="dsDecVal" spellChecking="false"/>
537 <itemData name="Octal" defStyleNum="dsBaseN" spellChecking="false"/>
538 <itemData name="Hex" defStyleNum="dsBaseN" spellChecking="false"/>
539 <itemData name="Binary" defStyleNum="dsBaseN" spellChecking="false"/>
540 <itemData name="Float" defStyleNum="dsFloat" spellChecking="false"/>
541 <itemData name="Standard Suffix" defStyleNum="dsBuiltIn" spellChecking="false" />
542 <itemData name="Char" defStyleNum="dsChar" spellChecking="false"/>
543 <itemData name="Char Literal Prefix" defStyleNum="dsChar" spellChecking="false" />
544 <itemData name="String" defStyleNum="dsString"/>
545 <itemData name="String Char" defStyleNum="dsSpecialChar" spellChecking="false"/>
546 <itemData name="String Literal Prefix" defStyleNum="dsString" spellChecking="true" />
547 <itemData name="Comment" defStyleNum="dsComment"/>
548 <itemData name="Symbol" defStyleNum="dsOperator" spellChecking="false"/>
549 <itemData name="Preprocessor" defStyleNum="dsPreprocessor" spellChecking="false"/>
550 <itemData name="Prep. Lib" defStyleNum="dsImport" spellChecking="false"/>
551 <itemData name="Region Marker" defStyleNum="dsRegionMarker" spellChecking="false"/>
552 <itemData name="Error" defStyleNum="dsError" spellChecking="false"/>
553 </itemDatas>
554 </highlighting>
555 <general>
556 <comments>
557 <comment name="singleLine" start="//" position="afterwhitespace" />
558 <comment name="multiLine" start="/*" end="*/" region="Comment" />
559 </comments>
560 <keywords casesensitive="1" additionalDeliminator="#'&quot;" />
561 </general>
562 </language>
563 <!-- kate: replace-tabs on; tab-width 2; indent-width 2; -->