forked from OSchip/llvm-project
398 lines
8.6 KiB
JSON
398 lines
8.6 KiB
JSON
{
|
|
"name": "MLIR",
|
|
"fileTypes": [
|
|
"mlir"
|
|
],
|
|
"patterns": [
|
|
{
|
|
"include": "#comment"
|
|
},
|
|
{
|
|
"include": "#string"
|
|
},
|
|
{
|
|
"include": "#top_level_entity"
|
|
}
|
|
],
|
|
"repository": {
|
|
"comment": {
|
|
"match": "\/\/.*$",
|
|
"name": "comment.line.double-slash.mlir"
|
|
},
|
|
"number": {
|
|
"patterns": [
|
|
{
|
|
"match": "(\\W)?([0-9]+\\.[0-9]*)([eE][+-]?[0-9]+)?",
|
|
"name": "constant.numeric.mlir"
|
|
},
|
|
{
|
|
"match": "([\\W])?(0x[0-9a-zA-Z]+)",
|
|
"captures": {
|
|
"2": {
|
|
"name": "constant.numeric.mlir"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"match": "([\\Wx])?([0-9]+)",
|
|
"captures": {
|
|
"2": {
|
|
"name": "constant.numeric.mlir"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"string": {
|
|
"begin": "\"",
|
|
"beginCaptures": {
|
|
"0": {
|
|
"name": "punctuation.definition.string.begin.mlir"
|
|
}
|
|
},
|
|
"patterns": [
|
|
{
|
|
"match": "\\\\[nt\"]",
|
|
"name": "constant.character.escape.mlir"
|
|
}
|
|
],
|
|
"end": "\"",
|
|
"endCaptures": {
|
|
"0": {
|
|
"name": "punctuation.definition.string.end.mlir"
|
|
}
|
|
},
|
|
"name": "string.quoted.double.mlir"
|
|
},
|
|
"top_level_entity": {
|
|
"patterns": [
|
|
{
|
|
"include": "#attribute_alias_def"
|
|
},
|
|
{
|
|
"include": "#type_alias_def"
|
|
},
|
|
{
|
|
"include": "#operation_body"
|
|
}
|
|
]
|
|
},
|
|
"attribute_alias_def": {
|
|
"match": "^\\s*(\\#\\w+)\\b\\s+\\=",
|
|
"captures": {
|
|
"1": {
|
|
"name": "constant.language.mlir"
|
|
}
|
|
}
|
|
},
|
|
"type_alias_def": {
|
|
"match": "^\\s*(\\!\\w+)\\b\\s+\\=",
|
|
"captures": {
|
|
"1": {
|
|
"name": "entity.name.type.mlir"
|
|
}
|
|
}
|
|
},
|
|
"operation": {
|
|
"patterns": [
|
|
{
|
|
"match": "^\\s*(\\%[\\%\\w\\:\\,\\s]+)\\s+\\=\\s+([\\w\\.\\$\\-]+)\\b",
|
|
"captures": {
|
|
"1": {
|
|
"patterns": [
|
|
{
|
|
"include": "#ssa_value"
|
|
}
|
|
]
|
|
},
|
|
"2": {
|
|
"name": "variable.other.enummember.mlir"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"match": "^\\s*([\\w\\.\\$\\-]+)\\b(?=[^\\<\\:])",
|
|
"name": "variable.other.enummember.mlir"
|
|
}
|
|
]
|
|
},
|
|
"operation_body": {
|
|
"patterns": [
|
|
{
|
|
"include": "#operation"
|
|
},
|
|
{
|
|
"include": "#region_body_or_attr_dict"
|
|
},
|
|
{
|
|
"include": "#comment"
|
|
},
|
|
{
|
|
"include": "#ssa_value"
|
|
},
|
|
{
|
|
"include": "#block"
|
|
},
|
|
{
|
|
"include": "#attribute_value"
|
|
},
|
|
{
|
|
"include": "#bare_identifier"
|
|
}
|
|
]
|
|
},
|
|
"region_body_or_attr_dict": {
|
|
"patterns": [
|
|
{
|
|
"begin": "\\{\\s*(?=\\%|\\/|\\^)",
|
|
"patterns": [
|
|
{
|
|
"include": "#operation_body"
|
|
}
|
|
],
|
|
"end": "\\}"
|
|
},
|
|
{
|
|
"begin": "\\{\\s*(?=[^\\}]*$)",
|
|
"patterns": [
|
|
{
|
|
"include": "#operation_body"
|
|
}
|
|
],
|
|
"end": "\\}"
|
|
},
|
|
{
|
|
"begin": "\\{\\s*(?=\\%)",
|
|
"patterns": [
|
|
{
|
|
"include": "#operation_body"
|
|
}
|
|
],
|
|
"end": "\\}"
|
|
},
|
|
{
|
|
"begin": "\\{\\s*(?=.*$)",
|
|
"patterns": [
|
|
{
|
|
"include": "#attribute_dictionary_body"
|
|
}
|
|
],
|
|
"end": "\\}"
|
|
}
|
|
]
|
|
},
|
|
"attribute_value": {
|
|
"patterns": [
|
|
{
|
|
"include": "#string"
|
|
},
|
|
{
|
|
"include": "#comment"
|
|
},
|
|
{
|
|
"include": "#number"
|
|
},
|
|
{
|
|
"match": "\\b(false|true|unit)\\b",
|
|
"name": "constant.language.mlir"
|
|
},
|
|
{
|
|
"begin": "\\b(affine_map|affine_set)\\s*\\<",
|
|
"beginCaptures": {
|
|
"1": {
|
|
"name": "constant.language.mlir"
|
|
}
|
|
},
|
|
"patterns": [
|
|
{
|
|
"match": "\\b(ceildiv|floordiv|mod|symbol)\\b",
|
|
"name": "entity.name.function.mlir"
|
|
},
|
|
{
|
|
"match": "\\b([\\w\\.\\$\\-]+)\\b",
|
|
"name": "variable.mlir"
|
|
},
|
|
{
|
|
"include": "#number"
|
|
}
|
|
],
|
|
"end": "\\)\\>"
|
|
},
|
|
{
|
|
"begin": "\\b(dense|opaque|sparse)\\s*\\<",
|
|
"beginCaptures": {
|
|
"1": {
|
|
"name": "constant.language.mlir"
|
|
}
|
|
},
|
|
"patterns": [
|
|
{
|
|
"include": "#attribute_value"
|
|
}
|
|
],
|
|
"end": "\\>"
|
|
},
|
|
{
|
|
"begin": "\\[",
|
|
"patterns": [
|
|
{
|
|
"include": "#attribute_value"
|
|
},
|
|
{
|
|
"include": "#operation_body"
|
|
}
|
|
],
|
|
"end": "\\]"
|
|
},
|
|
{
|
|
"begin": "\\{",
|
|
"patterns": [
|
|
{
|
|
"include": "#attribute_dictionary_body"
|
|
}
|
|
],
|
|
"end": "\\}"
|
|
},
|
|
{
|
|
"match": "(\\@[\\w+\\$\\-\\.]*)",
|
|
"name": "entity.name.function.mlir"
|
|
},
|
|
{
|
|
"begin": "(\\#[\\w\\$\\-\\.]+)\\<",
|
|
"beginCaptures": {
|
|
"1": {
|
|
"name": "constant.language.mlir"
|
|
}
|
|
},
|
|
"patterns": [
|
|
{
|
|
"include": "#attribute_value"
|
|
},
|
|
{
|
|
"match": "\\-\\>|\\>\\="
|
|
},
|
|
{
|
|
"include": "#bare_identifier"
|
|
}
|
|
],
|
|
"end": "\\>"
|
|
},
|
|
{
|
|
"match": "\\#[\\w\\$\\-\\.]+\\b",
|
|
"name": "constant.language.mlir"
|
|
},
|
|
{
|
|
"include": "#type_value"
|
|
},
|
|
{
|
|
"begin": "\\<",
|
|
"patterns": [
|
|
{
|
|
"include": "#attribute_value"
|
|
},
|
|
{
|
|
"include": "#bare_identifier"
|
|
}
|
|
],
|
|
"end": "\\>"
|
|
}
|
|
]
|
|
},
|
|
"attribute_dictionary_body": {
|
|
"patterns": [
|
|
{
|
|
"include": "#comment"
|
|
},
|
|
{
|
|
"include": "#string"
|
|
},
|
|
{
|
|
"include": "#attribute_value"
|
|
},
|
|
{
|
|
"match": "(\\%)?\\b([\\w\\.\\-\\$\\:0-9]+)\\b\\s*(?=\\=|\\,|\\})",
|
|
"name": "variable.other.mlir"
|
|
}
|
|
]
|
|
},
|
|
"type_value": {
|
|
"patterns": [
|
|
{
|
|
"begin": "(\\![\\w\\$\\-\\.]+)\\<",
|
|
"beginCaptures": {
|
|
"1": {
|
|
"name": "entity.name.type.mlir"
|
|
}
|
|
},
|
|
"patterns": [
|
|
{
|
|
"include": "#attribute_value"
|
|
},
|
|
{
|
|
"match": "\\-\\>|\\>\\=",
|
|
"name": "punctuation.other.mlir"
|
|
},
|
|
{
|
|
"include": "#bare_identifier"
|
|
}
|
|
],
|
|
"end": "\\>"
|
|
},
|
|
{
|
|
"match": "\\![\\w\\$\\-\\.]+\\b",
|
|
"name": "entity.name.type.mlir"
|
|
},
|
|
{
|
|
"begin": "(complex|memref|tensor|tuple|vector)\\<",
|
|
"beginCaptures": {
|
|
"1": {
|
|
"name": "entity.name.type.mlir"
|
|
}
|
|
},
|
|
"patterns": [
|
|
{
|
|
"match": "[\\?x0-9\\[\\]]+",
|
|
"captures": {
|
|
"0": {
|
|
"patterns": [
|
|
{
|
|
"include": "#number"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"include": "#attribute_value"
|
|
},
|
|
{
|
|
"match": "\\-\\>|\\>\\=",
|
|
"name": "punctuation.other.mlir"
|
|
},
|
|
{
|
|
"include": "#bare_identifier"
|
|
}
|
|
],
|
|
"end": "\\>"
|
|
},
|
|
{
|
|
"match": "bf16|f16|f32|f64|f80|f128|index|none|(u|s)?i[0-9]+",
|
|
"name": "entity.name.type.mlir"
|
|
}
|
|
]
|
|
},
|
|
"bare_identifier": {
|
|
"match": "\\b([\\w\\.\\$\\-]+)\\b",
|
|
"name": "keyword.other.mlir"
|
|
},
|
|
"ssa_value": {
|
|
"match": "\\%[\\w\\.\\$\\:\\#]+",
|
|
"name": "variable.other.mlir"
|
|
},
|
|
"block": {
|
|
"match": "\\^[\\w\\d_$\\.-]+",
|
|
"name": "keyword.control.mlir"
|
|
}
|
|
},
|
|
"scopeName": "source.mlir"
|
|
} |