OR-1 dataflow CPU sketch
1{
2 "scopeName": "source.dfasm",
3 "name": "dfasm",
4 "fileTypes": [
5 "dfasm"
6 ],
7 "patterns": [
8 {
9 "match": "(@)([a-zA-Z_][a-zA-Z0-9_]*)(?:(\\|)([a-zA-Z_][a-zA-Z0-9_]*))?(?:(:)([a-zA-Z_][a-zA-Z0-9_]*|0x[0-9a-fA-F]+|[0-9]+))?",
10 "captures": {
11 "1": {
12 "name": "punctuation.definition.reference.node.dfasm"
13 },
14 "2": {
15 "name": "entity.name.type.node.dfasm"
16 },
17 "3": {
18 "name": "punctuation.separator.placement.dfasm"
19 },
20 "4": {
21 "name": "entity.other.attribute-name.placement.dfasm"
22 },
23 "5": {
24 "name": "punctuation.separator.port.dfasm"
25 },
26 "6": {
27 "name": "constant.numeric.dfasm"
28 }
29 }
30 },
31 {
32 "match": "(\\&)([a-zA-Z_][a-zA-Z0-9_]*)(?:(\\|)([a-zA-Z_][a-zA-Z0-9_]*))?(?:(:)([a-zA-Z_][a-zA-Z0-9_]*|0x[0-9a-fA-F]+|[0-9]+))?",
33 "captures": {
34 "1": {
35 "name": "punctuation.definition.reference.label.dfasm"
36 },
37 "2": {
38 "name": "entity.name.function.label.dfasm"
39 },
40 "3": {
41 "name": "punctuation.separator.placement.dfasm"
42 },
43 "4": {
44 "name": "entity.other.attribute-name.placement.dfasm"
45 },
46 "5": {
47 "name": "punctuation.separator.port.dfasm"
48 },
49 "6": {
50 "name": "constant.numeric.dfasm"
51 }
52 }
53 },
54 {
55 "match": "(\\$)([a-zA-Z_][a-zA-Z0-9_]*)(?:(\\|)([a-zA-Z_][a-zA-Z0-9_]*))?(?:(:)([a-zA-Z_][a-zA-Z0-9_]*|0x[0-9a-fA-F]+|[0-9]+))?",
56 "captures": {
57 "1": {
58 "name": "punctuation.definition.reference.function.dfasm"
59 },
60 "2": {
61 "name": "entity.name.type.function.dfasm"
62 },
63 "3": {
64 "name": "punctuation.separator.placement.dfasm"
65 },
66 "4": {
67 "name": "entity.other.attribute-name.placement.dfasm"
68 },
69 "5": {
70 "name": "punctuation.separator.port.dfasm"
71 },
72 "6": {
73 "name": "constant.numeric.dfasm"
74 }
75 }
76 },
77 {
78 "match": ";.*$",
79 "name": "comment.line.semicolon.dfasm"
80 },
81 {
82 "match": "@system\\b",
83 "name": "variable.language.pragma.dfasm"
84 },
85 {
86 "match": "\\|>",
87 "name": "keyword.operator.flow.out.dfasm"
88 },
89 {
90 "match": "<\\|",
91 "name": "keyword.operator.flow.in.dfasm"
92 },
93 {
94 "match": "\\b(?:(?:add|sub|inc|dec|shiftl|shiftr|ashiftr|and|or|xor|not|eq|lt|lte|gt|gte|breq|brgt|brge|brof|brty|sweq|swgt|swge|swof|swty|gate|sel|merge|pass|const|free_ctx|read|write|clear|alloc|free|rd_inc|rd_dec|cmp_sw|ior|iow|iorw|load_inst|route_set))\\b",
95 "name": "support.function.opcode.dfasm"
96 },
97 {
98 "match": "(#)((?:[a-zA-Z_][a-zA-Z0-9_]*))",
99 "captures": {
100 "1": {
101 "name": "punctuation.definition.macro.dfasm"
102 },
103 "2": {
104 "name": "entity.name.function.macro.dfasm"
105 }
106 }
107 },
108 {
109 "begin": "r\"",
110 "beginCaptures": {
111 "0": {
112 "name": "string.quoted.double.raw.dfasm"
113 }
114 },
115 "end": "\"",
116 "endCaptures": {
117 "0": {
118 "name": "string.quoted.double.raw.dfasm"
119 }
120 },
121 "name": "string.quoted.double.raw.dfasm"
122 },
123 {
124 "begin": "b\"",
125 "beginCaptures": {
126 "0": {
127 "name": "string.quoted.double.byte.dfasm"
128 }
129 },
130 "end": "\"",
131 "endCaptures": {
132 "0": {
133 "name": "string.quoted.double.byte.dfasm"
134 }
135 },
136 "name": "string.quoted.double.byte.dfasm",
137 "patterns": [
138 {
139 "match": "\\\\[ntr0\\\\\\\\\\'\\\"]",
140 "name": "constant.character.escape.dfasm"
141 },
142 {
143 "match": "\\\\x[0-9a-fA-F]{2}",
144 "name": "constant.character.escape.dfasm"
145 }
146 ]
147 },
148 {
149 "begin": "\"",
150 "beginCaptures": {
151 "0": {
152 "name": "string.quoted.double.dfasm"
153 }
154 },
155 "end": "\"",
156 "endCaptures": {
157 "0": {
158 "name": "string.quoted.double.dfasm"
159 }
160 },
161 "name": "string.quoted.double.dfasm",
162 "patterns": [
163 {
164 "match": "\\\\[ntr0\\\\\\\\\\'\\\"]",
165 "name": "constant.character.escape.dfasm"
166 },
167 {
168 "match": "\\\\x[0-9a-fA-F]{2}",
169 "name": "constant.character.escape.dfasm"
170 }
171 ]
172 },
173 {
174 "begin": "'",
175 "beginCaptures": {
176 "0": {
177 "name": "string.quoted.single.dfasm"
178 }
179 },
180 "end": "'",
181 "endCaptures": {
182 "0": {
183 "name": "string.quoted.single.dfasm"
184 }
185 },
186 "name": "string.quoted.single.dfasm",
187 "patterns": [
188 {
189 "match": "\\\\[ntr0\\\\\\\\\\'\\\"]",
190 "name": "constant.character.escape.dfasm"
191 },
192 {
193 "match": "\\\\x[0-9a-fA-F]{2}",
194 "name": "constant.character.escape.dfasm"
195 }
196 ]
197 },
198 {
199 "match": "(?:0x[0-9a-fA-F]+)",
200 "name": "constant.numeric.dfasm"
201 },
202 {
203 "match": "(?:[0-9]+)",
204 "name": "constant.numeric.dfasm"
205 },
206 {
207 "match": "((?:[a-zA-Z_][a-zA-Z0-9_]*))(=)",
208 "captures": {
209 "1": {
210 "name": "entity.other.attribute-name.dfasm"
211 }
212 }
213 },
214 {
215 "match": "="
216 },
217 {
218 "match": ",",
219 "name": "punctuation.separator.dfasm"
220 },
221 {
222 "begin": "\\{",
223 "beginCaptures": {
224 "0": {
225 "name": "punctuation.section.block.dfasm"
226 }
227 },
228 "end": "\\}",
229 "endCaptures": {
230 "0": {
231 "name": "punctuation.section.block.dfasm"
232 }
233 },
234 "name": "meta.function.body.dfasm",
235 "patterns": [
236 {
237 "include": "$self"
238 }
239 ]
240 },
241 {
242 "match": "\\}",
243 "name": "punctuation.section.block.dfasm"
244 },
245 {
246 "match": "\\|(?!>)",
247 "name": "punctuation.separator.placement.dfasm"
248 },
249 {
250 "match": ":",
251 "name": "punctuation.separator.port.dfasm"
252 },
253 {
254 "match": "\\s+"
255 }
256 ],
257 "repository": {}
258}