redscript-mc 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (272) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.md +40 -0
  2. package/.github/ISSUE_TEMPLATE/feature_request.md +31 -0
  3. package/.github/ISSUE_TEMPLATE/wrong_output.md +33 -0
  4. package/.github/PULL_REQUEST_TEMPLATE.md +34 -0
  5. package/.github/workflows/ci.yml +29 -0
  6. package/.github/workflows/publish-extension.yml +35 -0
  7. package/LICENSE +21 -0
  8. package/README.md +261 -0
  9. package/README.zh.md +261 -0
  10. package/dist/__tests__/cli.test.d.ts +1 -0
  11. package/dist/__tests__/cli.test.js +140 -0
  12. package/dist/__tests__/codegen.test.d.ts +1 -0
  13. package/dist/__tests__/codegen.test.js +121 -0
  14. package/dist/__tests__/diagnostics.test.d.ts +4 -0
  15. package/dist/__tests__/diagnostics.test.js +149 -0
  16. package/dist/__tests__/e2e.test.d.ts +6 -0
  17. package/dist/__tests__/e2e.test.js +1528 -0
  18. package/dist/__tests__/lexer.test.d.ts +1 -0
  19. package/dist/__tests__/lexer.test.js +316 -0
  20. package/dist/__tests__/lowering.test.d.ts +1 -0
  21. package/dist/__tests__/lowering.test.js +819 -0
  22. package/dist/__tests__/mc-integration.test.d.ts +12 -0
  23. package/dist/__tests__/mc-integration.test.js +395 -0
  24. package/dist/__tests__/mc-syntax.test.d.ts +1 -0
  25. package/dist/__tests__/mc-syntax.test.js +112 -0
  26. package/dist/__tests__/nbt.test.d.ts +1 -0
  27. package/dist/__tests__/nbt.test.js +82 -0
  28. package/dist/__tests__/optimizer-advanced.test.d.ts +1 -0
  29. package/dist/__tests__/optimizer-advanced.test.js +124 -0
  30. package/dist/__tests__/optimizer.test.d.ts +1 -0
  31. package/dist/__tests__/optimizer.test.js +118 -0
  32. package/dist/__tests__/parser.test.d.ts +1 -0
  33. package/dist/__tests__/parser.test.js +717 -0
  34. package/dist/__tests__/repl.test.d.ts +1 -0
  35. package/dist/__tests__/repl.test.js +27 -0
  36. package/dist/__tests__/runtime.test.d.ts +1 -0
  37. package/dist/__tests__/runtime.test.js +276 -0
  38. package/dist/__tests__/structure-optimizer.test.d.ts +1 -0
  39. package/dist/__tests__/structure-optimizer.test.js +33 -0
  40. package/dist/__tests__/typechecker.test.d.ts +1 -0
  41. package/dist/__tests__/typechecker.test.js +364 -0
  42. package/dist/ast/types.d.ts +357 -0
  43. package/dist/ast/types.js +9 -0
  44. package/dist/cli.d.ts +11 -0
  45. package/dist/cli.js +407 -0
  46. package/dist/codegen/cmdblock/index.d.ts +26 -0
  47. package/dist/codegen/cmdblock/index.js +45 -0
  48. package/dist/codegen/mcfunction/index.d.ts +34 -0
  49. package/dist/codegen/mcfunction/index.js +413 -0
  50. package/dist/codegen/structure/index.d.ts +18 -0
  51. package/dist/codegen/structure/index.js +249 -0
  52. package/dist/compile.d.ts +30 -0
  53. package/dist/compile.js +152 -0
  54. package/dist/data/arena/function/__load.mcfunction +6 -0
  55. package/dist/data/arena/function/__tick.mcfunction +2 -0
  56. package/dist/data/arena/function/announce_leaders/else_1.mcfunction +3 -0
  57. package/dist/data/arena/function/announce_leaders/foreach_0/merge_2.mcfunction +1 -0
  58. package/dist/data/arena/function/announce_leaders/foreach_0/then_0.mcfunction +3 -0
  59. package/dist/data/arena/function/announce_leaders/foreach_0.mcfunction +7 -0
  60. package/dist/data/arena/function/announce_leaders/foreach_1/merge_2.mcfunction +1 -0
  61. package/dist/data/arena/function/announce_leaders/foreach_1/then_0.mcfunction +4 -0
  62. package/dist/data/arena/function/announce_leaders/foreach_1.mcfunction +6 -0
  63. package/dist/data/arena/function/announce_leaders/merge_2.mcfunction +1 -0
  64. package/dist/data/arena/function/announce_leaders/then_0.mcfunction +4 -0
  65. package/dist/data/arena/function/announce_leaders.mcfunction +6 -0
  66. package/dist/data/arena/function/arena_tick/merge_2.mcfunction +1 -0
  67. package/dist/data/arena/function/arena_tick/then_0.mcfunction +4 -0
  68. package/dist/data/arena/function/arena_tick.mcfunction +11 -0
  69. package/dist/data/counter/function/__load.mcfunction +5 -0
  70. package/dist/data/counter/function/__tick.mcfunction +2 -0
  71. package/dist/data/counter/function/counter_tick/merge_2.mcfunction +1 -0
  72. package/dist/data/counter/function/counter_tick/then_0.mcfunction +3 -0
  73. package/dist/data/counter/function/counter_tick.mcfunction +11 -0
  74. package/dist/data/minecraft/tags/function/load.json +5 -0
  75. package/dist/data/minecraft/tags/function/tick.json +5 -0
  76. package/dist/data/quiz/function/__load.mcfunction +16 -0
  77. package/dist/data/quiz/function/__tick.mcfunction +6 -0
  78. package/dist/data/quiz/function/__trigger_quiz_a_dispatch.mcfunction +4 -0
  79. package/dist/data/quiz/function/__trigger_quiz_b_dispatch.mcfunction +4 -0
  80. package/dist/data/quiz/function/__trigger_quiz_c_dispatch.mcfunction +4 -0
  81. package/dist/data/quiz/function/__trigger_quiz_start_dispatch.mcfunction +4 -0
  82. package/dist/data/quiz/function/answer_a.mcfunction +4 -0
  83. package/dist/data/quiz/function/answer_b.mcfunction +4 -0
  84. package/dist/data/quiz/function/answer_c.mcfunction +4 -0
  85. package/dist/data/quiz/function/ask_question/else_1.mcfunction +5 -0
  86. package/dist/data/quiz/function/ask_question/else_4.mcfunction +5 -0
  87. package/dist/data/quiz/function/ask_question/else_7.mcfunction +4 -0
  88. package/dist/data/quiz/function/ask_question/merge_2.mcfunction +1 -0
  89. package/dist/data/quiz/function/ask_question/merge_5.mcfunction +2 -0
  90. package/dist/data/quiz/function/ask_question/merge_8.mcfunction +2 -0
  91. package/dist/data/quiz/function/ask_question/then_0.mcfunction +4 -0
  92. package/dist/data/quiz/function/ask_question/then_3.mcfunction +4 -0
  93. package/dist/data/quiz/function/ask_question/then_6.mcfunction +4 -0
  94. package/dist/data/quiz/function/ask_question.mcfunction +7 -0
  95. package/dist/data/quiz/function/finish_quiz.mcfunction +6 -0
  96. package/dist/data/quiz/function/handle_answer/else_1.mcfunction +5 -0
  97. package/dist/data/quiz/function/handle_answer/else_10.mcfunction +3 -0
  98. package/dist/data/quiz/function/handle_answer/else_16.mcfunction +3 -0
  99. package/dist/data/quiz/function/handle_answer/else_4.mcfunction +3 -0
  100. package/dist/data/quiz/function/handle_answer/else_7.mcfunction +5 -0
  101. package/dist/data/quiz/function/handle_answer/merge_11.mcfunction +2 -0
  102. package/dist/data/quiz/function/handle_answer/merge_14.mcfunction +2 -0
  103. package/dist/data/quiz/function/handle_answer/merge_17.mcfunction +2 -0
  104. package/dist/data/quiz/function/handle_answer/merge_2.mcfunction +8 -0
  105. package/dist/data/quiz/function/handle_answer/merge_5.mcfunction +2 -0
  106. package/dist/data/quiz/function/handle_answer/merge_8.mcfunction +2 -0
  107. package/dist/data/quiz/function/handle_answer/then_0.mcfunction +5 -0
  108. package/dist/data/quiz/function/handle_answer/then_12.mcfunction +5 -0
  109. package/dist/data/quiz/function/handle_answer/then_15.mcfunction +6 -0
  110. package/dist/data/quiz/function/handle_answer/then_3.mcfunction +6 -0
  111. package/dist/data/quiz/function/handle_answer/then_6.mcfunction +5 -0
  112. package/dist/data/quiz/function/handle_answer/then_9.mcfunction +6 -0
  113. package/dist/data/quiz/function/handle_answer.mcfunction +11 -0
  114. package/dist/data/quiz/function/start_quiz.mcfunction +5 -0
  115. package/dist/data/shop/function/__load.mcfunction +7 -0
  116. package/dist/data/shop/function/__tick.mcfunction +3 -0
  117. package/dist/data/shop/function/__trigger_shop_buy_dispatch.mcfunction +4 -0
  118. package/dist/data/shop/function/complete_purchase/else_1.mcfunction +5 -0
  119. package/dist/data/shop/function/complete_purchase/else_4.mcfunction +5 -0
  120. package/dist/data/shop/function/complete_purchase/else_7.mcfunction +3 -0
  121. package/dist/data/shop/function/complete_purchase/merge_2.mcfunction +2 -0
  122. package/dist/data/shop/function/complete_purchase/merge_5.mcfunction +2 -0
  123. package/dist/data/shop/function/complete_purchase/merge_8.mcfunction +2 -0
  124. package/dist/data/shop/function/complete_purchase/then_0.mcfunction +4 -0
  125. package/dist/data/shop/function/complete_purchase/then_3.mcfunction +4 -0
  126. package/dist/data/shop/function/complete_purchase/then_6.mcfunction +4 -0
  127. package/dist/data/shop/function/complete_purchase.mcfunction +7 -0
  128. package/dist/data/shop/function/handle_shop_trigger.mcfunction +3 -0
  129. package/dist/data/turret/function/__load.mcfunction +5 -0
  130. package/dist/data/turret/function/__tick.mcfunction +4 -0
  131. package/dist/data/turret/function/__trigger_deploy_turret_dispatch.mcfunction +4 -0
  132. package/dist/data/turret/function/deploy_turret.mcfunction +8 -0
  133. package/dist/data/turret/function/turret_tick/at_1.mcfunction +2 -0
  134. package/dist/data/turret/function/turret_tick/foreach_0.mcfunction +2 -0
  135. package/dist/data/turret/function/turret_tick/foreach_2.mcfunction +2 -0
  136. package/dist/data/turret/function/turret_tick/tick_body.mcfunction +3 -0
  137. package/dist/data/turret/function/turret_tick/tick_skip.mcfunction +1 -0
  138. package/dist/data/turret/function/turret_tick.mcfunction +5 -0
  139. package/dist/diagnostics/index.d.ts +44 -0
  140. package/dist/diagnostics/index.js +140 -0
  141. package/dist/index.d.ts +53 -0
  142. package/dist/index.js +126 -0
  143. package/dist/ir/builder.d.ts +32 -0
  144. package/dist/ir/builder.js +99 -0
  145. package/dist/ir/types.d.ts +117 -0
  146. package/dist/ir/types.js +15 -0
  147. package/dist/lexer/index.d.ts +36 -0
  148. package/dist/lexer/index.js +458 -0
  149. package/dist/lowering/index.d.ts +106 -0
  150. package/dist/lowering/index.js +2041 -0
  151. package/dist/mc-test/client.d.ts +128 -0
  152. package/dist/mc-test/client.js +174 -0
  153. package/dist/mc-test/runner.d.ts +28 -0
  154. package/dist/mc-test/runner.js +150 -0
  155. package/dist/mc-test/setup.d.ts +11 -0
  156. package/dist/mc-test/setup.js +98 -0
  157. package/dist/mc-validator/index.d.ts +17 -0
  158. package/dist/mc-validator/index.js +322 -0
  159. package/dist/nbt/index.d.ts +86 -0
  160. package/dist/nbt/index.js +250 -0
  161. package/dist/optimizer/commands.d.ts +36 -0
  162. package/dist/optimizer/commands.js +349 -0
  163. package/dist/optimizer/passes.d.ts +34 -0
  164. package/dist/optimizer/passes.js +227 -0
  165. package/dist/optimizer/structure.d.ts +8 -0
  166. package/dist/optimizer/structure.js +344 -0
  167. package/dist/pack.mcmeta +6 -0
  168. package/dist/parser/index.d.ts +76 -0
  169. package/dist/parser/index.js +1193 -0
  170. package/dist/repl.d.ts +16 -0
  171. package/dist/repl.js +165 -0
  172. package/dist/runtime/index.d.ts +101 -0
  173. package/dist/runtime/index.js +1288 -0
  174. package/dist/typechecker/index.d.ts +42 -0
  175. package/dist/typechecker/index.js +629 -0
  176. package/docs/COMPILATION_STATS.md +142 -0
  177. package/docs/IMPLEMENTATION_GUIDE.md +512 -0
  178. package/docs/LANGUAGE_REFERENCE.md +415 -0
  179. package/docs/MC_MAPPING.md +280 -0
  180. package/docs/STRUCTURE_TARGET.md +80 -0
  181. package/docs/mc-reference/commands.md +259 -0
  182. package/editors/vscode/.vscodeignore +10 -0
  183. package/editors/vscode/LICENSE +21 -0
  184. package/editors/vscode/README.md +78 -0
  185. package/editors/vscode/build.mjs +28 -0
  186. package/editors/vscode/icon.png +0 -0
  187. package/editors/vscode/mcfunction-language-configuration.json +28 -0
  188. package/editors/vscode/out/extension.js +7236 -0
  189. package/editors/vscode/package-lock.json +566 -0
  190. package/editors/vscode/package.json +137 -0
  191. package/editors/vscode/redscript-language-configuration.json +28 -0
  192. package/editors/vscode/snippets/redscript.json +114 -0
  193. package/editors/vscode/src/codeactions.ts +89 -0
  194. package/editors/vscode/src/completion.ts +130 -0
  195. package/editors/vscode/src/extension.ts +239 -0
  196. package/editors/vscode/src/hover.ts +1120 -0
  197. package/editors/vscode/src/symbols.ts +207 -0
  198. package/editors/vscode/syntaxes/mcfunction.tmLanguage.json +740 -0
  199. package/editors/vscode/syntaxes/redscript.tmLanguage.json +357 -0
  200. package/editors/vscode/tsconfig.json +13 -0
  201. package/jest.config.js +5 -0
  202. package/package.json +38 -0
  203. package/src/__tests__/cli.test.ts +130 -0
  204. package/src/__tests__/codegen.test.ts +128 -0
  205. package/src/__tests__/diagnostics.test.ts +195 -0
  206. package/src/__tests__/e2e.test.ts +1721 -0
  207. package/src/__tests__/fixtures/mc-commands-1.21.4.json +18734 -0
  208. package/src/__tests__/formatter.test.ts +46 -0
  209. package/src/__tests__/lexer.test.ts +356 -0
  210. package/src/__tests__/lowering.test.ts +962 -0
  211. package/src/__tests__/mc-integration.test.ts +409 -0
  212. package/src/__tests__/mc-syntax.test.ts +96 -0
  213. package/src/__tests__/nbt.test.ts +58 -0
  214. package/src/__tests__/optimizer-advanced.test.ts +144 -0
  215. package/src/__tests__/optimizer.test.ts +129 -0
  216. package/src/__tests__/parser.test.ts +800 -0
  217. package/src/__tests__/repl.test.ts +33 -0
  218. package/src/__tests__/runtime.test.ts +289 -0
  219. package/src/__tests__/structure-optimizer.test.ts +38 -0
  220. package/src/__tests__/typechecker.test.ts +395 -0
  221. package/src/ast/types.ts +248 -0
  222. package/src/cli.ts +445 -0
  223. package/src/codegen/cmdblock/index.ts +63 -0
  224. package/src/codegen/mcfunction/index.ts +471 -0
  225. package/src/codegen/structure/index.ts +305 -0
  226. package/src/compile.ts +188 -0
  227. package/src/diagnostics/index.ts +186 -0
  228. package/src/examples/README.md +77 -0
  229. package/src/examples/SHOWCASE_GAME.md +43 -0
  230. package/src/examples/arena.rs +44 -0
  231. package/src/examples/counter.rs +12 -0
  232. package/src/examples/pvp_arena.rs +131 -0
  233. package/src/examples/quiz.rs +90 -0
  234. package/src/examples/rpg.rs +13 -0
  235. package/src/examples/shop.rs +30 -0
  236. package/src/examples/showcase_game.rs +552 -0
  237. package/src/examples/stdlib_demo.rs +181 -0
  238. package/src/examples/turret.rs +27 -0
  239. package/src/examples/world_manager.rs +23 -0
  240. package/src/formatter/index.ts +22 -0
  241. package/src/index.ts +161 -0
  242. package/src/ir/builder.ts +114 -0
  243. package/src/ir/types.ts +119 -0
  244. package/src/lexer/index.ts +555 -0
  245. package/src/lowering/index.ts +2406 -0
  246. package/src/mc-test/client.ts +259 -0
  247. package/src/mc-test/runner.ts +140 -0
  248. package/src/mc-test/setup.ts +70 -0
  249. package/src/mc-validator/index.ts +367 -0
  250. package/src/nbt/index.ts +321 -0
  251. package/src/optimizer/commands.ts +416 -0
  252. package/src/optimizer/passes.ts +233 -0
  253. package/src/optimizer/structure.ts +441 -0
  254. package/src/parser/index.ts +1437 -0
  255. package/src/repl.ts +165 -0
  256. package/src/runtime/index.ts +1403 -0
  257. package/src/stdlib/README.md +156 -0
  258. package/src/stdlib/combat.rs +20 -0
  259. package/src/stdlib/cooldown.rs +45 -0
  260. package/src/stdlib/math.rs +49 -0
  261. package/src/stdlib/mobs.rs +99 -0
  262. package/src/stdlib/player.rs +29 -0
  263. package/src/stdlib/strings.rs +7 -0
  264. package/src/stdlib/timer.rs +51 -0
  265. package/src/templates/README.md +126 -0
  266. package/src/templates/combat.rs +96 -0
  267. package/src/templates/economy.rs +40 -0
  268. package/src/templates/mini-game-framework.rs +117 -0
  269. package/src/templates/quest.rs +78 -0
  270. package/src/test_programs/zombie_game.rs +25 -0
  271. package/src/typechecker/index.ts +737 -0
  272. package/tsconfig.json +16 -0
