SPIRV-Tools/utils/vscode/spirv.json.tmpl

73 lines
1.8 KiB
Cheetah
Raw Normal View History

{
"scopeName": "source.spirv",
"name": "SPIR-V",
"comment": "Generated by {{GenerateArguments}}. Do not modify this file directly.",
"patterns": [
{{range $o := .All.OperandKinds}}{{if len $o.Enumerants}} { "include": "#{{$o.Category}}_{{$o.Kind}}" },
{{end}}{{end}} { "include": "#opcode" },
{ "include": "#extopcode" },
{ "include": "#identifier" },
{ "include": "#number" },
{ "include": "#string" },
{ "include": "#comment" },
{ "include": "#operator" }
],
"repository": { {{range $o := .All.OperandKinds}}{{if len $o.Enumerants}}
"{{$o.Category}}_{{$o.Kind}}": {
"match": "\\b({{OperandKindsMatch $o}})\\b",
"name": "keyword.spirv"
},{{end}}{{end}}
"opcode": {
"match": "(Op[a-zA-Z]+)",
"name": "entity.name.function.spirv"
},
"extopcode": {
"match": "({{AllExtOpcodes}})",
"name": "entity.name.function.ext"
},
"identifier": {
"match": "%[a-zA-Z0-9_]+",
"name": "variable.spirv"
},
"number": {
"match": "\\b[0-9]+.?[0-9]*\\b",
"name": "constant.numeric.spirv"
},
"comment": {
"match": ";[^\n]*",
"name": "comment.line.spirv"
},
"operator": {
"match": "=",
"name": "keyword.operator.spirv"
},
"string": {
"begin": "\"",
"beginCaptures": {
"0": {
"name": "punctuation.definition.string.begin.spirv"
}
},
"end": "\"",
"endCaptures": {
"0": {
"name": "punctuation.definition.string.end.spirv"
}
},
"name": "string.quoted.double.spirv",
"patterns": [ { "include": "#string_escaped_char" } ]
},
"string_escaped_char": {
"patterns": [
{
"match": "\\\\([0-7]{3}|[abfnrtv\\\\'\"]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8})",
"name": "constant.character.escape.spirv"
}, {
"match": "\\\\[^0-7xuUabfnrtv\\'\"]",
"name": "invalid.illegal.unknown-escape.spirv"
}
]
}
}
}