1{ 2 "name": "TableGen", 3 "fileTypes": [ 4 "td" 5 ], 6 "patterns": [ 7 { 8 "include": "#comments" 9 }, 10 { 11 "include": "#preprocessor" 12 }, 13 { 14 "include": "#strings" 15 }, 16 { 17 "include": "#integer" 18 }, 19 { 20 "include": "#builtin_types" 21 }, 22 { 23 "include": "#keywords" 24 }, 25 { 26 "include": "#classes" 27 }, 28 { 29 "include": "#defs" 30 }, 31 { 32 "include": "#values" 33 } 34 ], 35 "repository": { 36 "comments": { 37 "patterns": [ 38 { 39 "match": "\/\/.*$", 40 "name": "comment.line.double-slash.tablegen" 41 }, 42 { 43 "begin": "/\\*", 44 "end": "\\*/", 45 "captures": { 46 "0": { 47 "name": "comment.block.tablegen" 48 } 49 }, 50 "patterns": [ 51 { 52 "include": "#comments" 53 } 54 ], 55 "name": "comment.block.tablegen" 56 } 57 ] 58 }, 59 "preprocessor": { 60 "patterns": [ 61 { 62 "match": "^#ifdef\\s+(\\w+)", 63 "name": "keyword.control.ifdef.tablegen", 64 "captures": { 65 "1": { 66 "name": "entity.name.function.preprocessor.tablegen" 67 } 68 } 69 }, 70 { 71 "match": "^#ifndef\\s+(\\w+)", 72 "name": "keyword.control.ifndef.tablegen", 73 "captures": { 74 "1": { 75 "name": "entity.name.function.preprocessor.tablegen" 76 } 77 } 78 }, 79 { 80 "match": "^#else", 81 "name": "keyword.control.else.tablegen" 82 }, 83 { 84 "match": "#endif", 85 "name": "keyword.control.endif.tablegen" 86 }, 87 { 88 "match": "#define\\s+(\\w+)", 89 "name": "keyword.control.ifndef.tablegen", 90 "captures": { 91 "1": { 92 "name": "entity.name.function.preprocessor.tablegen" 93 } 94 } 95 }, 96 { 97 "match": "^include\\s+", 98 "name": "keyword.control.include.tablegen" 99 } 100 ] 101 }, 102 "strings": { 103 "patterns": [ 104 { 105 "name": "string.quoted.double.tablegen", 106 "begin": "\"", 107 "end": "\"", 108 "beginCaptures": { 109 "0": { 110 "name": "punctuation.definition.string.begin.tablegen" 111 } 112 }, 113 "patterns": [ 114 { 115 "match": "\\\\['nt\"]", 116 "name": "constant.character.escape.tablegen" 117 } 118 ], 119 "endCaptures": { 120 "0": { 121 "name": "punctuation.definition.string.end.tablegen" 122 } 123 } 124 }, 125 { 126 "name": "string.quoted.triple.tablegen", 127 "begin": "\\[{", 128 "end": "}]", 129 "beginCaptures": { 130 "0": { 131 "name": "punctuation.definition.string.begin.tablegen" 132 } 133 }, 134 "patterns": [ 135 { 136 "match": "\\\\[nt\"]", 137 "name": "constant.character.escape.tablegen" 138 } 139 ], 140 "endCaptures": { 141 "0": { 142 "name": "punctuation.definition.string.end.tablegen" 143 } 144 } 145 } 146 ] 147 }, 148 "integer": { 149 "patterns": [ 150 { 151 "match": "\\b\\d+\\b", 152 "name": "constant.numeric.tablegen" 153 }, 154 { 155 "match": "\\b0[xX][a-fA-F0-9]+\\b", 156 "name": "constant.numeric.hex.tablegen" 157 }, 158 { 159 "match": "\\b0b[01]+\\b", 160 "name": "constant.numeric.binary.tablegen" 161 } 162 ] 163 }, 164 "builtin_types": { 165 "patterns": [ 166 { 167 "match": "\\b(?:bit|code|dag|int|string)\\b", 168 "name": "entity.name.type.tablegen" 169 }, 170 { 171 "begin": "\\b(bits)\\<", 172 "beginCaptures": { 173 "1": { 174 "name": "entity.name.type.tablegen" 175 } 176 }, 177 "patterns": [ 178 { 179 "include": "#integer" 180 } 181 ], 182 "end": "\\>" 183 }, 184 { 185 "begin": "\\b(list)\\<", 186 "beginCaptures": { 187 "1": { 188 "name": "entity.name.type.tablegen" 189 } 190 }, 191 "patterns": [ 192 { 193 "include": "#types" 194 } 195 ], 196 "end": "\\>" 197 } 198 ] 199 }, 200 "types": { 201 "patterns": [ 202 { 203 "include": "#builtin_types" 204 }, 205 { 206 "match": "\\b(\\w+)\\b", 207 "name": "entity.name.type.tablegen" 208 } 209 ] 210 }, 211 "bang_operators": { 212 "patterns": [ 213 { 214 "begin": "(\\!cast|\\!getdagop|\\!isa)\\<", 215 "beginCaptures": { 216 "1": { 217 "name": "entity.name.function" 218 } 219 }, 220 "patterns": [ 221 { 222 "include": "#types" 223 } 224 ], 225 "end": "\\>" 226 }, 227 { 228 "match": "(\\!\\w+)\\b", 229 "name": "entity.name.function" 230 } 231 ] 232 }, 233 "keywords": { 234 "patterns": [ 235 { 236 "match": "\\b(assert|else|foreach|defset|defvar|field|if|in|let|then)\\b", 237 "name": "keyword.other.tablegen" 238 } 239 ] 240 }, 241 "record_body": { 242 "patterns": [ 243 { 244 "begin": "\\:", 245 "patterns": [ 246 { 247 "match": "\\b(\\w+)\\b", 248 "name": "entity.name.type.tablegen" 249 }, 250 { 251 "begin": "\\<", 252 "patterns": [ 253 { 254 "include": "#values" 255 } 256 ], 257 "end": "\\>" 258 } 259 ], 260 "end": "(?=\\;|\\{)" 261 }, 262 { 263 "begin": "\\{", 264 "patterns": [ 265 { 266 "include": "#keywords" 267 }, 268 { 269 "include": "#builtin_types" 270 }, 271 { 272 "match": "\\b(\\w+\\s+)?\\b(\\w+)\\b\\s+\\=", 273 "captures": { 274 "1": { 275 "name": "entity.name.type.tablegen" 276 }, 277 "2": { 278 "name": "variable.other.tablegen" 279 } 280 } 281 }, 282 { 283 "include": "#values" 284 } 285 ], 286 "end": "(?=\\})" 287 } 288 ] 289 }, 290 "classes": { 291 "begin": "\\b(multiclass|class)\\b\\s+(\\w+)\\b", 292 "beginCaptures": { 293 "1": { 294 "name": "keyword.other.class.tablegen" 295 }, 296 "2": { 297 "name": "entity.name.type.tablegen" 298 } 299 }, 300 "patterns": [ 301 { 302 "begin": "\\<", 303 "patterns": [ 304 { 305 "include": "#builtin_types" 306 }, 307 { 308 "match": "\\b(\\w+\\s+)?\\b(\\w+)\\b", 309 "captures": { 310 "1": { 311 "name": "entity.name.type.tablegen" 312 }, 313 "2": { 314 "name": "variable.other.tablegen" 315 } 316 } 317 }, 318 { 319 "begin": "=", 320 "patterns": [ 321 { 322 "include": "#values" 323 } 324 ], 325 "end": "(?=\\>|\\,)" 326 } 327 ], 328 "end": "\\>" 329 }, 330 { 331 "include": "#record_body" 332 } 333 ], 334 "end": "(\\;|\\})" 335 }, 336 "defs": { 337 "begin": "\\b(defm|def)\\b", 338 "beginCaptures": { 339 "1": { 340 "name": "keyword.other.def.tablegen" 341 } 342 }, 343 "patterns": [ 344 { 345 "include": "#record_body" 346 }, 347 { 348 "include": "#values" 349 } 350 ], 351 "end": "(\\;|\\})" 352 }, 353 "values": { 354 "patterns": [ 355 { 356 "include": "#builtin_types" 357 }, 358 { 359 "include": "#bang_operators" 360 }, 361 { 362 "include": "#classes" 363 }, 364 { 365 "include": "#defs" 366 }, 367 { 368 "include": "#comments" 369 }, 370 { 371 "include": "#integer" 372 }, 373 { 374 "include": "#strings" 375 }, 376 { 377 "match": "\\b(?:false|true)\\b", 378 "name": "keyword.other.tablegen" 379 }, 380 { 381 "match": "(\\?)", 382 "name": "keyword.other.tablegen" 383 }, 384 { 385 "begin": "\\{", 386 "patterns": [ 387 { 388 "include": "#values" 389 } 390 ], 391 "end": "\\}" 392 }, 393 { 394 "begin": "\\[", 395 "patterns": [ 396 { 397 "include": "#values" 398 } 399 ], 400 "end": "(?=\\])" 401 }, 402 { 403 "begin": "\\]\\s*\\<", 404 "patterns": [ 405 { 406 "include": "#types" 407 } 408 ], 409 "end": "\\>" 410 }, 411 { 412 "begin": "\\(", 413 "patterns": [ 414 { 415 "include": "#values" 416 } 417 ], 418 "end": "\\)" 419 }, 420 { 421 "include": "#keywords" 422 }, 423 { 424 "begin": "\\b(\\w+)\\<", 425 "beginCaptures": { 426 "1": { 427 "name": "entity.name.type.tablegen" 428 } 429 }, 430 "patterns": [ 431 { 432 "include": "#values" 433 } 434 ], 435 "end": "\\>" 436 }, 437 { 438 "match": "(\\$\\w+)\\b", 439 "name": "variable.other.enummember.tablegen" 440 }, 441 { 442 "match": "\\b(\\w+)\\b", 443 "name": "variable.other.tablegen" 444 }, 445 { 446 "include": "#preprocessor" 447 } 448 ] 449 } 450 }, 451 "scopeName": "source.tablegen" 452}