1 <?xml version="1.0" encoding="UTF-8"?>
2 <language id="qc" _name="QuakeC" version="1.0" _section="Sources">
4 <property name="globs">*.qc</property>
5 <property name="line-comment-start">//</property>
6 <property name="block-comment-start">/*</property>
7 <property name="block-comment-end">*/</property>
11 <style id="comment" _name="Comment" map-to="def:comment"/>
12 <style id="string" _name="String" map-to="def:string"/>
13 <style id="preprocessor" _name="Preprocessor" map-to="def:preprocessor"/>
14 <style id="common-defines" _name="Common Defines" map-to="def:special-constant"/>
15 <style id="included-file" _name="Included File" map-to="def:string"/>
16 <style id="keyword" _name="Keyword" map-to="def:keyword"/>
17 <style id="type" _name="Data Type" map-to="def:type"/>
18 <style id="escaped-character" _name="Escaped Character" map-to="def:special-char"/>
19 <style id="floating-point" _name="Floating point number" map-to="def:floating-point"/>
20 <style id="decimal" _name="Decimal number" map-to="def:decimal"/>
21 <style id="hexadecimal" _name="Hexadecimal number" map-to="def:base-n-integer"/>
22 <style id="boolean" _name="Boolean value" map-to="def:boolean"/>
28 <define-regex id="preproc-start">^\s*#\s*</define-regex>
29 <define-regex id="escaped-character" extended="true">
30 \\( # leading backslash
31 [\\\"\'nrbtfav\?] | # escaped character
32 [0-7]{1,3} | # one, two, or three octal digits
33 x[0-9A-Fa-f]+ # 'x' followed by hex digits
38 <context id="if0-comment" style-ref="comment">
39 <start>\%{preproc-start}if\b\s*0\b</start>
40 <end>\%{preproc-start}(endif|else|elif)\b</end>
42 <context id="if-in-if0">
43 <start>\%{preproc-start}if(n?def)?\b</start>
44 <end>\%{preproc-start}endif\b</end>
46 <context ref="if-in-if0"/>
47 <context ref="def:in-comment"/>
50 <context ref="def:in-comment"/>
53 <context id="include" style-ref="preprocessor">
54 <match extended="true">
60 <context id="included-file" sub-pattern="2" style-ref="included-file"/>
63 <context id="preprocessor" style-ref="preprocessor" end-at-line-end="true">
64 <start extended="true">
66 (define|undef|error|pragma|ident|if(n?def)?|else|elif|endif|line|warning)
70 <context ref="def:line-continue" ignore-style="true"/>
71 <context ref="string" ignore-style="true"/>
72 <context ref="def:qc-like-comment"/>
73 <context ref="def:qc-like-comment-multiline"/>
77 <context id="float" style-ref="floating-point">
78 <match extended="true">
80 ((\.[0-9]+ | [0-9]+\.[0-9]*) ([Ee][+-]?[0-9]*)? |
81 ([0-9]+[Ee][+-]?[0-9]*))
87 <context id="hexadecimal" style-ref="hexadecimal">
88 <match extended="true">
90 0[xX][a-fA-F0-9]+[uUlL]*
95 <context id="invalid-hexadecimal" style-ref="error">
96 <match extended="true">
98 0[xX][a-fA-F0-9]*[g-zG-Z][a-zA-Z0-9]*[uUlL]*
103 <context id="decimal" style-ref="decimal">
104 <match extended="true">
106 (0|[1-9][0-9]*)[uUlL]*
111 <context id="keywords" style-ref="keyword">
112 <keyword>break</keyword>
113 <keyword>case</keyword>
114 <keyword>continue</keyword>
115 <keyword>default</keyword>
116 <keyword>do</keyword>
117 <keyword>else</keyword>
118 <keyword>enum</keyword>
119 <keyword>for</keyword>
120 <keyword>goto</keyword>
121 <keyword>if</keyword>
122 <keyword>return</keyword>
123 <keyword>switch</keyword>
124 <keyword>typedef</keyword>
125 <keyword>while</keyword>
126 <keyword>nil</keyword>
129 <context id="types" style-ref="type">
130 <keyword>bool</keyword>
131 <keyword>string</keyword>
132 <keyword>vector</keyword>
133 <keyword>float</keyword>
134 <keyword>void</keyword>
137 <context id="boolean" style-ref="boolean">
138 <keyword>true</keyword>
139 <keyword>false</keyword>
142 <context id="common-defines" style-ref="common-defines">
143 <keyword>__LINE__</keyword>
144 <keyword>__FILE__</keyword>
145 <keyword>__TIME__</keyword>
146 <keyword>__RANDOM__</keyword>
147 <keyword>__RANDOM_LAST__</keyword>
148 <keyword>__COUNTER__</keyword>
149 <keyword>__COUNTER_LAST__</keyword>
150 <keyword>__DATE__</keyword>
153 <context id="qc" class="no-spell-check">
155 <context ref="def:qc-like-comment"/>
156 <context ref="def:qc-like-comment-multiline"/>
157 <context ref="def:qc-like-close-comment-outside-comment"/>
158 <context ref="if0-comment"/>
159 <context ref="include"/>
160 <context ref="preprocessor"/>
161 <context ref="string"/>
162 <context ref="float"/>
163 <context ref="hexadecimal"/>
164 <context ref="invalid-hexadecimal"/>
165 <context ref="decimal"/>
166 <context ref="keywords"/>
167 <context ref="types"/>
168 <context ref="boolean"/>
169 <context ref="common-defines"/>