spirv.json.tmpl 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. {
  2. "scopeName": "source.spirv",
  3. "name": "SPIR-V",
  4. "comment": "Generated by {{GenerateArguments}}. Do not modify this file directly.",
  5. "patterns": [
  6. {{range $o := .All.OperandKinds}}{{if len $o.Enumerants}} { "include": "#{{$o.Category}}_{{$o.Kind}}" },
  7. {{end}}{{end}} { "include": "#opcode" },
  8. { "include": "#extopcode" },
  9. { "include": "#identifier" },
  10. { "include": "#number" },
  11. { "include": "#string" },
  12. { "include": "#comment" },
  13. { "include": "#operator" }
  14. ],
  15. "repository": { {{range $o := .All.OperandKinds}}{{if len $o.Enumerants}}
  16. "{{$o.Category}}_{{$o.Kind}}": {
  17. "match": "\\b({{OperandKindsMatch $o}})\\b",
  18. "name": "keyword.spirv"
  19. },{{end}}{{end}}
  20. "opcode": {
  21. "match": "(Op[a-zA-Z]+)",
  22. "name": "entity.name.function.spirv"
  23. },
  24. "extopcode": {
  25. "match": "({{AllExtOpcodes}})",
  26. "name": "entity.name.function.ext"
  27. },
  28. "identifier": {
  29. "match": "%[a-zA-Z0-9_]+",
  30. "name": "variable.spirv"
  31. },
  32. "number": {
  33. "match": "\\b[0-9]+.?[0-9]*\\b",
  34. "name": "constant.numeric.spirv"
  35. },
  36. "comment": {
  37. "match": ";[^\n]*",
  38. "name": "comment.line.spirv"
  39. },
  40. "operator": {
  41. "match": "=",
  42. "name": "keyword.operator.spirv"
  43. },
  44. "string": {
  45. "begin": "\"",
  46. "beginCaptures": {
  47. "0": {
  48. "name": "punctuation.definition.string.begin.spirv"
  49. }
  50. },
  51. "end": "\"",
  52. "endCaptures": {
  53. "0": {
  54. "name": "punctuation.definition.string.end.spirv"
  55. }
  56. },
  57. "name": "string.quoted.double.spirv",
  58. "patterns": [ { "include": "#string_escaped_char" } ]
  59. },
  60. "string_escaped_char": {
  61. "patterns": [
  62. {
  63. "match": "\\\\([0-7]{3}|[abfnrtv\\\\'\"]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8})",
  64. "name": "constant.character.escape.spirv"
  65. }, {
  66. "match": "\\\\[^0-7xuUabfnrtv\\'\"]",
  67. "name": "invalid.illegal.unknown-escape.spirv"
  68. }
  69. ]
  70. }
  71. }
  72. }