source: tools/vscode/uwaterloo.cforall-0.1.0/syntaxes/cfa.tmLanguage.json @ aa7a56e

ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since aa7a56e was aa7a56e, checked in by Thierry Delisle <tdelisle@…>, 4 years ago

Added declaration constants and operators, none particularly robust

  • Property mode set to 100644
File size: 8.6 KB
Line 
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(void|bool|char|short|int|long|signed|unsigned|float|double)", "name": "storage.type.built-in.primitive.cfa"},
207                                                        { "match": "\\b(zero_t|one_t|size_t|ssize_t|intptr_t|uintptr_t|\\$thread|\\$coroutine|\\$generator|\\$monitor)", "name": "storage.type.built-in.cfa"},
208                                                        { "match": "\\b(extern|static|inline|volatile|const|thread_local)", "name": "storage.modifier.cfa"}
209                                        ]
210                                },
211                                "declaration.aggregate": {
212                                        "name": "meta.block.struct.cfa",
213                                        "begin": "(struct|union|enum|trait|coroutine|generator|monitor|thread)\\s+(\\w+)\\s*(\\{)",
214                                        "end": "(\\})(\\s+\\w+;)?",
215                                        "beginCaptures": {
216                                                "0": { "name": "meta.head.struct.cfa" },
217                                                "1": { "name": "storage.type.struct.cfa"
218                                                }
219                                        },
220                                        "endCaptures": {
221                                                "1": { "name": "punctuation.section.block.end.bracket.curly.extern.cfa" }
222                                        },
223                                        "contentName": "meta.body.extern.cfa",
224                                        "patterns": [{ "include": "#declaration" }]
225                                }
226                        }
227                },
228                "constant": {
229                        "patterns": [
230                                {"include": "#constant.pointer"},
231                                {"include": "#constant.number"},
232                                {"include": "#constant.string"}
233                        ],
234                        "repository": {
235                                "constant.number": {
236                                        "patterns":[
237                                                {"name": "constant.numeric.binary.cfa", "match": "\\b0[b|B][_01\\.e]+(u?(hh|h|z|l\\d+|L\\d+|ll|l)u?)?"},
238                                                {"name": "constant.numeric.hexadecimal.cfa", "match": "\\b0[x|X][_\\dabcdefABCDEF\\.p]+(u?(hh|h|z|l\\d+|L\\d+|ll|l)u?)?"},
239                                                {"name": "constant.numeric.octal.cfa", "match": "\\b0[_0-7\\.]+(u?(hh|h|z|l\\d+|L\\d+|ll|l)u?)?"},
240                                                {"name": "constant.numeric.decimal.cfa", "match": "\\b[\\d\\.][_\\d\\.e\\+]*(u?(hh|h|z|l\\d+|L\\d+|ll|l)u?)?"}
241                                        ]
242                                },
243                                "constant.pointer": {
244                                        "patterns":[
245                                                {"name": "constant.language.binary.cfa", "match": "\\b0[b|B][_01]+p"},
246                                                {"name": "constant.language.hexadecimal.cfa", "match": "\\b0[x|X][_\\dabcdefABCDEF]+p"},
247                                                {"name": "constant.language.octal.cfa", "match": "\\b0[_0-7]+p"},
248                                                {"name": "constant.language.decimal.cfa", "match": "\\b[\\d][_\\d\\.e\\+]*p"}
249                                        ]
250                                }
251                        }
252                },
253                "operators": {
254                        "patterns":[
255                                {
256                                        "name": "keyword.operator.declaration.cfa",
257                                        "match": "\\?\\[\\?\\]|\\^\\?{}|\\?{}|\\?\\(\\)|\\?\\+\\+|\\?--|\\+\\+\\?|--\\?|\\*\\?|\\+\\?|\\-\\?|\\~\\?|\\!\\?|\\?\\\\=\\?|\\?\\\\\\?|\\?\\*=\\?|\\?\\*\\?|\\?/=\\?|\\?/\\?|\\?%=\\?|\\?%\\?|\\?\\+=\\?|\\?\\+\\?|\\?-=\\?|\\?-\\?|\\?<<=\\?|\\?<<\\?|\\?<=\\?|\\?<\\?|\\?>>=\\?|\\?>>\\?|\\?>=\\?|\\?>\\?|\\?==\\?|\\?\\!=\\?|\\?&=\\?|\\?&\\?|\\?\\^=\\?|\\?\\^\\?|\\?\\|=\\?|\\?\\|\\?|\\?=\\?"
258                                },
259                                {
260                                        "name": "keyword.operator.cfa",
261                                        "match": "\\?|\\+\\+|--|\\~|\\!|\\=|\\\\|\\*=|\\*|/=|/|%=|%|\\+=|\\+|-=|-|<<=|<<|<=|<|>>=|>>|>=|>|==|\\!=|&=|&|\\^=|\\^|\\|=|\\||="
262                                }
263                        ]
264                }
265        }
266}
Note: See TracBrowser for help on using the repository browser.