GDResource.tmLanguage.json 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. {
  2. "scopeName": "source.gdresource",
  3. "uuid": "e076faa2-3c52-42fa-a8e6-9a7c453c1a5b",
  4. "patterns": [
  5. { "include": "#embedded_shader" },
  6. { "include": "#embedded_gdscript" },
  7. { "include": "#comment" },
  8. { "include": "#heading" },
  9. { "include": "#key_value" }
  10. ],
  11. "repository": {
  12. "comment": {
  13. "captures": { "1": { "name": "punctuation.definition.comment.gdresource" } },
  14. "match": "(;).*$\\n?",
  15. "name": "comment.line.gdresource"
  16. },
  17. "embedded_shader": {
  18. "name": "meta.embedded.block.gdshader",
  19. "begin": "(code) = \"",
  20. "end": "\"",
  21. "beginCaptures": { "1": { "name": "variable.other.property.gdresource" } },
  22. "patterns": [ { "include": "source.gdshader" } ]
  23. },
  24. "embedded_gdscript": {
  25. "comment": "meta.embedded.block.gdscript",
  26. "begin": "(script/source) = \"",
  27. "end": "\"",
  28. "beginCaptures": { "1": { "name": "variable.other.property.gdresource" } },
  29. "patterns": [ { "include": "source.gdscript" } ]
  30. },
  31. "heading": {
  32. "begin": "\\[([a-z_]*)\\s?",
  33. "beginCaptures": { "1": { "name": "keyword.control.gdresource" } },
  34. "end": "\\]",
  35. "patterns": [
  36. { "include": "#heading_properties" },
  37. { "include": "#data" }
  38. ]
  39. },
  40. "heading_properties": {
  41. "patterns": [
  42. {
  43. "name": "invalid.illegal.noValue.gdresource",
  44. "match": "(\\s*[A-Za-z_\\-][A-Za-z0-9_\\-]*\\s*=)(?=\\s*$)"
  45. },
  46. {
  47. "begin": "\\s*([A-Za-z_-][^\\s]*|\".+\"|'.+'|[0-9]+)\\s*(=)\\s*",
  48. "beginCaptures": {
  49. "1": { "name": "variable.other.property.gdresource" },
  50. "2": { "name": "punctuation.definition.keyValue.gdresource" }
  51. },
  52. "end": "($|(?==)|\\,?|\\s*(?=\\}))",
  53. "patterns": [ { "include": "#data" } ]
  54. }
  55. ]
  56. },
  57. "key_value": {
  58. "patterns": [
  59. {
  60. "name": "invalid.illegal.noValue.gdresource",
  61. "match": "(\\s*[A-Za-z_\\-][A-Za-z0-9_\\-]*\\s*=)(?=\\s*$)"
  62. },
  63. {
  64. "begin": "\\s*([A-Za-z_-][^\\s]*|\".+\"|'.+'|[0-9]+)\\s*(=)\\s*",
  65. "beginCaptures": {
  66. "1": { "name": "variable.other.property.gdresource" },
  67. "2": { "name": "punctuation.definition.keyValue.gdresource" }
  68. },
  69. "end": "($|(?==)|\\,|\\s*(?=\\}))",
  70. "patterns": [ { "include": "#data" } ]
  71. }
  72. ]
  73. },
  74. "data": {
  75. "patterns": [
  76. { "include": "#comment" },
  77. {
  78. "begin": "(?<!\\w)(\\{)\\s*",
  79. "beginCaptures": { "1": { "name": "punctuation.definition.table.inline.gdresource" } },
  80. "end": "\\s*(\\})(?!\\w)",
  81. "endCaptures": { "1": { "name": "punctuation.definition.table.inline.gdresource" } },
  82. "patterns": [
  83. { "include": "#key_value" },
  84. { "include": "#data" }
  85. ]
  86. },
  87. {
  88. "begin": "(?<!\\w)(\\[)\\s*",
  89. "beginCaptures": { "1": { "name": "punctuation.definition.array.gdresource" } },
  90. "end": "\\s*(\\])(?!\\w)",
  91. "endCaptures": { "1": { "name": "punctuation.definition.array.gdresource" } },
  92. "patterns": [ { "include": "#data" } ]
  93. },
  94. {
  95. "name": "string.quoted.triple.basic.block.gdresource",
  96. "begin": "\"\"\"",
  97. "end": "\"\"\"",
  98. "patterns": [
  99. {
  100. "match": "\\\\([btnfr\"\\\\\\n/ ]|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})",
  101. "name": "constant.character.escape.gdresource"
  102. },
  103. {
  104. "match": "\\\\[^btnfr/\"\\\\\\n]",
  105. "name": "invalid.illegal.escape.gdresource"
  106. }
  107. ]
  108. },
  109. {
  110. "name": "support.function.any-method.gdresource",
  111. "match": "\"res:\\/\\/[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*\""
  112. },
  113. {
  114. "name": "support.class.library.gdresource",
  115. "match": "(?<=type=)\"[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*\""
  116. },
  117. {
  118. "name": "constant.character.escape.gdresource",
  119. "match": "(?<=NodePath\\(|parent=|name=)\"[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*\""
  120. },
  121. {
  122. "name": "string.quoted.double.basic.line.gdresource",
  123. "begin": "\"",
  124. "end": "\"",
  125. "patterns": [
  126. {
  127. "match": "\\\\([btnfr\"\\\\\\n/ ]|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})",
  128. "name": "constant.character.escape.gdresource"
  129. },
  130. {
  131. "match": "\\\\[^btnfr/\"\\\\\\n]",
  132. "name": "invalid.illegal.escape.gdresource"
  133. }
  134. ]
  135. },
  136. {
  137. "name": "string.quoted.single.literal.line.gdresource",
  138. "match": "'.*?'"
  139. },
  140. {
  141. "match": "(?<!\\w)(true|false)(?!\\w)",
  142. "name": "constant.language.gdresource"
  143. },
  144. {
  145. "match": "(?<!\\w)([\\+\\-]?(0|([1-9](([0-9]|_[0-9])+)?))(?:(?:\\.(0|([1-9](([0-9]|_[0-9])+)?)))?[eE][\\+\\-]?[1-9]_?[0-9]*|(?:\\.[0-9_]*)))(?!\\w)",
  146. "name": "constant.numeric.float.gdresource"
  147. },
  148. {
  149. "match": "(?<!\\w)((?:[\\+\\-]?(0|([1-9](([0-9]|_[0-9])+)?))))(?!\\w)",
  150. "name": "constant.numeric.integer.gdresource"
  151. },
  152. {
  153. "match": "(?<!\\w)([\\+\\-]?inf)(?!\\w)",
  154. "name": "constant.numeric.inf.gdresource"
  155. },
  156. {
  157. "match": "(?<!\\w)([\\+\\-]?nan)(?!\\w)",
  158. "name": "constant.numeric.nan.gdresource"
  159. },
  160. {
  161. "match": "(?<!\\w)((?:0x(([0-9a-fA-F](([0-9a-fA-F]|_[0-9a-fA-F])+)?))))(?!\\w)",
  162. "name": "constant.numeric.hex.gdresource"
  163. },
  164. {
  165. "match": "(?<!\\w)(0o[0-7](_?[0-7])*)(?!\\w)",
  166. "name": "constant.numeric.oct.gdresource"
  167. },
  168. {
  169. "match": "(?<!\\w)(0b[01](_?[01])*)(?!\\w)",
  170. "name": "constant.numeric.bin.gdresource"
  171. },
  172. {
  173. "begin": "(?<!\\w)(Vector2|Vector2i|Vector3|Vector3i|Color|Rect2|Rect2i|Array|Basis|Dictionary|Plane|Quat|RID|Rect3|Transform|Transform2D|Transform3D|AABB|String|Color|NodePath|Object|PoolByteArray|PoolIntArray|PoolRealArray|PoolStringArray|PoolVector2Array|PoolVector3Array|PoolColorArray|bool|int|float|StringName|Quaternion|PackedByteArray|PackedInt32Array|PackedInt64Array|PackedFloat32Array|PackedFloat64Array|PackedStringArray|PackedVector2Array|PackedVector2iArray|PackedVector3Array|PackedVector3iArray|PackedColorArray)(\\()\\s?",
  174. "beginCaptures": { "1": { "name": "support.class.library.gdresource" } },
  175. "end": "\\s?(\\))",
  176. "patterns": [
  177. { "include": "#key_value" },
  178. { "include": "#data" }
  179. ]
  180. },
  181. {
  182. "begin": "(?<!\\w)(ExtResource|SubResource)(\\()\\s?",
  183. "beginCaptures": { "1": { "name": "keyword.control.gdresource" } },
  184. "end": "\\s?(\\))",
  185. "patterns": [
  186. { "include": "#key_value" },
  187. { "include": "#data" }
  188. ]
  189. }
  190. ]
  191. }
  192. }
  193. }