1 | { |
---|
2 | "scopeName": "source.cfa", |
---|
3 | "patterns": [ |
---|
4 | { "include": "#comments"}, |
---|
5 | { "include": "#preprocessor"}, |
---|
6 | { "include": "#extern"}, |
---|
7 | { "include": "#declaration"}, |
---|
8 | { "include": "#constant"}, |
---|
9 | { "include": "#operators"} |
---|
10 | ], |
---|
11 | "repository": { |
---|
12 | "preprocessor": { |
---|
13 | "patterns":[ |
---|
14 | { "include": "#directive.pragma" }, |
---|
15 | { "include": "#directive.include" }, |
---|
16 | { "include": "#directive.define" }, |
---|
17 | { "include": "#directive.undef" }, |
---|
18 | { "include": "#directive.ifdef" }, |
---|
19 | { "include": "#directive.condition.arg" }, |
---|
20 | { "include": "#directive.condition.noargs" } |
---|
21 | ], |
---|
22 | "repository": { |
---|
23 | "directive.punctuation": { |
---|
24 | "match": "#", |
---|
25 | "name": "punctuation.definition.directive.cfa" |
---|
26 | }, |
---|
27 | "directive.pragma": { |
---|
28 | "name": "meta.preprocessor.pragma.cfa", |
---|
29 | "match": "^\\s*(#\\s*pragma)\\s+(((?!//|/\\*).)*)", |
---|
30 | "captures":{ |
---|
31 | "1": { |
---|
32 | "name": "keyword.control.directive.pragma.cfa", |
---|
33 | "patterns":[{ "include": "#directive.punctuation"} ] |
---|
34 | }, |
---|
35 | "2": {"name": "keyword.control.directive.pragma.argument.cfa"} |
---|
36 | } |
---|
37 | }, |
---|
38 | "directive.include.string": { |
---|
39 | "begin": "<|\"", |
---|
40 | "end": ">|\"", |
---|
41 | "beginCaptures": { |
---|
42 | "0": { "name": "punctuation.definition.string.begin.cfa" } |
---|
43 | }, |
---|
44 | "endCaptures": { |
---|
45 | "0": { "name": "punctuation.definition.string.end.cfa" } |
---|
46 | }, |
---|
47 | "name": "string.quoted.include.cfa" |
---|
48 | }, |
---|
49 | "directive.include": { |
---|
50 | "name": "meta.preprocessor.include.cfa", |
---|
51 | "match": "^\\s*(#\\s*include)\\s+(<.*>|\".*\")", |
---|
52 | "captures": { |
---|
53 | "1": { |
---|
54 | "name": "keyword.control.directive.include.cfa", |
---|
55 | "patterns":[{ "include": "#directive.punctuation"} ] |
---|
56 | }, |
---|
57 | "2": {"patterns": [{ "include": "#directive.include.string"}]} |
---|
58 | } |
---|
59 | }, |
---|
60 | "directive.macro.name": { |
---|
61 | "name": "entity.name.function.preprocessor.cfa", |
---|
62 | "match": "[A-z0-9_]+" |
---|
63 | }, |
---|
64 | "directive.define": { |
---|
65 | "name": "meta.preprocessor.macro.cfa", |
---|
66 | "match": "(#\\s*define)\\s+([A-z0-9_]+)(\\(.*\\))?\\s+(.*)?", |
---|
67 | "captures": { |
---|
68 | "1": { |
---|
69 | "name": "keyword.control.directive.define.cfa", |
---|
70 | "patterns":[{ "include": "#directive.punctuation"} ] |
---|
71 | }, |
---|
72 | "2": {"patterns": [{ "include": "#directive.macro.name"}]}, |
---|
73 | "3": {"name":"meta.preprocessor.macro.args.cfa"}, |
---|
74 | "4": {"name":"meta.preprocessor.macro.definition.cfa", "patterns": [{ "include": "$self" }]} |
---|
75 | } |
---|
76 | }, |
---|
77 | "directive.undef": { |
---|
78 | "name": "meta.preprocessor.macro.cfa", |
---|
79 | "match": "^\\s*(#\\s*undef)\\s+(\\w+)", |
---|
80 | "captures": { |
---|
81 | "1": { |
---|
82 | "name": "keyword.control.directive.undef.cfa", |
---|
83 | "patterns":[{ "include": "#directive.punctuation"} ] |
---|
84 | }, |
---|
85 | "2": {"name":"meta.define.B", "patterns": [{ "include": "#directive.macro.name"}]} |
---|
86 | } |
---|
87 | }, |
---|
88 | "directive.isdef": { |
---|
89 | "match": "(defined)\\s*\\(\\s*(\\w+)\\s*\\)", |
---|
90 | "captures": { |
---|
91 | "1": { |
---|
92 | "name": "keyword.control.directive.conditional.cfa", |
---|
93 | "match": "defined" |
---|
94 | }, |
---|
95 | "2": {"patterns": [{ "include": "#directive.macro.name"}]} |
---|
96 | } |
---|
97 | }, |
---|
98 | "directive.ifdef": { |
---|
99 | "name": "meta.preprocessor.cfa", |
---|
100 | "match": "^\\s*(#\\s*ifdef)\\s+(\\w+)", |
---|
101 | "captures": { |
---|
102 | "1": { |
---|
103 | "name": "keyword.control.directive.conditional.cfa", |
---|
104 | "patterns":[{ "include": "#directive.punctuation"} ] |
---|
105 | }, |
---|
106 | "2": {"patterns": [{ "include": "#directive.macro.name"}]} |
---|
107 | } |
---|
108 | }, |
---|
109 | "directive.condition.arg": { |
---|
110 | "name": "meta.preprocessor.cfa", |
---|
111 | "match": "^\\s*(#\\s*if|#\\s*elif)\\s+(.*)", |
---|
112 | "captures": { |
---|
113 | "1": { |
---|
114 | "name": "keyword.control.directive.conditional.cfa", |
---|
115 | "patterns":[{ "include": "#directive.punctuation"} ] |
---|
116 | }, |
---|
117 | "2": {"patterns":[ |
---|
118 | { "include": "#expression"}, |
---|
119 | { "include": "#directive.isdef"} |
---|
120 | ]} |
---|
121 | } |
---|
122 | }, |
---|
123 | "directive.condition.noargs": { |
---|
124 | "name": "meta.preprocessor.cfa", |
---|
125 | "match": "^\\s*(#\\s*endif|#\\s*else)\\s+", |
---|
126 | "captures": { |
---|
127 | "1": { |
---|
128 | "name": "keyword.control.directive.conditional.cfa", |
---|
129 | "patterns":[{ "include": "#directive.punctuation"} ] |
---|
130 | } |
---|
131 | } |
---|
132 | } |
---|
133 | } |
---|
134 | }, |
---|
135 | "comments": { |
---|
136 | "patterns":[ |
---|
137 | { "include": "#comments.line"}, |
---|
138 | { "include": "#comments.block"} |
---|
139 | ], |
---|
140 | "repository": { |
---|
141 | "comments.line":{ |
---|
142 | "name": "comment.line.double-slash.cfa", |
---|
143 | "match": "(\/\/).*", |
---|
144 | "captures": { |
---|
145 | "1": {"name": "punctuation.definition.comment.c", "match": "\/\/"} |
---|
146 | } |
---|
147 | }, |
---|
148 | "comments.block":{ |
---|
149 | "name": "comment.block.cfa", |
---|
150 | "begin": "/\\*", |
---|
151 | "end": "\\*/", |
---|
152 | "beginCaptures": { |
---|
153 | "0": { "name": "punctuation.definition.comment.begin.cfa" } |
---|
154 | }, |
---|
155 | "endCaptures": { |
---|
156 | "0": { "name": "punctuation.definition.comment.end.cfa" } |
---|
157 | } |
---|
158 | } |
---|
159 | } |
---|
160 | }, |
---|
161 | "extern": { |
---|
162 | "patterns": [{ "include": "#extern.block"}], |
---|
163 | "repository": { |
---|
164 | "extern.head.string": { |
---|
165 | "begin": "\"", |
---|
166 | "end": "\"", |
---|
167 | "beginCaptures": { |
---|
168 | "0": { "name": "punctuation.definition.string.begin.cfa" } |
---|
169 | }, |
---|
170 | "endCaptures": { |
---|
171 | "0": { "name": "punctuation.definition.string.end.cfa" } |
---|
172 | }, |
---|
173 | "name": "string.quoted.extern.cfa" |
---|
174 | }, |
---|
175 | "extern.head": { |
---|
176 | "match": "(extern)\\s+(.*)\\s+(\\{)", |
---|
177 | "captures": { |
---|
178 | "1": { "name": "storage.modifier.cfa" }, |
---|
179 | "2": { "patterns":[{ "include": "#extern.head.string"}] }, |
---|
180 | "3": { "name": "punctuation.section.block.begin.bracket.curly.extern.cfa" } |
---|
181 | } |
---|
182 | }, |
---|
183 | "extern.block": { |
---|
184 | "name": "meta.block.extern.cfa", |
---|
185 | "begin": "(extern\\s+.*\\s+\\{)", |
---|
186 | "end": "(\\})", |
---|
187 | "beginCaptures": { |
---|
188 | "0": { "name": "meta.head.extern.cfa", "patterns":[{ "include": "#extern.head" }] } |
---|
189 | }, |
---|
190 | "endCaptures": { |
---|
191 | "0": { "name": "punctuation.section.block.end.bracket.curly.extern.cfa" } |
---|
192 | }, |
---|
193 | "contentName": "meta.body.extern.cfa", |
---|
194 | "patterns": [{ "include": "$self" }] |
---|
195 | } |
---|
196 | } |
---|
197 | }, |
---|
198 | "declaration": { |
---|
199 | "patterns": [ |
---|
200 | {"include": "#declaration.type"}, |
---|
201 | {"include": "#declaration.aggregate"} |
---|
202 | ], |
---|
203 | "repository": { |
---|
204 | "declaration.type": { |
---|
205 | "patterns": [ |
---|
206 | { "match": "(\\b|^|\\s)(void|bool|char|short|int|long|signed|unsigned|float|double)(\\b|$|\\s)", "name": "storage.type.built-in.primitive.cfa"}, |
---|
207 | { "match": "(\\b|^|\\s)(zero_t|one_t|size_t|ssize_t|intptr_t|uintptr_t|\\$thread|\\$coroutine|\\$generator|\\$monitor)(\\b|$|\\s)", "name": "storage.type.built-in.cfa"}, |
---|
208 | { "match": "(\\b|^|\\s)(extern|static|inline|volatile|const|thread_local)(\\b|$|\\s)", "name": "storage.modifier.cfa"} |
---|
209 | ] |
---|
210 | }, |
---|
211 | "declaration.aggregate": { |
---|
212 | "patterns": [ |
---|
213 | { "name": "storage.type.struct.cfa" , "match": "(\\b|^|\\s)struct(\\s+(\\w+))?(\\b|$|\\s)" , "captures": { "3": { "name": "entity.name.type.struct.cfa" }} }, |
---|
214 | { "name": "storage.type.union.cfa" , "match": "(\\b|^|\\s)union(\\s+(\\w+))?(\\b|$|\\s)" , "captures": { "3": { "name": "entity.name.type.union.cfa" }} }, |
---|
215 | { "name": "storage.type.enum.cfa" , "match": "(\\b|^|\\s)enum(\\s+(\\w+))?(\\b|$|\\s)" , "captures": { "3": { "name": "entity.name.type.enum.cfa" }} }, |
---|
216 | { "name": "storage.type.trait.cfa" , "match": "(\\b|^|\\s)trait(\\s+(\\w+))?(\\b|$|\\s)" , "captures": { "3": { "name": "entity.name.type.trait.cfa" }} }, |
---|
217 | { "name": "storage.type.generator.cfa", "match": "(\\b|^|\\s)generator(\\s+(\\w+))?(\\b|$|\\s)", "captures": { "3": { "name": "entity.name.type.generator.cfa"}} }, |
---|
218 | { "name": "storage.type.coroutine.cfa", "match": "(\\b|^|\\s)coroutine(\\s+(\\w+))?(\\b|$|\\s)", "captures": { "3": { "name": "entity.name.type.coroutine.cfa"}} }, |
---|
219 | { "name": "storage.type.thread.cfa" , "match": "(\\b|^|\\s)thread(\\s+(\\w+))?(\\b|$|\\s)" , "captures": { "3": { "name": "entity.name.type.thread.cfa" }} }, |
---|
220 | { "name": "storage.type.monitor.cfa" , "match": "(\\b|^|\\s)monitor(\\s+(\\w+))?(\\b|$|\\s)" , "captures": { "3": { "name": "entity.name.type.monitor.cfa" }} }, |
---|
221 | { "name": "storage.type.dtype.cfa" , "match": "(\\b|^|\\s)dtype(\\s+(\\w+))?(\\b|$|\\s)" , "captures": { "3": { "name": "entity.name.type.dtype.cfa" }} }, |
---|
222 | { "name": "storage.type.otype.cfa" , "match": "(\\b|^|\\s)otype(\\s+(\\w+))?(\\b|$|\\s)" , "captures": { "3": { "name": "entity.name.type.otype.cfa" }} }, |
---|
223 | { "name": "storage.type.ttype.cfa" , "match": "(\\b|^|\\s)ttyp(\\s+(\\w+))?(\\b|$|\\s)" , "captures": { "3": { "name": "entity.name.type.ttype.cfa" }} } |
---|
224 | ] |
---|
225 | } |
---|
226 | } |
---|
227 | }, |
---|
228 | "constant": { |
---|
229 | "patterns": [ |
---|
230 | {"include": "#constant.pointer"}, |
---|
231 | {"include": "#constant.number"}, |
---|
232 | {"include": "#constant.string.single"}, |
---|
233 | {"include": "#constant.string.double"}, |
---|
234 | {"include": "#constant.endline"} |
---|
235 | ], |
---|
236 | "repository": { |
---|
237 | "constant.number": { |
---|
238 | "patterns":[ |
---|
239 | {"name": "constant.numeric.binary.cfa", "match": "\\b0[b|B][_01\\.e]+(u?(hh|h|z|l\\d+|L\\d+|ll|l)u?)?"}, |
---|
240 | {"name": "constant.numeric.hexadecimal.cfa", "match": "\\b0[x|X][_\\dabcdefABCDEF\\.p]+(u?(hh|h|z|l\\d+|L\\d+|ll|l)u?)?"}, |
---|
241 | {"name": "constant.numeric.octal.cfa", "match": "\\b0[_0-7\\.]+(u?(hh|h|z|l\\d+|L\\d+|ll|l)u?)?"}, |
---|
242 | {"name": "constant.numeric.decimal.cfa", "match": "\\b[\\d\\.][_\\d\\.e\\+]*(u?(hh|h|z|l\\d+|L\\d+|ll|l)u?)?"} |
---|
243 | ] |
---|
244 | }, |
---|
245 | "constant.pointer": { |
---|
246 | "patterns":[ |
---|
247 | {"name": "constant.language.binary.cfa", "match": "\\b0[b|B][_01]+p"}, |
---|
248 | {"name": "constant.language.hexadecimal.cfa", "match": "\\b0[x|X][_\\dabcdefABCDEF]+p"}, |
---|
249 | {"name": "constant.language.octal.cfa", "match": "\\b0[_0-7]+p"}, |
---|
250 | {"name": "constant.language.decimal.cfa", "match": "\\b[\\d][_\\d\\.e\\+]*p"} |
---|
251 | ] |
---|
252 | }, |
---|
253 | "constant.string.content": { |
---|
254 | "patterns": [ |
---|
255 | { "name": "constant.character.escape.cfa" , "match": "\\\\."}, |
---|
256 | { "name": "constant.other.placeholder.cfa", "match": "%\\+?(\\.(\\d+|\\*))?(hh|h|ll|l|j|z|t|L)?[diuoxXfFeEgGaAcspn%]"} |
---|
257 | ] |
---|
258 | }, |
---|
259 | "constant.string.double": { |
---|
260 | "name": "string.quoted.double.cfa", |
---|
261 | "begin": "\"", |
---|
262 | "end": "\"", |
---|
263 | "beginCaptures": { |
---|
264 | "0": { "name": "punctuation.definition.string.begin.cfa" } |
---|
265 | }, |
---|
266 | "endCaptures": { |
---|
267 | "0": { "name": "punctuation.definition.string.end.cfa" } |
---|
268 | }, |
---|
269 | "patterns": [ |
---|
270 | { "include": "#constant.string.content"} |
---|
271 | ] |
---|
272 | }, |
---|
273 | "constant.string.single": { |
---|
274 | "name": "string.quoted.single.cfa", |
---|
275 | "begin": "'", |
---|
276 | "end": "'", |
---|
277 | "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.cfa" } }, |
---|
278 | "endCaptures" : { "0": { "name": "punctuation.definition.string.end.cfa" } }, |
---|
279 | "patterns": [ |
---|
280 | { "include": "#constant.string.content"} |
---|
281 | ] |
---|
282 | }, |
---|
283 | "constant.endline": { |
---|
284 | "name": "constant.character.escape.line-continuation.cfa", |
---|
285 | "match": "\\\\\\s*(//.*)?" |
---|
286 | } |
---|
287 | } |
---|
288 | }, |
---|
289 | "operators": { |
---|
290 | "patterns":[ |
---|
291 | { |
---|
292 | "name": "keyword.operator.declaration.cfa", |
---|
293 | "match": "\\?\\[\\?\\]|\\^\\?{}|\\?{}|\\?\\(\\)|\\?\\+\\+|\\?--|\\+\\+\\?|--\\?|\\*\\?|\\+\\?|\\-\\?|\\~\\?|\\!\\?|\\?\\\\=\\?|\\?\\\\\\?|\\?\\*=\\?|\\?\\*\\?|\\?/=\\?|\\?/\\?|\\?%=\\?|\\?%\\?|\\?\\+=\\?|\\?\\+\\?|\\?-=\\?|\\?-\\?|\\?<<=\\?|\\?<<\\?|\\?<=\\?|\\?<\\?|\\?>>=\\?|\\?>>\\?|\\?>=\\?|\\?>\\?|\\?==\\?|\\?\\!=\\?|\\?&=\\?|\\?&\\?|\\?\\^=\\?|\\?\\^\\?|\\?\\|=\\?|\\?\\|\\?|\\?=\\?" |
---|
294 | }, |
---|
295 | { |
---|
296 | "name": "keyword.operator.cfa", |
---|
297 | "match": "\\?|\\+\\+|--|\\~|\\!|\\=|\\\\|->|\\*=|\\*|/=|/|%=|%|\\+=|\\+|-=|-|<<=|<<|<=|<|>>=|>>|>=|>|==|\\!=|&&|&=|&|\\^=|\\^|\\|\\||\\|=|\\||=" |
---|
298 | } |
---|
299 | ] |
---|
300 | } |
---|
301 | } |
---|
302 | } |
---|