@@ -0,0 +1,740 @@
1
+ {
2
+ "name": "Syntax Mcfunction",
3
+ "scopeName": "source.mcfunction",
4
+ "uuid": "8918dadd-8ebe-42d9-b1e9-0489ab228d9d",
5
+ "fileTypes": [
6
+ "mcfunction",
7
+ "bolt"
8
+ ],
9
+ "patterns": [
10
+ {
11
+ "include": "#root"
12
+ }
13
+ ],
14
+ "repository": {
15
+ "root": {
16
+ "patterns": [
17
+ {
18
+ "include": "#literals"
19
+ },
20
+ {
21
+ "include": "#comments"
22
+ },
23
+ {
24
+ "include": "#say"
25
+ },
26
+ {
27
+ "include": "#names"
28
+ },
29
+ {
30
+ "include": "#comments_inline"
31
+ },
32
+ {
33
+ "include": "#subcommands"
34
+ },
35
+ {
36
+ "include": "#property"
37
+ },
38
+ {
39
+ "include": "#operators"
40
+ },
41
+ {
42
+ "include": "#selectors"
43
+ }
44
+ ]
45
+ },
46
+ "comments": {
47
+ "patterns": [
48
+ {
49
+ "applyEndPatternLast": 1,
50
+ "begin": "^\\s*(#[>!#])(.+)$",
51
+ "beginCaptures": {
52
+ "1": {
53
+ "name": "comment.block.mcfunction"
54
+ },
55
+ "2": {
56
+ "name": "markup.bold.mcfunction"
57
+ }
58
+ },
59
+ "captures": {
60
+ "0": {
61
+ "name": "comment.block.mcfunction"
62
+ }
63
+ },
64
+ "end": "^(?!#)",
65
+ "name": "meta.comments",
66
+ "patterns": [
67
+ {
68
+ "include": "#comments_block"
69
+ }
70
+ ]
71
+ },
72
+ {
73
+ "captures": {
74
+ "0": {
75
+ "name": "comment.line.mcfunction"
76
+ }
77
+ },
78
+ "match": "^\\s*#.*$",
79
+ "name": "meta.comments"
80
+ }
81
+ ]
82
+ },
83
+ "comments_inline": {
84
+ "patterns": [
85
+ {
86
+ "captures": {
87
+ "0": {
88
+ "name": "comment.line.mcfunction"
89
+ }
90
+ },
91
+ "match": "#.*$",
92
+ "name": "meta.comments"
93
+ }
94
+ ]
95
+ },
96
+ "comments_block": {
97
+ "patterns": [
98
+ {
99
+ "applyEndPatternLast": 1,
100
+ "begin": "^\\s*#[>!]",
101
+ "captures": {
102
+ "0": {
103
+ "name": "comment.block.mcfunction"
104
+ }
105
+ },
106
+ "end": "$",
107
+ "name": "meta.comments_block",
108
+ "patterns": [
109
+ {
110
+ "include": "#comments_block_emphasized"
111
+ }
112
+ ]
113
+ },
114
+ {
115
+ "applyEndPatternLast": 1,
116
+ "begin": "^\\s*#",
117
+ "captures": {
118
+ "0": {
119
+ "name": "comment.block.mcfunction"
120
+ }
121
+ },
122
+ "end": "$",
123
+ "name": "meta.comments_block",
124
+ "patterns": [
125
+ {
126
+ "include": "#comments_block_normal"
127
+ }
128
+ ]
129
+ }
130
+ ]
131
+ },
132
+ "comments_block_emphasized": {
133
+ "patterns": [
134
+ {
135
+ "include": "#comments_block_special"
136
+ },
137
+ {
138
+ "captures": {
139
+ "0": {
140
+ "name": "markup.bold.mcfunction"
141
+ }
142
+ },
143
+ "match": "\\S+",
144
+ "name": "meta.comments_block_emphasized"
145
+ }
146
+ ]
147
+ },
148
+ "comments_block_normal": {
149
+ "patterns": [
150
+ {
151
+ "include": "#comments_block_special"
152
+ },
153
+ {
154
+ "captures": {
155
+ "0": {
156
+ "name": "comment.block.mcfunction"
157
+ }
158
+ },
159
+ "match": "\\S+",
160
+ "name": "meta.comments_block_normal"
161
+ },
162
+ {
163
+ "include": "#whitespace"
164
+ }
165
+ ]
166
+ },
167
+ "comments_block_special": {
168
+ "patterns": [
169
+ {
170
+ "captures": {
171
+ "0": {
172
+ "name": "markup.heading.mcfunction"
173
+ }
174
+ },
175
+ "match": "@\\S+",
176
+ "name": "meta.comments_block_special"
177
+ },
178
+ {
179
+ "include": "#resource-name"
180
+ },
181
+ {
182
+ "captures": {
183
+ "0": {
184
+ "name": "variable.other.mcfunction"
185
+ }
186
+ },
187
+ "match": "[#%$][A-Za-z0-9_.#%$]+",
188
+ "name": "meta.comments_block_special"
189
+ }
190
+ ]
191
+ },
192
+ "literals": {
193
+ "patterns": [
194
+ {
195
+ "captures": {
196
+ "0": {
197
+ "name": "constant.numeric.boolean.mcfunction"
198
+ }
199
+ },
200
+ "match": "\\b(true|false|True|False)\\b",
201
+ "name": "meta.literals"
202
+ },
203
+ {
204
+ "captures": {
205
+ "0": {
206
+ "name": "variable.uuid.mcfunction"
207
+ }
208
+ },
209
+ "match": "\\b[0-9a-fA-F]+(?:-[0-9a-fA-F]+){4}\\b",
210
+ "name": "meta.names"
211
+ },
212
+ {
213
+ "captures": {
214
+ "0": {
215
+ "name": "constant.numeric.float.mcfunction"
216
+ }
217
+ },
218
+ "match": "[+-]?\\d*\\.?\\d+([eE]?[+-]?\\d+)?[df]?\\b",
219
+ "name": "meta.literals"
220
+ },
221
+ {
222
+ "captures": {
223
+ "0": {
224
+ "name": "constant.numeric.integer.mcfunction"
225
+ }
226
+ },
227
+ "match": "[+-]?\\d+(b|B|L|l|s|S)?\\b",
228
+ "name": "meta.literals"
229
+ },
230
+ {
231
+ "captures": {
232
+ "0": {
233
+ "name": "variable.other.mcfunction"
234
+ }
235
+ },
236
+ "match": "\\.\\.",
237
+ "name": "meta.ellipse.literals"
238
+ },
239
+ {
240
+ "applyEndPatternLast": 1,
241
+ "begin": "\"",
242
+ "beginCaptures": {
243
+ "0": {
244
+ "name": "punctuation.definition.string.begin.mcfunction"
245
+ }
246
+ },
247
+ "end": "\"",
248
+ "endCaptures": {
249
+ "0": {
250
+ "name": "punctuation.definition.string.end.mcfunction"
251
+ }
252
+ },
253
+ "name": "string.quoted.double.mcfunction",
254
+ "patterns": [
255
+ {
256
+ "include": "#literals_string-double"
257
+ }
258
+ ]
259
+ },
260
+ {
261
+ "applyEndPatternLast": 1,
262
+ "begin": "'",
263
+ "beginCaptures": {
264
+ "0": {
265
+ "name": "punctuation.definition.string.begin.mcfunction"
266
+ }
267
+ },
268
+ "end": "'",
269
+ "endCaptures": {
270
+ "0": {
271
+ "name": "punctuation.definition.string.begin.mcfunction"
272
+ }
273
+ },
274
+ "name": "string.quoted.single.mcfunction",
275
+ "patterns": [
276
+ {
277
+ "include": "#literals_string-single"
278
+ }
279
+ ]
280
+ }
281
+ ]
282
+ },
283
+ "subcommands": {
284
+ "patterns": [
285
+ {
286
+ "captures": {
287
+ "0": {
288
+ "name": "entity.name.class.mcfunction"
289
+ }
290
+ },
291
+ "match": "[a-z_]+",
292
+ "name": "meta.literals"
293
+ }
294
+ ]
295
+ },
296
+ "literals_string-double": {
297
+ "patterns": [
298
+ {
299
+ "captures": {
300
+ "0": {
301
+ "name": "constant.character.escape.mcfunction"
302
+ }
303
+ },
304
+ "match": "\\\\.",
305
+ "name": "meta.literals_string-double"
306
+ },
307
+ {
308
+ "captures": {
309
+ "0": {
310
+ "name": "constant.character.escape.mcfunction"
311
+ }
312
+ },
313
+ "match": "\\\\",
314
+ "name": "meta.literals_string-double"
315
+ },
316
+ {
317
+ "include": "#macro-name"
318
+ },
319
+ {
320
+ "captures": {
321
+ "0": {
322
+ "name": "string.quoted.double.mcfunction"
323
+ }
324
+ },
325
+ "match": "[^\\\\\"]",
326
+ "name": "meta.literals_string-double"
327
+ }
328
+ ]
329
+ },
330
+ "literals_string-single": {
331
+ "patterns": [
332
+ {
333
+ "captures": {
334
+ "0": {
335
+ "name": "constant.character.escape.mcfunction"
336
+ }
337
+ },
338
+ "match": "\\\\.",
339
+ "name": "meta.literals_string-single"
340
+ },
341
+ {
342
+ "captures": {
343
+ "0": {
344
+ "name": "constant.character.escape.mcfunction"
345
+ }
346
+ },
347
+ "match": "\\\\",
348
+ "name": "meta.literals_string-double"
349
+ },
350
+ {
351
+ "include": "#macro-name"
352
+ },
353
+ {
354
+ "captures": {
355
+ "0": {
356
+ "name": "string.quoted.single.mcfunction"
357
+ }
358
+ },
359
+ "match": "[^\\\\']",
360
+ "name": "meta.literals_string-single"
361
+ }
362
+ ]
363
+ },
364
+ "say": {
365
+ "patterns": [
366
+ {
367
+ "begin": "^(\\s*)(say)",
368
+ "beginCaptures": {
369
+ "1": {
370
+ "name": "whitespace.mcfunction"
371
+ },
372
+ "2": {
373
+ "name": "keyword.control.flow.mcfunction"
374
+ }
375
+ },
376
+ "end": "\\n",
377
+ "name": "meta.say.mcfunction",
378
+ "patterns": [
379
+ {
380
+ "captures": {
381
+ "0": {
382
+ "name": "constant.character.escape.mcfunction"
383
+ }
384
+ },
385
+ "match": "\\\\\\s*\\n",
386
+ "meta": "meta.say.backslash.mcfunction"
387
+ },
388
+ {
389
+ "include": "#literals_string-double"
390
+ },
391
+ {
392
+ "include": "#literals_string-single"
393
+ }
394
+ ]
395
+ },
396
+ {
397
+ "begin": "(run)(\\s+)(say)",
398
+ "beginCaptures": {
399
+ "1": {
400
+ "name": "entity.name.mcfunction"
401
+ },
402
+ "2": {
403
+ "name": "whitespace.mcfunction"
404
+ },
405
+ "3": {
406
+ "name": "keyword.control.flow.mcfunction"
407
+ }
408
+ },
409
+ "end": "\\n",
410
+ "name": "meta.say.mcfunction",
411
+ "patterns": [
412
+ {
413
+ "captures": {
414
+ "0": {
415
+ "name": "constant.character.escape.mcfunction"
416
+ }
417
+ },
418
+ "match": "\\\\\\s*\\n",
419
+ "meta": "meta.say.backslash.mcfunction"
420
+ },
421
+ {
422
+ "include": "#literals_string-double"
423
+ },
424
+ {
425
+ "include": "#literals_string-single"
426
+ }
427
+ ]
428
+ }
429
+ ]
430
+ },
431
+ "names": {
432
+ "patterns": [
433
+ {
434
+ "captures": {
435
+ "1": {
436
+ "name": "whitespace.mcfunction"
437
+ },
438
+ "2": {
439
+ "name": "keyword.control.flow.mcfunction"
440
+ }
441
+ },
442
+ "match": "^(\\s*)([a-z_]+)(?=\\s)",
443
+ "name": "meta.names"
444
+ },
445
+ {
446
+ "captures": {
447
+ "1": {
448
+ "name": "whitespace.mcfunction"
449
+ },
450
+ "2": {
451
+ "name": "markup.italic.mcfunction"
452
+ },
453
+ "3": {
454
+ "name": "whitespace.mcfunction"
455
+ },
456
+ "4": {
457
+ "name": "keyword.control.flow.mcfunction"
458
+ }
459
+ },
460
+ "match": "^(\\s*)(\\$)( ?)([a-z_]*)",
461
+ "name": "meta.names"
462
+ },
463
+ {
464
+ "captures": {
465
+ "1": {
466
+ "name": "entity.name.mcfunction"
467
+ },
468
+ "2": {
469
+ "name": "whitespace.mcfunction"
470
+ },
471
+ "3": {
472
+ "name": "keyword.control.flow.mcfunction"
473
+ }
474
+ },
475
+ "match": "(run)(\\s+)([a-z_]+)",
476
+ "name": "meta.names"
477
+ },
478
+ {
479
+ "include": "#resource-name"
480
+ },
481
+ {
482
+ "captures": {
483
+ "0": {
484
+ "name": "entity.name.mcfunction"
485
+ }
486
+ },
487
+ "match": "[A-Za-z]+(?=\\W)",
488
+ "name": "meta.names"
489
+ },
490
+ {
491
+ "captures": {
492
+ "0": {
493
+ "name": "string.unquoted.mcfunction"
494
+ }
495
+ },
496
+ "match": "[A-Za-z_][A-Za-z0-9_.#%$]*",
497
+ "name": "meta.names"
498
+ },
499
+ {
500
+ "include": "#macro-name"
501
+ },
502
+ {
503
+ "captures": {
504
+ "0": {
505
+ "name": "variable.other.mcfunction"
506
+ }
507
+ },
508
+ "match": "([#%$]|((?<=\\s)\\.))[A-Za-z0-9_.#%$\\-]+",
509
+ "name": "meta.names"
510
+ }
511
+ ]
512
+ },
513
+ "macro-name": {
514
+ "patterns": [
515
+ {
516
+ "captures": {
517
+ "1": {
518
+ "name": "punctuation.definition.template-expression.begin.mcfunction"
519
+ },
520
+ "2": {
521
+ "name": "variable.other.mcfunction"
522
+ },
523
+ "3": {
524
+ "name": "punctuation.definition.template-expression.end.mcfunction"
525
+ }
526
+ },
527
+ "match": "(\\$\\()([A-Za-z0-9_]*)(\\))",
528
+ "name": "meta.macro-name"
529
+ }
530
+ ]
531
+ },
532
+ "operators": {
533
+ "patterns": [
534
+ {
535
+ "captures": {
536
+ "0": {
537
+ "name": "constant.numeric.mcfunction"
538
+ }
539
+ },
540
+ "match": "[~^]",
541
+ "name": "meta.operators"
542
+ },
543
+ {
544
+ "captures": {
545
+ "0": {
546
+ "name": "keyword.operator.mcfunction"
547
+ }
548
+ },
549
+ "match": "[\\-%?!+*<>\\\\/|&=.:,;]",
550
+ "name": "meta.operators"
551
+ }
552
+ ]
553
+ },
554
+ "property": {
555
+ "patterns": [
556
+ {
557
+ "applyEndPatternLast": 1,
558
+ "begin": "\\{",
559
+ "captures": {
560
+ "0": {
561
+ "name": "punctuation.mcfunction"
562
+ }
563
+ },
564
+ "end": "\\}",
565
+ "name": "meta.property.curly",
566
+ "patterns": [
567
+ {
568
+ "include": "#resource-name"
569
+ },
570
+ {
571
+ "include": "#literals"
572
+ },
573
+ {
574
+ "include": "#property_key"
575
+ },
576
+ {
577
+ "include": "#operators"
578
+ },
579
+ {
580
+ "include": "#property_value"
581
+ },
582
+ {
583
+ "include": "$self"
584
+ }
585
+ ]
586
+ },
587
+ {
588
+ "applyEndPatternLast": 1,
589
+ "begin": "\\[",
590
+ "captures": {
591
+ "0": {
592
+ "name": "variable.other.mcfunction"
593
+ }
594
+ },
595
+ "end": "\\]",
596
+ "name": "meta.property.square",
597
+ "patterns": [
598
+ {
599
+ "include": "#resource-name"
600
+ },
601
+ {
602
+ "include": "#literals"
603
+ },
604
+ {
605
+ "include": "#property_key"
606
+ },
607
+ {
608
+ "include": "#operators"
609
+ },
610
+ {
611
+ "include": "#property_value"
612
+ },
613
+ {
614
+ "include": "$self"
615
+ }
616
+ ]
617
+ },
618
+ {
619
+ "applyEndPatternLast": 1,
620
+ "begin": "\\(",
621
+ "captures": {
622
+ "0": {
623
+ "name": "punctuation.mcfunction"
624
+ }
625
+ },
626
+ "end": "\\)",
627
+ "name": "meta.property.paren",
628
+ "patterns": [
629
+ {
630
+ "include": "#resource-name"
631
+ },
632
+ {
633
+ "include": "#literals"
634
+ },
635
+ {
636
+ "include": "#property_key"
637
+ },
638
+ {
639
+ "include": "#operators"
640
+ },
641
+ {
642
+ "include": "#property_value"
643
+ },
644
+ {
645
+ "include": "$self"
646
+ }
647
+ ]
648
+ }
649
+ ]
650
+ },
651
+ "property_key": {
652
+ "patterns": [
653
+ {
654
+ "captures": {
655
+ "0": {
656
+ "name": "variable.other.mcfunction"
657
+ }
658
+ },
659
+ "match": "#?[a-z_][a-z_\\.\\-]*\\:[a-z0-9_\\.\\-/]+(?=\\s*\\=:)",
660
+ "name": "meta.property_key"
661
+ },
662
+ {
663
+ "captures": {
664
+ "0": {
665
+ "name": "variable.other.mcfunction"
666
+ }
667
+ },
668
+ "match": "#?[a-z_][a-z0-9_\\.\\-/]+",
669
+ "name": "meta.property_key"
670
+ },
671
+ {
672
+ "captures": {
673
+ "0": {
674
+ "name": "variable.other.mcfunction"
675
+ }
676
+ },
677
+ "match": "[A-Za-z_]+[A-Za-z_\\-\\+]*",
678
+ "name": "meta.property_key"
679
+ }
680
+ ]
681
+ },
682
+ "property_value": {
683
+ "patterns": [
684
+ {
685
+ "captures": {
686
+ "0": {
687
+ "name": "string.unquoted.mcfunction"
688
+ }
689
+ },
690
+ "match": "#?[a-z_][a-z_\\.\\-]*\\:[a-z0-9_\\.\\-/]+",
691
+ "name": "meta.property_value"
692
+ },
693
+ {
694
+ "captures": {
695
+ "0": {
696
+ "name": "string.unquoted.mcfunction"
697
+ }
698
+ },
699
+ "match": "#?[a-z_][a-z0-9_\\.\\-/]+",
700
+ "name": "meta.property_value"
701
+ }
702
+ ]
703
+ },
704
+ "resource-name": {
705
+ "patterns": [
706
+ {
707
+ "captures": {
708
+ "0": {
709
+ "name": "entity.name.function.mcfunction"
710
+ }
711
+ },
712
+ "match": "#?[a-z_][a-z0-9_.-]*:[a-z0-9_./-]+",
713
+ "name": "meta.resource-name"
714
+ },
715
+ {
716
+ "captures": {
717
+ "0": {
718
+ "name": "entity.name.function.mcfunction"
719
+ }
720
+ },
721
+ "match": "#?[a-z0-9_\\.\\-]+\\/[a-z0-9_\\.\\-\\/]+",
722
+ "name": "meta.resource-name"
723
+ }
724
+ ]
725
+ },
726
+ "selectors": {
727
+ "patterns": [
728
+ {
729
+ "captures": {
730
+ "0": {
731
+ "name": "support.class.mcfunction"
732
+ }
733
+ },
734
+ "match": "@[a-z]+",
735
+ "name": "meta.selectors"
736
+ }
737
+ ]
738
+ }
739
+ }
740
+ }