mlir.json 2.2 KB
{
  "fileTypes":[
    "mlir"
  ],
  "repository":{
    "attribute":{
      "match":"\\W[\\w_][\\w\\d_.$]*\\s*=",
      "name":"meta.attribute.mlir"
    },
    "branch_target":{
      "match":"\\^bb[\\w\\d_$\\.-]+",
      "name":"entity.name.label.mlir"
    },
    "comment":{
      "match":"\/\/.*$",
      "name":"comment.line.double-slash.mlir"
    },
    "identifier":{
      "match":"[\\%#@][\\w_][\\w\\d_.$]*",
      "captures":{
        "0":{
          "name":"variable.mlir"
        }
      },
      "name":"meta.identifier.mlir"
    },
    "integer":{
      "match":"[\\Wx]([0-9]+)",
      "captures":{
        "1":{
          "name":"constant.numeric.mlir"
        }
      },
      "name":"meta.identifier.mlir"
    },
    "string":{
      "end":"\"",
      "begin":"\"",
      "beginCaptures":{
        "0":{
          "name":"punctuation.definition.string.begin.mlir"
        }
      },
      "patterns":[
        {
          "match":"\\\\[nt\"]",
          "name":"constant.character.escape.mlir"
        },
        {
          "match":"\\\\.",
          "name":"invalid.illegal.mlir"
        }
      ],
      "endCaptures":{
        "0":{
          "name":"punctuation.definition.string.end.mlir"
        }
      },
      "name":"string.quoted.double.mlir"
    },
    "types":{
      "match":"[\\Wx](index|i[1-9][0-9]*|f16|bf16|f32|f64|memref|tensor|vector)\\b",
      "captures":{
        "1":{
          "name":"storage.type.mlir"
        }
      },
      "name":"meta.types.simple.mlir"
    }
  },
  "patterns":[
    {
      "include":"#comment"
    },
    {
      "include":"#string"
    },
    {
      "match":"\\b(func)\\b\\s*(@[\\w_][\\w\\d_.$]*)",
      "captures":{
        "1":{
          "name":"keyword.function.mlir"
        },
        "2":{
          "name":"entity.name.function.mlir"
        }
      },
      "name":"support.function.mlir"
    },
    {
      "match":"\\b(attributes|br|call|constant|loc|return)\\b",
      "name":"keyword.module.mlir"
    },
    {
      "include":"#identifier"
    },
    {
      "include":"#branch_target"
    },
    {
      "include":"#attribute"
    },
    {
      "include":"#types"
    },
    {
      "include":"#integer"
    }
  ],
  "name":"MLIR",
  "scopeName":"source.mlir"
}