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

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

First draft at custom language, currently working : comments, preprocessor and extern C

  • Property mode set to 100644
File size: 5.2 KB
Line 
1{
2        "scopeName": "source.cfa",
3        "patterns": [
4                { "include": "#comments"},
5                { "include": "#preprocessor"},
6                { "include": "#extern"},
7                { "include": "#test"}
8        ],
9        "repository": {
10                "directive.punctuation": {
11                        "match": "#",
12                        "name": "punctuation.definition.directive.cfa"
13                },
14                "directive.pragma": {
15                        "name": "meta.preprocessor.pragma.cfa",
16                        "match": "^\\s*(#\\s*pragma)\\s+(((?!//|/\\*).)*)",
17                        "captures":{
18                                "1": {
19                                        "name": "keyword.control.directive.pragma.cfa",
20                                        "patterns":[{ "include": "#directive.punctuation"} ]
21                                },
22                                "2": {"name": "keyword.control.directive.pragma.argument.cfa"}
23                        }
24                },
25                "directive.include.string": {
26                        "begin": "<|\"",
27                        "end": ">|\"",
28                        "beginCaptures": {
29                                "0": { "name": "punctuation.definition.string.begin.cfa" }
30                        },
31                        "endCaptures": {
32                                "0": { "name": "punctuation.definition.string.end.cfa" }
33                        },
34                        "name": "string.quoted.include.cfa"
35                },
36                "directive.include": {
37                        "name": "meta.preprocessor.include.cfa",
38                        "match": "^\\s*(#\\s*include)\\s+(<.*>|\".*\")",
39                        "captures": {
40                                "1": {
41                                        "name": "keyword.control.directive.include.cfa",
42                                        "patterns":[{ "include": "#directive.punctuation"} ]
43                                },
44                                "2": {"patterns": [{ "include": "#directive.include.string"}]}
45                        }
46                },
47                "directive.macro.name": {
48                        "name": "entity.name.function.preprocessor.cfa",
49                        "match": "[A-z0-9_]+"
50                },
51                "directive.define": {
52                        "name": "meta.preprocessor.macro.cfa",
53                        "match": "^\\s*(#\\s*define)\\s+([A-z0-9_]+)(\\(.*\\))?\\s+(.*)?",
54                        "captures": {
55                                "1": {
56                                        "name": "keyword.control.directive.define.cfa",
57                                        "patterns":[{ "include": "#directive.punctuation"} ]
58                                },
59                                "2": {"patterns": [{ "include": "#directive.macro.name"}]},
60                                "3": {"name":"meta.define.C"},
61                                "4": {"name":"meta.define.D"}
62                        }
63                },
64                "directive.undef": {
65                        "name": "meta.preprocessor.macro.cfa",
66                        "match": "^\\s*(#\\s*undef)\\s+([A-z0-9_]+)",
67                        "captures": {
68                                "1": {
69                                        "name": "keyword.control.directive.undef.cfa",
70                                        "patterns":[{ "include": "#directive.punctuation"} ]
71                                },
72                                "2": {"name":"meta.define.B", "patterns": [{ "include": "#directive.macro.name"}]}
73                        }
74                },
75                "directive.isdef": {
76                        "match": "(defined)\\s*\\(\\s*([A-z0-9_]+)\\s*\\)",
77                        "captures": {
78                                "1": {
79                                        "name": "keyword.control.directive.conditional.cfa",
80                                        "match": "defined"
81                                },
82                                "2": {"patterns": [{ "include": "#directive.macro.name"}]}
83                        }
84                },
85                "directive.ifdef": {
86                        "name": "meta.preprocessor.cfa",
87                        "match": "^\\s*(#\\s*ifdef)\\s+([A-z0-9_]+)",
88                        "captures": {
89                                "1": {
90                                        "name": "keyword.control.directive.conditional.cfa",
91                                        "patterns":[{ "include": "#directive.punctuation"} ]
92                                },
93                                "2": {"patterns": [{ "include": "#directive.macro.name"}]}
94                        }
95                },
96                "directive.condition.arg": {
97                        "name": "meta.preprocessor.cfa",
98                        "match": "^\\s*(#\\s*if|#\\s*elif)\\s+(.*)",
99                        "captures": {
100                                "1": {
101                                        "name": "keyword.control.directive.conditional.cfa",
102                                        "patterns":[{ "include": "#directive.punctuation"} ]
103                                },
104                                "2": {"patterns":[
105                                        { "include": "#expression"},
106                                        { "include": "#directive.isdef"}
107                                ]}
108                        }
109                },
110                "directive.condition.noargs": {
111                        "name": "meta.preprocessor.cfa",
112                        "match": "^\\s*(#\\s*endif|#\\s*else)\\s+",
113                        "captures": {
114                                "1": {
115                                        "name": "keyword.control.directive.conditional.cfa",
116                                        "patterns":[{ "include": "#directive.punctuation"} ]
117                                }
118                        }
119                },
120                "preprocessor": {
121                        "patterns":[
122                                { "include": "#directive.pragma" },
123                                { "include": "#directive.include" },
124                                { "include": "#directive.define" },
125                                { "include": "#directive.undef" },
126                                { "include": "#directive.ifdef" },
127                                { "include": "#directive.condition.arg" },
128                                { "include": "#directive.condition.noargs" }
129                        ]
130                },
131                "comments.line":{
132                        "name": "comment.line.double-slash.cfa",
133                        "match": "(\/\/).*",
134                        "captures": {
135                                "1": {"name": "punctuation.definition.comment.c", "match": "\/\/"}
136                        }
137                },
138                "comments.block":{
139                        "name": "comment.block.cfa",
140                        "begin": "/\\*",
141                        "end": "\\*/",
142                        "beginCaptures": {
143                                "0": { "name": "punctuation.definition.comment.begin.cfa" }
144                        },
145                        "endCaptures": {
146                                "0": { "name": "punctuation.definition.comment.end.cfa" }
147                        }
148                },
149                "comments": {
150                        "patterns":[
151                                { "include": "#comments.line"},
152                                { "include": "#comments.block"}
153                        ]
154                },
155                "extern.head.string": {
156                        "begin": "\"",
157                        "end": "\"",
158                        "beginCaptures": {
159                                "0": { "name": "punctuation.definition.string.begin.cfa" }
160                        },
161                        "endCaptures": {
162                                "0": { "name": "punctuation.definition.string.end.cfa" }
163                        },
164                        "name": "string.quoted.extern.cfa"
165                },
166                "extern.head": {
167                        "match": "(extern)\\s+(.*)\\s+(\\{)",
168                        "captures": {
169                                "1": { "name": "storage.modifier.cfa" },
170                                "2": { "patterns":[{ "include": "#extern.head.string"}] },
171                                "3": { "name": "punctuation.section.block.begin.bracket.curly.extern.cfa" }
172                        }
173                },
174                "extern": {
175                        "name": "meta.block.extern.cfa",
176                        "begin": "(extern\\s+.*\\s+\\{)",
177                        "end": "(\\})",
178                        "beginCaptures": {
179                                "0": { "name": "meta.head.extern.cfa", "patterns":[{ "include": "#extern.head" }] }
180                        },
181                        "endCaptures": {
182                                "0": { "name": "punctuation.section.block.end.bracket.curly.extern.cfa" }
183                        },
184                        "contentName": "meta.body.extern.cfa",
185                        "patterns": [{ "include": "$self" }]
186                }
187        }
188}
Note: See TracBrowser for help on using the repository browser.