398 lines · json
1{2 "name": "MLIR",3 "fileTypes": [4 "mlir"5 ],6 "patterns": [7 {8 "include": "#comment"9 },10 {11 "include": "#string"12 },13 {14 "include": "#top_level_entity"15 }16 ],17 "repository": {18 "comment": {19 "match": "\/\/.*$",20 "name": "comment.line.double-slash.mlir"21 },22 "number": {23 "patterns": [24 {25 "match": "(\\W)?([0-9]+\\.[0-9]*)([eE][+-]?[0-9]+)?",26 "name": "constant.numeric.mlir"27 },28 {29 "match": "([\\W])?(0x[0-9a-zA-Z]+)",30 "captures": {31 "2": {32 "name": "constant.numeric.mlir"33 }34 }35 },36 {37 "match": "([\\Wx])?([0-9]+)",38 "captures": {39 "2": {40 "name": "constant.numeric.mlir"41 }42 }43 }44 ]45 },46 "string": {47 "begin": "\"",48 "beginCaptures": {49 "0": {50 "name": "punctuation.definition.string.begin.mlir"51 }52 },53 "patterns": [54 {55 "match": "\\\\[nt\"]",56 "name": "constant.character.escape.mlir"57 }58 ],59 "end": "\"",60 "endCaptures": {61 "0": {62 "name": "punctuation.definition.string.end.mlir"63 }64 },65 "name": "string.quoted.double.mlir"66 },67 "top_level_entity": {68 "patterns": [69 {70 "include": "#attribute_alias_def"71 },72 {73 "include": "#type_alias_def"74 },75 {76 "include": "#operation_body"77 }78 ]79 },80 "attribute_alias_def": {81 "match": "^\\s*(\\#\\w+)\\b\\s+\\=",82 "captures": {83 "1": {84 "name": "constant.language.mlir"85 }86 }87 },88 "type_alias_def": {89 "match": "^\\s*(\\!\\w+)\\b\\s+\\=",90 "captures": {91 "1": {92 "name": "entity.name.type.mlir"93 }94 }95 },96 "operation": {97 "patterns": [98 {99 "match": "^\\s*(\\%[\\%\\w\\:\\,\\s]+)\\s+\\=\\s+([\\w\\.\\$\\-]+)\\b",100 "captures": {101 "1": {102 "patterns": [103 {104 "include": "#ssa_value"105 }106 ]107 },108 "2": {109 "name": "variable.other.enummember.mlir"110 }111 }112 },113 {114 "match": "^\\s*([\\w\\.\\$\\-]+)\\b(?=[^\\<\\:])",115 "name": "variable.other.enummember.mlir"116 }117 ]118 },119 "operation_body": {120 "patterns": [121 {122 "include": "#operation"123 },124 {125 "include": "#region_body_or_attr_dict"126 },127 {128 "include": "#comment"129 },130 {131 "include": "#ssa_value"132 },133 {134 "include": "#block"135 },136 {137 "include": "#attribute_value"138 },139 {140 "include": "#bare_identifier"141 }142 ]143 },144 "region_body_or_attr_dict": {145 "patterns": [146 {147 "begin": "\\{\\s*(?=\\%|\\/|\\^)",148 "patterns": [149 {150 "include": "#operation_body"151 }152 ],153 "end": "\\}"154 },155 {156 "begin": "\\{\\s*(?=[^\\}]*$)",157 "patterns": [158 {159 "include": "#operation_body"160 }161 ],162 "end": "\\}"163 },164 {165 "begin": "\\{\\s*(?=\\%)",166 "patterns": [167 {168 "include": "#operation_body"169 }170 ],171 "end": "\\}"172 },173 {174 "begin": "\\{\\s*(?=.*$)",175 "patterns": [176 {177 "include": "#attribute_dictionary_body"178 }179 ],180 "end": "\\}"181 }182 ]183 },184 "attribute_value": {185 "patterns": [186 {187 "include": "#string"188 },189 {190 "include": "#comment"191 },192 {193 "include": "#number"194 },195 {196 "match": "\\b(false|true|unit)\\b",197 "name": "constant.language.mlir"198 },199 {200 "begin": "\\b(affine_map|affine_set)\\s*\\<",201 "beginCaptures": {202 "1": {203 "name": "constant.language.mlir"204 }205 },206 "patterns": [207 {208 "match": "\\b(ceildiv|floordiv|mod|symbol)\\b",209 "name": "entity.name.function.mlir"210 },211 {212 "match": "\\b([\\w\\.\\$\\-]+)\\b",213 "name": "variable.mlir"214 },215 {216 "include": "#number"217 }218 ],219 "end": "\\)\\>"220 },221 {222 "begin": "\\b(dense|opaque|sparse)\\s*\\<",223 "beginCaptures": {224 "1": {225 "name": "constant.language.mlir"226 }227 },228 "patterns": [229 {230 "include": "#attribute_value"231 }232 ],233 "end": "\\>"234 },235 {236 "begin": "\\[",237 "patterns": [238 {239 "include": "#attribute_value"240 },241 {242 "include": "#operation_body"243 }244 ],245 "end": "\\]"246 },247 {248 "begin": "\\{",249 "patterns": [250 {251 "include": "#attribute_dictionary_body"252 }253 ],254 "end": "\\}"255 },256 {257 "match": "(\\@[\\w+\\$\\-\\.]*)",258 "name": "entity.name.function.mlir"259 },260 {261 "begin": "(\\#[\\w\\$\\-\\.]+)\\<",262 "beginCaptures": {263 "1": {264 "name": "constant.language.mlir"265 }266 },267 "patterns": [268 {269 "include": "#attribute_value"270 },271 {272 "match": "\\-\\>|\\>\\="273 },274 {275 "include": "#bare_identifier"276 }277 ],278 "end": "\\>"279 },280 {281 "match": "\\#[\\w\\$\\-\\.]+\\b",282 "name": "constant.language.mlir"283 },284 {285 "include": "#type_value"286 },287 {288 "begin": "\\<",289 "patterns": [290 {291 "include": "#attribute_value"292 },293 {294 "include": "#bare_identifier"295 }296 ],297 "end": "\\>"298 }299 ]300 },301 "attribute_dictionary_body": {302 "patterns": [303 {304 "include": "#comment"305 },306 {307 "include": "#string"308 },309 {310 "include": "#attribute_value"311 },312 {313 "match": "(\\%)?\\b([\\w\\.\\-\\$\\:0-9]+)\\b\\s*(?=\\=|\\,|\\})",314 "name": "variable.other.mlir"315 }316 ]317 },318 "type_value": {319 "patterns": [320 {321 "begin": "(\\![\\w\\$\\-\\.]+)\\<",322 "beginCaptures": {323 "1": {324 "name": "entity.name.type.mlir"325 }326 },327 "patterns": [328 {329 "include": "#attribute_value"330 },331 {332 "match": "\\-\\>|\\>\\=",333 "name": "punctuation.other.mlir"334 },335 {336 "include": "#bare_identifier"337 }338 ],339 "end": "\\>"340 },341 {342 "match": "\\![\\w\\$\\-\\.]+\\b",343 "name": "entity.name.type.mlir"344 },345 {346 "begin": "(complex|memref|tensor|tuple|vector)\\<",347 "beginCaptures": {348 "1": {349 "name": "entity.name.type.mlir"350 }351 },352 "patterns": [353 {354 "match": "[\\?x0-9\\[\\]]+",355 "captures": {356 "0": {357 "patterns": [358 {359 "include": "#number"360 }361 ]362 }363 }364 },365 {366 "include": "#attribute_value"367 },368 {369 "match": "\\-\\>|\\>\\=",370 "name": "punctuation.other.mlir"371 },372 {373 "include": "#bare_identifier"374 }375 ],376 "end": "\\>"377 },378 {379 "match": "bf16|f16|f32|f64|f80|f128|index|none|(u|s)?i[0-9]+",380 "name": "entity.name.type.mlir"381 }382 ]383 },384 "bare_identifier": {385 "match": "\\b([\\w\\.\\$\\-]+)\\b",386 "name": "keyword.other.mlir"387 },388 "ssa_value": {389 "match": "\\%[\\w\\.\\$\\:\\#]+",390 "name": "variable.other.mlir"391 },392 "block": {393 "match": "\\^[\\w\\d_$\\.-]+",394 "name": "keyword.control.mlir"395 }396 },397 "scopeName": "source.mlir"398}