-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathmcfunction.vim
More file actions
executable file
·1759 lines (1480 loc) · 93.8 KB
/
mcfunction.vim
File metadata and controls
executable file
·1759 lines (1480 loc) · 93.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
if exists("b:current_syntax")
finish
endif
if (!exists('g:mcJSONMethod') || g:mcJSONMethod =~ '\v\c<e%[xternal]>')
syn match mcJSONText contained /.\+/ contains=@mcjson
syn match mcjsonNumber contained /\v-?(0|[1-9]\d*)(\.\d*)?([eE](0|[1-9]\d*))?/
hi def link mcjsonNumber jsonNumber
syn include @mcJSON syntax/json.vim
syn cluster mcJSON add=mcjsonNumber,jsonString
" Proof that at some point we should be able to add our own 'special' keywords
"syn keyword mcjsonKeyword contained containedin=jsonKeyword color
"hi def link mcjsonKeyword mcKeyword
let b:current_syntax='mcfunction'
endif
syn match mcAnySpace contained / /
hi def link mcAnySpace mcBadWhitespace
let s:path = fnamemodify(resolve(expand('<sfile>:p')), ':h').'/'
" MC Version identifier
" This REALLY needs to be re-worked
function! s:toNumericVersion(name)
if a:name =~ '\c\<c\%[ombat]'
let l:num = matchstr(a:name,'\d\+$')
if l:num == 1
return s:toNumericVersion('1.14.3p4')
elseif l:num == 2
return s:toNumericVersion('1.14.4')
elseif l:num == 3
return s:toNumericVersion('1.14.4')
elseif l:num == 4
return s:toNumericVersion('1.15p3')
elseif l:num == 5
return s:toNumericVersion('1.15.2p2')
endif
elseif a:name =~ '\c\d\dw\d\d\w'
let l:year=matchstr(a:name,'^\c\d\+\zew')
let l:week=matchstr(a:name,'\cw\zs\d\+')
let l:day=tr(substitute(matchstr(a:name,'\a$'),'^','\L',''), 'zabcdefghi', '0123456789')
return l:year*10000 + l:week*100 + l:day
else
let l:result=0
if a:name =~ '1.13.1'
return s:addOffset('18w33z',a:name)
elseif a:name =~ '1.13.2'
return s:addOffset('18w42z',a:name)
elseif a:name =~ '1.13'
return s:addOffset('18w23z',a:name)
elseif a:name =~ '1.14.1'
return s:addOffset('19w19z',a:name)
elseif a:name =~ '1.14.2'
return s:addOffset('19w20z',a:name)
elseif a:name =~ '1.14.3'
return s:addOffset('19w23z',a:name)
elseif a:name =~ '1.14.4'
return s:addOffset('19w27z',a:name)
elseif a:name =~ '1.14'
return s:addOffset('19w15z',a:name)
elseif a:name =~ '1.15.1'
return s:addOffset('19w50z',a:name)
elseif a:name =~ '1.15.2'
return s:addOffset('20w03z',a:name)
elseif a:name =~ '1.15'
return s:addOffset('19w47z',a:name)
elseif a:name =~ '1.16.1'
return s:addOffset('20w26z',a:name)
elseif a:name =~ '1.16.[2-5]'
return s:addOffset('20w33z',a:name)
elseif a:name =~ '1.16'
return s:addOffset('20w26y',a:name)
elseif a:name =~ '1.17'
return s:addOffset('21w24z',a:name)
elseif a:name =~ '1.18'
return s:addOffset('21w49z',a:name)
endif
endif
endfunction
function! s:addOffset(snapshot,name)
let l:result=s:toNumericVersion(a:snapshot)
" take the week the first prerelease occurs converted to a string,
" add 30+n for prereleases, 60+n for release candidates, 99 for release.
" and hope and pray mojang doesn't start two prerelease sequences in one week.
if a:name =~ '\cp'
" prerelease
return l:result + 30 + matchstr(a:name,'\d\+$')
elseif a:name =~ '\cc'
" release candidate
return l:result + 60 + matchstr(a:name,'\d\+$')
else
" release
return l:result + 99
endif
endfunction
function! s:atLeastVersion(version)
return s:toNumericVersion(a:version) <= s:numericVersion
endfunction
function! s:getVersionFromHeader()
for s:line in getline(1,'$')
if s:line =~ '^\s*$'
" blank, do nothing
continue
elseif s:line !~ '^\s*#'
" end of header
break
endif
let l:attempt = matchstr(s:line, '\v\c<%(\d{2}w\d{1,2}\a+|\d+%(\.\d+)*%(-*%(p%[rerelease]|p%[re-release]|%(r%[elease-])?c%[andidate])-*\d+)?|c%[ombat]%[-test]%[-snapshot]-?\d+)>')
if l:attempt != ''
return l:attempt
endif
endfor
return ''
endfunction
" Determine minecraft version
if !exists('b:mcversion')
let b:mcversion=s:getVersionFromHeader()
if b:mcversion == ''
if exists('g:mcversion')
let b:mcversion=g:mcversion
else
let b:mcversion='release'
endif
endif
let b:determinedMcVersion=1
endif
let s:numericVersion=0
let s:combatVersion=0
if b:mcversion=~'\<l\%[atest]\>'
let s:numericVersion = 9999999
else
let s:versions = readfile(s:path.'currentmcversions')
let s:auto = 0
if b:mcversion=~'\<r\%[elease]\>'
let s:numericVersion= max([s:numericVersion,s:toNumericVersion(s:versions[0])])
let s:auto = 1
endif
if b:mcversion=~'\<p\%[rerelease]\>'
let s:numericVersion= max([s:numericVersion,s:toNumericVersion(s:versions[1])])
let s:auto = 1
endif
if b:mcversion=~'\<s\%[napshot]\>'
let s:numericVersion= max([s:numericVersion,s:toNumericVersion(s:versions[2])])
let s:auto = 1
endif
if b:mcversion=~'\<e\%[xperimental]\>'
let s:numericVersion= max([s:numericVersion,s:toNumericVersion(s:versions[3])])
let s:auto = 1
endif
if b:mcversion=~'\<c\%[andidate]\>'
let s:numericVersion= max([s:numericVersion,s:toNumericVersion(s:versions[4])])
let s:auto = 1
endif
if !s:auto
let s:numericVersion = s:toNumericVersion(b:mcversion)
endif
endif
" Determine the experimental combat version
if b:mcversion =~ '\<e\%[xperimental]\>\'
let s:combatVersion=9999999
elseif b:mcversion =~ '|\<c\%[ombat]'
let s:combatVersion=matchstr(b:mcversion,'\<c\%[ombat]\s*\zs\d\+')
endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Miscellaneous Values
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Numbers
syn match mcInt contained nextgroup=mcBadDecimal /\v<0*%(-?1?\d{,9}|-?2%(0\d{,8}|1%([0-3]\d{,7}|4%([0-6]\d{,6}|7%([0-3]\d{,5}|4%([0-7]\d{,4}|8%([0-2]\d{,3}|3%([0-5]\d{,2}|6%([0-3]\d|4[0-7]))))))))|-0*2147483648)>/
"2147483648
syn match mcUInt contained nextgroup=mcBadDecimal /\v<0*%(1?\d{,9}|2%(0\d{,8}|1%([0-3]\d{,7}|4%([0-6]\d{,6}|7%([0-3]\d{,5}|4%([0-7]\d{,4}|8%([0-2]\d{,3}|3%([0-5]\d{,2}|6%([0-3]\d|4[0-7])))))))))>/
" 6 digit uint
syn match mcUIntE6 contained nextgroup=mcBadDecimal /\<0*\d\{1,6}\>/
" 6 bit uint including 2^6
syn match mcUInt6i contained nextgroup=mcBadDecimal /\v<0*%(6[0-4]|[1-5]\d)>/
" 8 bit uint
syn match mcUInt8 contained nextgroup=mcBadDecimal /\v<0*%([0-1]?\d{,2}|2%([0-4]\d|5[0-5]))>/
syn match mcUFloat contained /\(\d*\.\)\?\d\+/
syn match mcFloat contained /-\?\(\d*\.\)\?\d\+/
hi def link mcUInt mcInt
hi def link mcUIntE6 mcInt
hi def link mcUInt6i mcInt
hi def link mcUInt8 mcInt
hi def link mcUFloat mcFloat
hi def link mcInt mcValue
hi def link mcFloat mcValue
syn match mcUIntRange contained contains=mcBadDecimal,mcUInt,mcRangeDots /\d*\%(\.\+\d*\)\?/
syn match mcIntRange contained contains=mcBadDecimal,mcInt,mcRangeDots /-\?\d*\%(\.\+-\?\d*\)\?/
syn match mcUFloatRange contained contains=mcUFloat,mcRangeDots /[[:digit:].]*\%(\.\.[[:digit:].]*\)\?/
syn match mcFloatRange contained contains=mcFloat,mcRangeDots /[[:digit:].-]*\%(\.\.[[:digit:].-]*\)\?/
syn match mcRangeDots contained /\.\./
hi def link mcRangeDots mcValue
syn match mcGlob /\*/ contained
hi def link mcGlob mcOp
syn keyword mcBool contained true false
hi def link mcBool mcKeyword
" Optional Slash
syn match mcOptionalSlash /^\/\?/ nextgroup=mcCommand
hi def link mcOptionalSlash mcCommand
" Errors
syn match mcError /.*/ contained
syn match mcDoubleSpace / \@1<= \+\| \{2,}/ contained
syn match mcBadWhitespace /\t/
syn match mcBadDecimal /\.\ze\_[^.]/ contained
syn match mcFourDots /\.\{4,}/ contained containedin=ALLBUT,mcChatMessage
syn match mcTheRestIsBad /\S.*/ contained
syn match mcCommand `.\zs/` contains=mcError
hi def link mcDoubleSpace mcBadWhitespace
hi def link mcBadDecimal mcError
hi def link mcFourDots mcError
hi def link mcBadWhitespace mcError
hi def link mcTheRestIsBad mcError
syn sync minlines=1
syn match mcComment /^#.*/
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Entity Block
" initializes both Entity and Block with respective keywords
" not to be confused with a 'Block Entity'
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function! s:mcSelectorBlock(group,nextgroup)
execute 'syn keyword mcSelectorBlock'.a:group 'entity contained skipwhite nextgroup=mcDoubleSpace,mcSelector'.a:group
execute 'syn keyword mcSelectorBlock'.a:group 'block contained skipwhite nextgroup=mcDoubleSpace,mcCoordinate'.a:group
call s:addInstance('Selector',a:group,a:nextgroup)
call s:addInstance('Coordinate',a:group,a:nextgroup)
execute 'hi def link mcSelectorBlock'.a:group 'mcKeyword'
endfunction
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Entity Block Storage
" initializes all three similarly to EntityBlock
" not to be confused with a 'Block Entity'
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function! s:mcEBS(group,nextgroup)
execute 'syn keyword mcEBS'.a:group 'entity contained skipwhite nextgroup=mcDoubleSpace,mcSelector'.a:group
execute 'syn keyword mcEBS'.a:group 'block contained skipwhite nextgroup=mcDoubleSpace,mcCoordinate'.a:group
call s:addInstance('Selector',a:group,a:nextgroup)
call s:addInstance('Coordinate',a:group,a:nextgroup)
if s:atLeastVersion('19w38a')
execute 'syn keyword mcEBS'.a:group 'storage contained skipwhite nextgroup=mcDoubleSpace,mcStorage'.a:group
call s:addInstance('Storage',a:group,a:nextgroup)
endif
execute 'hi def link mcEBS'.a:group 'mcKeyword'
endfunction
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Taggable thing
" for blocks, items, and entities
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function! s:addTaggableInstance(type,group,nextgroup)
execute 'syn match mcTaggable'.a:type.a:group '/[^ =,\]\t\r\n]\+/ contained skipwhite nextgroup=mcDoubleSpace,'.a:nextgroup 'contains=@mcTaggable'.a:type
endfunction
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Add Instance
" Adding 'Ns' to the beginning of a type makes it allow
" namespaces
" Adding 'T' to the beginning allows it to be a tag
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function! s:addInstance(type,group,nextgroup)
if a:type=~ 'Selector'
execute 'syn match mc'.a:type.a:group 'contained /\v\S+(\[[^\]]*\])?\ze\_[ ]/ contains=mc'.a:type 'skipwhite nextgroup=mcDoubleSpace,'.a:nextgroup
execute 'syn cluster mcSelectorFilter add=mc'.a:type.a:group
elseif a:type=~ 'Coordinate'
execute 'syn match mc'.a:type.a:group 'contained /\v(\S+\s+){2}\S+/ contains=mc'.a:type 'skipwhite nextgroup=mcDoubleSpace,'.a:nextgroup
elseif a:type=~ 'Column|Rotation'
execute 'syn match mc'.a:type.a:group 'contained /\S\+\s\+\S\+/ contains=mc'.a:type 'skipwhite nextgroup=mcDoubleSpace,'.a:nextgroup
elseif a:type=~ 'NBTPath'
execute 'syn match mcNBTPath'.a:group '/.\@1<=\w\+/ contained nextgroup=@mcNBTContinue'.a:group ',mcNBTPathPad'.a:group
execute 'syn region mcNBTPath'.a:group 'matchgroup=mcNBTQuote start=/.\@1<="/ end=/"/ skip=/\\"/ oneline contained nextgroup=@mcNBTContinue'.a:group ',mcNBTPathPad'.a:group
execute 'syn region mcNBTArray'.a:group 'matchgroup=mcNBTBracket start=/.\@1<=\[/rs=e end=/]/ oneline contained contains=mcNBTIndex,mcNBTTagP nextgroup=@mcNBTContinue'.a:group ',mcNBTPathPad'.a:group
execute 'syn region mcNBTTagP'.a:group 'matchgroup=mcNBTBracket start=/.\@1<={/rs=e end=/}/ oneline contained contains=mcNBTTagKey nextgroup=@mcNBTContinue'.a:group ',mcNBTPathPad'.a:group
execute 'syn match mcNBTPathDot'.a:group '/\./ contained nextgroup=mcNBTPath'.a:group ',mcNBTPathPad'.a:group
execute 'syn cluster mcNBTPath'.a:group 'contains=mcNBTPath'.a:group.',mcNBTTagP'.a:group
execute 'syn cluster mcNBTContinue'.a:group 'contains=mcNBTTagP'.a:group.',mcNBTArray'.a:group.',mcNBTPathDot'.a:group
execute 'syn cluster mcNBT' 'add=mcNBTPath'.a:group.',mcNBTArray'.a:group.',mcNBTTagP'.a:group.',mcNBTPathDot'.a:group.',mcNBTPathPad'.a:group
execute 'hi def link mcNBTPath'.a:group 'mcNBTPath'
execute 'hi def link mcNBTPathDot'.a:group 'mcNBTPathDot'
execute 'syn match mcNBTPathPad'.a:group '/\ze\_[ ]/ contained skipwhite nextgroup=mcDoubleSpace,'.a:nextgroup
elseif a:type=~ 'NBTTag'
execute 'syn region mcNBTTag'.a:group 'matchgroup=mcNBTBracket start=/.\@1<={/rs=e end=/}/ oneline contained contains=mcNBTTagKey skipwhite nextgroup=mcNBTPad'.a:group
execute 'syn cluster mcNBT add=mcNBTTag'.a:group.',mcNBTPad'.a:group
execute 'syn match mcNBTPad'.a:group '/\ze\_[ ]/ skipwhite contained nextgroup=mcDoubleSpace,'.a:nextgroup
elseif a:type=~ 'Block$'
execute 'syn match mc'.a:type.a:group '/#\?[[:alnum:]_:]\+/ contained contains=mcSimple'.a:type 'skipwhite nextgroup=mcDoubleSpace,mcBadBlockWhitespace,mcBlockState'.a:type.a:group.',mcNBTTag'.a:type.a:group.','.a:nextgroup
call s:addInstance('BlockState',a:type.a:group,a:nextgroup.',mcBadBlockWhitespace,mcNBTTag'.a:type.a:group)
call s:addInstance('NBTTag',a:type.a:group,a:nextgroup)
elseif a:type=~ 'Item$'
execute 'syn match mc'.a:type.a:group '/#\?[[:alnum:]_:]\+/ contained contains=mcSimple'.a:type 'skipwhite nextgroup=mcDoubleSpace,mcBadBlockWhitespace,mcNBTTag'.a:type.a:group.','.a:nextgroup
call s:addInstance('NBTTag',a:type.a:group,a:nextgroup)
elseif a:type=~ 'Entity$'
execute 'syn match mc'.a:type.a:group '/#\?[[:alnum:]_:]\+/ contained contains=mcSimple'.a:type 'skipwhite nextgroup=mcDoubleSpace,'.a:nextgroup
elseif a:nextgroup == ""
execute 'syn match mc'.a:type.a:group '/[^ =,\t\r\]\n]\+/ contained contains=mc'.a:type
else
execute 'syn match mc'.a:type.a:group '/[^ =,\t\r\]\n]\+/ contained contains=mc'.a:type 'skipwhite nextgroup=mcDoubleSpace,'.a:nextgroup
endif
endfunction
call s:addInstance('NBTPath',"","")
call s:addInstance('NBTTag','','')
call s:addInstance('Block','','')
call s:addInstance('NsTBlock','','')
call s:addInstance('NsTEntity','','')
call s:addInstance('NsBlock','','')
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" SP COMMANDS
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" /Advancement
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
syn keyword mcCommand advancement contained skipwhite nextgroup=mcDoubleSpace,mcAdvanceKeyword
syn keyword mcAdvanceKeyword contained skipwhite nextgroup=mcDoubleSpace,mcSelectorAdvance grant revoke
call s:addInstance('Selector',"Advance","mcAdvanceWhich")
syn keyword mcAdvanceWhich contained everything
syn keyword mcAdvanceWhich contained skipwhite nextgroup=mcDoubleSpace,mcNsAdvancementViaCriteria only
call s:addInstance('NsAdvancement','ViaCriteria','mcAdvancementCriteria')
syn keyword mcAdvanceWhich contained skipwhite nextgroup=mcDoulbleSpace,mcAdvancement from through until
hi def link mcAdvanceWhich mcKeyword
hi def link mcAdvanceKeyword mcKeyword
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" /Attribute
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if s:atLeastVersion('20w17a')
syn keyword mcCommand attribute contained skipwhite nextgroup=mcDoubleSpace,mcSelectorAttr
call s:addInstance('Selector','Attr','mcNsAttributeAttr')
call s:addInstance('NsAttribute','Attr','mcAttrKeyword')
syn keyword mcAttrKeyword contained skipwhite nextgroup=mcDoubleSpace,mcFloat get
syn keyword mcAttrKeyword contained skipwhite nextgroup=mcDoubleSpace,mcAttrBaseKeyword base
syn keyword mcAttrBaseKeyword contained skipwhite nextgroup=mcDoubleSpace,mcFloat get set
syn keyword mcAttrKeyword contained skipwhite nextgroup=mcDoubleSpace,mcAttrModKeyword modifier
syn keyword mcAttrModKeyword contained skipwhite nextgroup=mcDoubleSpace,mcAttrModGet value
syn keyword mcAttrModGet contained skipwhite nextgroup=mcDoubleSpace,mcUUIDAttrModScale get
call s:addInstance('UUID','AttrModScale','mcFloat')
syn keyword mcAttrModKeyword contained skipwhite nextgroup=mcDoubleSpace,mcUUID remove
syn keyword mcAttrModKeyword contained skipwhite nextgroup=mcDoubleSpace,mcUUIDAttrModAdd add
call s:addInstance('UUID','AttrModAdd','mcAttrModAddName')
syn match mcAttrModAddName contained skipwhite nextgroup=mcDoubleSpace,mcFloatAttrModAdd /'\([^\\']\|\\[\\']\)*'/
syn match mcAttrModAddName contained skipwhite nextgroup=mcDoubleSpace,mcFloatAttrModAdd /"\([^\\"]\|\\[\\"]\)*"/
syn match mcAttrModAddName contained skipwhite nextgroup=mcDoubleSpace,mcFloatAttrModAdd /[a-zA-Z0-9_.+-]\+/
call s:addInstance('Float','AttrModAdd','mcAttrModAddMode')
syn keyword mcAttrModAddMode contained skipwhite nextgroup=mcDoubleSpace,mcFloatAttrModAdd add multiply multiply_base
hi def link mcAttrKeyword mcKeyword
hi def link mcAttrBaseKeyword mcKeyword
hi def link mcAttrModGet mcKeyword
hi def link mcAttrModKeyword mcKeyword
hi def link mcAttrModAddMode mcKeyword
hi def link mcAttrModAddName mcValue
endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" /Bossbar
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
syn keyword mcCommand bossbar contained skipwhite nextgroup=mcDoubleSpace,mcBossbarKeyword
" Bossbar add
syn keyword mcBossbarKeyword contained skipwhite nextgroup=mcDoubleSpace,mcNsBossbarIdAdd add
call s:addInstance('NsBossbarId','Add','mcJSONText')
" Bossbar get
syn keyword mcBossbarKeyword contained skipwhite nextgroup=mcDoubleSpace,mcNsBossbarIdGet get
call s:addInstance('NsBossbarId','Get','mcBossbarGetKeyword')
syn keyword mcBossbarGetKeyword contained max players value visible
" Bossbar list
syn keyword mcBossbarKeyword contained list
" Bossbar remove
syn keyword mcBossbarKeyword contained skipwhite nextgroup=mcDoubleSpace,mcNsBossbarId remove
" Bossbar set
syn keyword mcBossbarKeyword contained skipwhite nextgroup=mcDoubleSpace,mcNsBossbarIdSet set
call s:addInstance('NsBossbarId','Set','mcBossbarSetKeyword')
syn keyword mcBossbarSetKeyword contained skipwhite nextgroup=mcDoubleSpace,mcBossbarSetColor color
syn keyword mcBossbarSetColor contained blue green pink purple red white yellow
syn keyword mcBossbarSetKeyword contained skipwhite nextgroup=mcDoubleSpace,mcUInt max value
syn keyword mcBossbarSetKeyword contained skipwhite nextgroup=mcDoubleSpace,mcJSONText name
syn keyword mcBossbarSetKeyword contained skipwhite nextgroup=mcDoubleSpace,mcSelector players
syn keyword mcBossbarSetKeyword contained skipwhite nextgroup=mcDoubleSpace,mcBossbarSetStyle style
syn keyword mcBossbarSetStyle contained progress notched_6 notched_10 notched_12 notched_20
syn keyword mcBossbarSetKeyword contained skipwhite nextgroup=mcDoubleSpace,mcBool visible
" Links
hi def link mcBossbarKeyword mcKeyword
hi def link mcBossbarGetKeyword mcKeyword
hi def link mcBossbarSetKeyword mcKeyword
hi def link mcBossbarSetColor mcKeyword
hi def link mcBossbarSetStyle mcKeyword
hi def link mcBossbarIdAdd mcId
hi def link mcBossbarIdExecuteStore mcId
hi def link mcBossbarIdSet mcId
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" /Clear
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
syn keyword mcCommand clear contained skipwhite nextgroup=mcDoubleSpace,mcPlayerSelectorClear
call s:addInstance('PlayerSelector',"Clear","mcNsTItemClear")
call s:addInstance('NsTItem','Clear','mcUInt')
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" /Clone
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
syn keyword mcCommand clone contained skipwhite nextgroup=mcDoubleSpace,mcCoordinateClone
call s:addInstance('Coordinate', "Clone","mcCoordinate2Clone")
call s:addInstance('Coordinate2', "Clone","mcCoordinate3Clone")
call s:addInstance('Coordinate3', "Clone","mcCloneMask")
syn keyword mcCloneMask contained skipwhite nextgroup=mcDoubleSpace,mcCloneMode masked replace
syn keyword mcCloneMask contained skipwhite nextgroup=mcDoubleSpace,mcNsTBlockClone filtered
hi def link mcCloneMask mcKeyword
call s:addInstance('NsTBlock','Clone','mcCloneMode')
syn keyword mcCloneMode contained force move normal
hi def link mcCloneMode mcKeyword
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" /Debug
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if s:atLeastVersion('1.14.4p1')
syn keyword mcCommand debug contained skipwhite nextgroup=mcDoubleSpace,mcDebugKeyword
syn keyword mcDebugKeyword contained start stop
if s:atLeastVersion('21w15a')
" This cannot be run inside of functions, but it exists
" syn match mcDebugKeyword contained skipwhite contains=mcError nextgroup=mcDoubleSpace,mcFunction
endif
if !s:atLeastVersion('1.17p1')
syn keyword mcDebugKeyword contained report
endif
endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" /Data
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
syn keyword mcCommand data contained skipwhite nextgroup=mcDoubleSpace,mcDataKeyword
" Data get
syn keyword mcDataKeyword contained skipwhite nextgroup=mcDoubleSpace,mcEBSDataGet get
call s:mcEBS('DataGet','@mcNBTPathDataGet')
call s:addInstance('NBTPath',"DataGet","mcFloatDataGetScale")
call s:addInstance('Float','DataGetScale','')
" Data merge
syn keyword mcDataKeyword contained skipwhite nextgroup=mcDoubleSpace,mcEBSDataMerge merge
call s:mcEBS('DataMerge','mcNBTTag')
" Data modify
if s:atLeastVersion('18w43a')
syn keyword mcDataKeyword contained skipwhite nextgroup=mcDoubleSpace,mcEBSDataModify modify
call s:mcEBS('DataModify','@mcNBTPathDataModify')
call s:addInstance('NBTPath',"DataModify","mcDataModifyHow")
syn keyword mcDataModifyHow contained skipwhite nextgroup=mcDoubleSpace,mcDataModifySource append merge prepend set
syn keyword mcDataModifySource contained skipwhite nextgroup=mcDoubleSpace,@mcNBTValue value
syn keyword mcDataModifySource contained skipwhite nextgroup=mcDoubleSpace,mcEBSDataRemove from
syn keyword mcDataModifyHow contained skipwhite nextgroup=mcDoubleSpace,mcUIntDataModifyIndex insert
call s:addInstance('UInt', 'DataModifyIndex', 'mcDataModifySource')
endif
" Data remove
syn keyword mcDataKeyword contained skipwhite nextgroup=mcDoubleSpace,mcEBSDataRemove remove
call s:mcEBS('DataRemove','@mcNBTPath')
" Links
hi def link mcDataKeyword mcKeyword
hi def link mcDataModifyHow mcKeyword
hi def link mcDataModifySource mcKeyword
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" /Datapack
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
syn keyword mcCommand datapack contained skipwhite nextgroup=mcDoubleSpace,mcDatapackKeyword
" Datapack disable
syn keyword mcDatapackKeyword contained skipwhite nextgroup=mcDoubleSpace,mcDatapackName disable
syn match mcDatapackName contained /\w\+/
" Datapack enable
syn keyword mcDatapackKeyword contained skipwhite nextgroup=mcDoubleSpace,mcDatapackNameEnable enable
syn match mcDatapackNameEnable contained skipwhite nextgroup=mcDoubleSpace,mcDatapackEnableKeyword /\w\+/
syn keyword mcDatapackEnableKeyword contained first last
syn keyword mcDatapackEnableKeyword contained skipwhite nextgroup=mcDoubleSpace,mcDatapackNameEnableRel before after
syn match mcDatapackNameEnableRel contained /\w\+/
" Datapack list
syn keyword mcDatapackKeyword contained skipwhite nextgroup=mcDoubleSpace,mcDatapackListKeyword list
syn keyword mcDatapackListKeyword contained enabled available
hi def link mcDatapackEnableKeyword mcKeyword
hi def link mcDatapackListKeyword mcKeyword
hi def link mcDatapackKeyword mcKeyword
hi def link mcDatapackNameEnable mcDatapackName
hi def link mcDatapackNameEnableRel mcDatapackName
hi def link mcDatapackName mcId
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" /Difficulty
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
syn keyword mcCommand difficulty contained skipwhite nextgroup=mcDoubleSpace,mcDifficulty
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" /Effect
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
syn keyword mcCommand effect contained skipwhite nextgroup=mcDoubleSpace,mcEffectKeyword
" Effect give
syn keyword mcEffectKeyword contained skipwhite nextgroup=mcDoubleSpace,mcSelectorEffectGive give
call s:addInstance('Selector', "EffectGive", "mcNsEffectGive")
call s:addInstance('NsEffect','Give','mcUIntE6EffectSeconds')
call s:addInstance('UIntE6','EffectSeconds','mcEffectAmp')
call s:addInstance('UInt8','EffectAmp','mcEffectBool')
" Effect clear
syn keyword mcEffectKeyword contained skipwhite nextgroup=mcDoubleSpace,mcSelectorEffectClear clear
call s:addInstance('Selector', "EffectClear", "mcEffect")
" Links
hi def link mcEffectKeyword mcKeyword
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" /Enchant
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
syn keyword mcCommand enchant contained skipwhite nextgroup=mcDoubleSpace,mcSelectorEnchant
call s:addInstance('Selector',"Enchant", "mcNsEnchantmentEnchant")
call s:addInstance('NsEnchantment','Enchant','mcEnchantLevel')
syn match mcEnchantLevel contained /[1-5]/ skipwhite nextgroup=mcTheRestIsBad
hi def link mcEnchantLevel mcValue
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" /Execute
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
syn keyword mcCommand execute contained skipwhite nextgroup=mcDoubleSpace,mcExecuteKeyword
" Execute align
syn keyword mcExecuteKeyword contained skipwhite nextgroup=mcDoubleSpace,mcExecuteAlignValue align
syn match mcExecuteAlignValue contained skipwhite nextgroup=mcDoubleSpace,mcExecuteKeyword /\v<%(x%([^ ]*x)@!|y%([^ ]*y)@!|z%([^ ]*z)@!){1,3}>/
" Execute anchored
syn keyword mcExecuteKeyword contained skipwhite nextgroup=mcDoubleSpace,mcExecuteAnchoredValue anchored
syn keyword mcExecuteAnchoredValue contained skipwhite nextgroup=mcDoubleSpace,mcExecuteKeyword eyes feet
" Execute as/at
syn keyword mcExecuteKeyword contained skipwhite nextgroup=mcDoubleSpace,mcSelectorExecute at as
call s:addInstance('Selector',"Execute", "mcExecuteKeyword")
" Execute facing
syn keyword mcExecuteKeyword contained skipwhite nextgroup=mcDoubleSpace,mcExecuteFacingEntityKeyword,mcCoordinateExecute facing
syn keyword mcExecuteFacingEntityKeyword contained skipwhite nextgroup=mcDoubleSpace,mcSelectorExecuteFacing entity
call s:addInstance('Selector', "ExecuteFacing", "mcExecuteAnchoredValue")
" Execute in
syn keyword mcExecuteKeyword contained skipwhite nextgroup=mcDoubleSpace,mcNsDimensionExecuteIn in
call s:addInstance("NsDimension","ExecuteIn","mcExecuteKeyword")
" Execute positioned
syn keyword mcExecuteKeyword contained skipwhite nextgroup=mcDoubleSpace,mcCoordinateExecute,mcExecuteAs positioned
syn keyword mcExecuteAs contained skipwhite nextgroup=mcDoubleSpace,mcSelectorExecute as
call s:addInstance('Coordinate',"Execute","mcExecuteKeyword")
" Execute rotated
syn keyword mcExecuteKeyword contained skipwhite nextgroup=mcDoubleSpace,mcRotationExecute,mcExecuteAs rotated
call s:addInstance('Rotation',"Execute","mcExecuteKeyword")
" Execute run
syn keyword mcExecuteKeyword contained skipwhite nextgroup=mcDoubleSpace,mcCommand run
" Execute store
"""""""""""""""""""""""""
syn keyword mcExecuteKeyword contained skipwhite nextgroup=mcDoubleSpace,mcExecuteStoreWhat store
syn keyword mcExecuteStoreWhat contained skipwhite nextgroup=mcDoubleSpace,mcExecuteStoreWhere,mcEBSExecuteStore result success
" block/entity
call s:mcEBS('ExecuteStore','@mcNBTPathExecuteStore')
call s:addInstance('NBTPath',"ExecuteStore","mcExecuteStoreType")
syn keyword mcExecuteStoreType contained skipwhite nextgroup=mcDoubleSpace,mcFloatExecuteStoreScale byte short int long float double
call s:addInstance('Float','ExecuteStoreScale','mcExecuteKeyword')
" bossbar
syn keyword mcExecuteStoreWhere contained skipwhite nextgroup=mcDoubleSpace,mcNsBossbarIdExecuteStore bossbar
call s:addInstance('NsBossbarId','ExecuteStore','mcExecuteStoreBossbarFeild')
syn keyword mcExecuteStoreBossbarFeild contained skipwhite nextgroup=mcDoubleSpace,mcExecuteKeyword max value
" score
syn keyword mcExecuteStoreWhere contained skipwhite nextgroup=mcDoubleSpace,mcSelectorExecuteStoreScore score
call s:addInstance('Selector',"ExecuteStoreScore", "mcObjectiveExecuteStore")
call s:addInstance("Objective","ExecuteStore","mcExecuteKeyword")
" Execute if/unless
"""""""""""""""""""""""
syn keyword mcExecuteKeyword contained skipwhite nextgroup=mcDoubleSpace,mcExecuteCond if unless
" block
syn keyword mcExecuteCond contained skipwhite nextgroup=mcDoubleSpace,mcCoordinateExecuteCondBlock block
call s:addInstance('Coordinate',"ExecuteCondBlock","mcNsTBlockExecute")
call s:addInstance("NsTBlock","Execute","mcExecuteKeyword")
" blocks
syn keyword mcExecuteCond contained skipwhite nextgroup=mcDoubleSpace,mcCoordinateExecuteCondStart blocks
call s:addInstance('Coordinate',"ExecuteCondStart","mcCoordinate2ExecuteCondEnd")
call s:addInstance('Coordinate2',"ExecuteCondEnd","mcCoordinate3ExecuteCondDest")
call s:addInstance('Coordinate3',"ExecuteCondDest","mcExecuteCondBlocksMask")
syn keyword mcExecuteCondBlocksMask contained skipwhite nextgroup=mcDoubleSpace,mcExecuteKeyword all masked
" data
if s:atLeastVersion('18w43a')
syn keyword mcExecuteCond contained skipwhite nextgroup=mcDoubleSpace,mcEBSExecuteCondData data
call s:mcEBS('ExecuteCondData','@mcNBTPathExecute')
call s:addInstance('NBTPath', "Execute","mcExecuteKeyword")
endif
" entity
syn keyword mcExecuteCond contained skipwhite nextgroup=mcDoubleSpace,mcSelectorExecuteCond entity
call s:addInstance('Selector', "ExecuteCond", "mcExecuteKeyword")
" score
syn keyword mcExecuteCond contained skipwhite nextgroup=mcDoubleSpace,mcSelectorExecuteCondScoreTarget score
call s:addInstance('Selector', "ExecuteCondScoreTarget","mcObjectiveExecuteCondScoreTarget")
call s:addInstance('Objective','ExecuteCondScoreTarget','mcExecuteCondScoreOp,mcExecuteCondScoreMatch')
syn match mcExecuteCondScoreOp contained skipwhite nextgroup=mcDoubleSpace,mcSelectorExecuteCondScoreSource /[<>=]\@=[<>]\?=\?/
call s:addInstance('Selector', "ExecuteCondScoreSource","mcObjectiveExecuteCondScoreSource")
call s:addInstance('Objective','ExecuteCondScoreSource','mcExecuteKeyword')
syn keyword mcExecuteCondScoreMatch contained skipwhite nextgroup=mcDoubleSpace,mcIntRangeExecuteScore matches
call s:addInstance('IntRange','ExecuteScore','mcExecuteKeyword')
" predicate
if s:atLeastVersion('19w38a')
syn keyword mcExecuteCond contained skipwhite nextgroup=mcDoubleSpace,mcNsPredicateExecuteCond predicate
call s:addInstance('NsPredicate','ExecuteCond','mcExecuteKeyword')
endif
" Links
hi def link mcExecuteAsKeyword mcExecuteKeyword
hi def link mcExecuteKeyword mcKeyword
hi def link mcExecuteAs mcKeyword
hi def link mcExecuteCond mcKeyword
hi def link mcExecuteCondData mcKeyword
hi def link mcExecuteCondScoreMatch mcKeyword
hi def link mcExecuteFacingEntityKeyword mcKeyword
hi def link mcExecuteFacingKeyword mcKeyword
hi def link mcExecuteStoreBossbarFeild mcKeyword
hi def link mcExecuteStoreWhat mcKeyword
hi def link mcExecuteStoreWhere mcKeyword
hi def link mcExecuteAlignValue mcKeyword
hi def link mcExecuteAnchoredValue mcKeyword
hi def link mcExecuteCondBlocksMask mcKeyword
hi def link mcExecuteStoreType mcKeyword
hi def link mcExecuteIR1 mcValue
hi def link mcExecuteIR2 mcValue
hi def link mcExecuteRangeInf mcValue
hi def link mcExecuteCondScoreOp mcOp
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" /Fill
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
syn keyword mcCommand fill contained skipwhite nextgroup=mcDoubleSpace,mcCoordinateFill
call s:addInstance('Coordinate', "Fill","mcCoordinate2Fill")
call s:addInstance('Coordinate2', "Fill","mcNsBlockFill")
call s:addInstance('NsBlock',"Fill","mcFillMode")
syn keyword mcFillMode contained destroy hollow keep outline
syn keyword mcFillMode contained skipwhite nextgroup=mcDoubleSpace,mcNsTBlockFillReplace replace
call s:addInstance('NsTBlock',"FillReplace","")
hi def link mcFillMode mcKeyword
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" /Forceload
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
syn keyword mcCommand forceload contained skipwhite nextgroup=mcDoubleSpace,mcForceloadKeyword
" Forceload add
syn keyword mcForceloadKeyword contained skipwhite nextgroup=mcDoubleSpace,mcColumnForceloadStart add
call s:addInstance('Column',"ForceloadStart","mcColumn2")
" Forceload remove
syn keyword mcForceloadKeyword contained skipwhite nextgroup=mcDoubleSpace,mcColumnForceloadStart,mcForceloadRemKeyword remove
syn keyword mcForceloadRemKeyword contained all
" Forceload query
syn keyword mcForceloadKeyword contained skipwhite nextgroup=mcDoubleSpace,mcColumn query
" Links
hi def link mcForceloadRemKeyword mcForceloadKeyword
hi def link mcForceloadKeyword mcKeyword
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" /Function
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
syn keyword mcCommand function contained skipwhite nextgroup=mcDoubleSpace,mcFunction
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" /Gamemode
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
syn keyword mcCommand defaultgamemode contained skipwhite nextgroup=mcDoubleSpace,mcGamemode
syn keyword mcCommand gamemode contained skipwhite nextgroup=mcDoubleSpace,mcGamemodeSet
call s:addInstance('Gamemode','Set','mcSelector')
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" /Gamerule
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
syn keyword mcCommand gamerule contained skipwhite nextgroup=mcDoubleSpace,mcGamerule
hi def link mcGamerule mcKeyId
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" /Give
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
syn keyword mcCommand give contained skipwhite nextgroup=mcDoubleSpace,mcPlayerSelectorGive
call s:addInstance('PlayerSelector',"Give", "mcNsItemGive")
call s:addInstance('NsItem','Give','mcUInt')
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" /Help
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
syn keyword mcCommand help contained skipwhite nextgroup=mcDoubleSpace,mcUInt,mcHelpCommand
syn keyword mcHelpCommand contained advancement bossbar clear clone data datapack debug defaultgamemode difficulty effect enchant execute experience fill forceload function gamemode gamerule give help kill list locate loot me msg paraticle playsound recipe reload replaceitem say scoreboard seed setblock setworldspawn spawnpoint spreadplayers stopsound summon tag team teleport teammsg tell tellraw time title tp trigger w weather worldborder xp
if s:atLeastVersion('18w43a')
if s:atLeastVersion('18w45a')
syn keyword mcHelpCommand contained loot
else
syn keyword mcHelpCommand contained drop
endif
syn keyword mcHelpCommand contained schedule
endif
if s:atLeastVersion('20w17a')
syn keyword mcHelpCommand contained attribute
endif
hi def link mcHelpCommand mcCommand
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" /Item (formerly but still internally Replaceitem)
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if s:atLeastVersion('21w19a')
syn keyword mcCommand contained skipwhite nextgroup=mcDoubleSpace,mcReplaceitemKeyword item
syn keyword mcReplaceitemKeyword contained skipwhite nextgroup=mcDoubleSpace,mcReplaceitemReplaceTarget replace
call s:mcSelectorBlock('ReplaceitemReplaceTarget','ReplaceitemReplaceSlot')
call s:addInstance('Slot','ReplaceitemSlot','ReplaceitemReplaceKeyword')
syn keyword mcReplaceitemReplaceKeyword contained skipwhite nextgroup=mcDoubleSpace,mcReplaceitemWith with
call s:addInstance('NsItem', 'ReplaceitemWith', 'mcUInt')
syn keyword mcReplaceitemReplaceKeyword contained skipwhite nextgroup=mcDoubleSpace,mcReplaceitemFrom from
call s:mcSelectorBlock('ReplaceitemFrom','ReplaceitemModifyTarget')
syn keyword mcReplaceitemKeyword contained skipwhite nextgroup=mcDoubleSpace,mcReplaceitemModifyTarget modify
call s:mcSelectorBlock('ReplaceitemModifyTarget','JSON')
hi def link mcReplaceitemReplaceKeyword mcReplaceitemKeyword
hi def link mcReplaceitemKeyword mcKeyword
else
if s:atLeastVersion('20w46a')
syn keyword mcCommand contained skipwhite nextgroup=mcDoubleSpace,mcSelectorBlockReplaceitem item
else
syn keyword mcCommand contained skipwhite nextgroup=mcDoubleSpace,mcSelectorBlockReplaceitem replaceitem
endif
call s:mcSelectorBlock('Replaceitem','mcSlotReplaceitem')
call s:addInstance('Slot','Replaceitem','mcNsItemReplaceitem')
call s:addInstance('NsItem','Replaceitem','mcUInt')
endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" /Kick
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
syn keyword mcCommand kick contained skipwhite nextgroup=mcDoubleSpace,mcSelectorKick
call s:addInstance('Selector','Kick','mcChatMessage')
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" /Kill
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
syn keyword mcCommand kill contained skipwhite nextgroup=mcDoubleSpace,mcSelector
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" /List
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
syn keyword mcCommand list contained skipwhite nextgroup=mcDoubleSpace,mcListUUIDs
syn keyword mcListUUIDs contained uuids
hi def link mcListUUIDs mcKeyword
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" /Locate
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
syn keyword mcCommand locate contained skipwhite nextgroup=mcDoubleSpace,mcLocatableStructure
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" /Locatebiome
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if s:atLeastVersion('20w06a')
syn keyword mcCommand locatebiome contained skipwhite nextgroup=mcDoubleSpace,mcBiome
endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" /Loot
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if s:atLeastVersion('18w43a')
if s:atLeastVersion('18w45a')
syn keyword mcCommand loot contained skipwhite nextgroup=mcDoubleSpace,mcLootTargetKeyword
else
syn keyword mcCommand drop contained skipwhite nextgroup=mcDoubleSpace,mcLootTargetKeyword
endif
" TODO add /drop award
" Target
syn keyword mcLootTargetKeyword contained skipwhite nextgroup=mcDoubleSpace,mcCoordinateLoot spawn insert
call s:addInstance('Coordinate', "Loot","mcLootSourceKeyword")
syn keyword mcLootTargetKeyword contained skipwhite nextgroup=mcDoubleSpace,mcSelectorLoot give
call s:addInstance('Selector', "Loot", "mcLootSourceKeyword")
syn keyword mcLootTargetKeyword contained skipwhite nextgroup=mcDoubleSpace,mcSelectorBlockLootReplace replace
call s:mcSelectorBlock('LootReplace','mcSlotLoot')
call s:addInstance('Slot','Loot','mcUInt6iLootCount,mcLootSourceKeyword')
call s:addInstance('UInt6i','LootCount','mcLootSourceKeyword')
" Source
syn keyword mcLootSourceKeyword contained skipwhite nextgroup=mcDoubleSpace,mcLootTableFish fish
call s:addInstance('LootTable','Fish','mcLootFishingLocation')
syn match mcLootFishingLocation contained skipwhite nextgroup=mcDoubleSpace,mcNsItem,mcLootHand /\w\+/
syn keyword mcLootSourceKeyword contained skipwhite nextgroup=mcDoubleSpace,mcLootTable loot
syn keyword mcLootSourceKeyword contained skipwhite nextgroup=mcDoubleSpace,mcSelector kill
syn keyword mcLootSourceKeyword contained skipwhite nextgroup=mcDoubleSpace,mcCoordinateLootMine mine
call s:addInstance('Coordinate', "LootMine","mcNsItem,mcLootHand")
syn keyword mcLootHand contained mainhand offhand
" Links
hi def link mcLootTargetKeyword mcKeyword
hi def link mcLootReplaceKeyword mcKeyword
hi def link mcLootSourceKeyword mcKeyword
hi def link mcLootHand mcKeyword
hi def link mcLootTableFish mcLootTable
hi def link mcLootTable mcId
hi def link mcLootFishingLocation mcId
hi def link mcLootCount mcUInt
endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" /Msg
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
syn keyword mcCommand msg w tell me contained skipwhite nextgroup=mcDoubleSpace,mcSelectorMsg
syn keyword mcCommand say contained skipwhite nextgroup=mcDoubleSpace,mcChatMessage
if s:atLeastVersion('19w02a')
syn keyword mcCommand teammsg tm contained skipwhite nextgroup=mcDoubleSpace,mcChatMessage
endif
call s:addInstance('Selector', "Msg", "mcChatMessage")
syn match mcChatMessage contained /.*/
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" /Particle
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
syn keyword mcCommand contained skipwhite nextgroup=mcDoubleSpace,mcNsParticleParticle particle
call s:addInstance('NsParticle', 'Particle','mcCoordinateParticle')
call s:addInstance('Coordinate', 'Particle','mcCoordinate2Particle')
call s:addInstance('Coordinate2', 'Particle','mcUFloatParticleSpeed')
call s:addInstance('UFloat','ParticleSpeed','mcUIntParticleCount')
call s:addInstance('UInt','ParticleCount','mcParticleMode')
syn keyword mcParticleMode contained skipwhite nextgroup=mcDoubleSpace,mcSelector force normal
hi def link mcParticleMode mcKeyword
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" /Perf /Jfr
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
syn keyword mcCommand contained skipwhite nextgroup=mcDoubleSpace,mcPerfKeyword perf
if s:atLeastVersion('21w37a')
syn keyword mcCommand contained skipwhite nextgroup=mcDoubleSpace,mcPerfKeyword jfr
endif
syn keyword mcPerfKeyword contained skipwhite start stop
hi def link mcPerfKeyword mcKeyword
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" /Placefeature
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
syn keyword mcCommand contained skipwhite nextgroup=mcDoubleSpace,mcFeaturePlace placefeature
call s:addInstance('Feature', 'Place', 'mcCoordinate')
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" /Playsound
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
syn keyword mcCommand contained skipwhite nextgroup=mcDoubleSpace,mcNsSoundPlay playsound
call s:addInstance('NsSound','Play','mcSoundChannelPlay')
call s:addInstance('SoundChannel','Play','mcSelectorPlaysound')
call s:addInstance('Selector', 'Playsound','mcCoordinatePlaysound')
call s:addInstance('Coordinate', 'Playsound','mcUFloatPlaysoundVol')
call s:addInstance('UFloat','PlaysoundVol','mcPlaysoundPitch')
syn match mcPlaysoundPitch contained skipwhite nextgroup=mcDoubleSpace,mcPlaysoundMinVolume /0*1\?\.\d\+\|0*2\(\.0*\)\?\ze\_[ ]/
syn match mcPlaysoundMinVolume contained /0*\.\d\+\|0*1\(\.0*\)\?\ze\_[ ]/
hi def link mcPlaysoundPitch mcUFloat
hi def link mcPlaysoundMinVolume mcUFloat
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" /Recipe
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
syn keyword mcCommand contained skipwhite nextgroup=mcDoubleSpace,mcRecipeKeyword recipe
syn keyword mcRecipeKeyword contained skipwhite nextgroup=mcDoubleSpace,mcSelectorRecipe give take
call s:addInstance('Selector', 'Recipe', 'mcRecipe,mcGlob')
hi def link mcRecipeKeyword mcKeyword
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" /Schedule
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if s:atLeastVersion('18w43a')
syn keyword mcCommand contained skipwhite nextgroup=mcDoubleSpace,mcScheduleKeyword schedule
syn keyword mcScheduleKeyword contained skipwhite nextgroup=mcDoubleSpace,mcNamespacedFunctionSchedule function
call s:addInstance('NamespacedFunction','Schedule','mcScheduleTime')
syn match mcScheduleTime contained skipwhite nextgroup=mcDoubleSpace,mcScheduleMode /\d\+[dst]\?/
if s:atLeastVersion('19w38a')
syn keyword mcScheduleKeyword contained skipwhite nextgroup=mcDoubleSpace,mcFunction clear
syn keyword mcScheduleMode contained append replace
hi def link mcScheduleMode mcKeyword
endif
hi def link mcScheduleKeyword mcKeyword
hi def link mcScheduleTime mcValue
endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" /Scoreboard
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
syn keyword mcCommand scoreboard contained skipwhite nextgroup=mcDoubleSpace,mcScoreboardKeyword
" players
syn keyword mcScoreboardKeyword contained skipwhite nextgroup=mcDoubleSpace,mcScoreboardPlayers players
syn keyword mcScoreboardPlayers contained skipwhite nextgroup=mcDoubleSpace,mcSelectorScoreboardSet add remove set
call s:addInstance('Selector', 'ScoreboardSet','mcObjectiveScoreboardSet')
call s:addInstance('Objective','ScoreboardSet','mcInt')
syn keyword mcScoreboardPlayers contained skipwhite nextgroup=mcDoubleSpace,mcSelectorScoreboardGet enable reset get
call s:addInstance('Selector', 'ScoreboardGet','mcObjective')
syn keyword mcScoreboardPlayers contained skipwhite nextgroup=mcDoubleSpace,mcSelector list
syn keyword mcScoreboardPlayers contained skipwhite nextgroup=mcDoubleSpace,mcSelectorScoreboardOp operation
call s:addInstance('Selector', 'ScoreboardOp','mcObjectiveScoreboardOpTarget')
call s:addInstance('Objective','ScoreboardOpTarget','mcScoreboardOp')
syn match mcScoreboardOp contained skipwhite nextgroup=mcDoubleSpace,mcSelectorScoreboardGet /[%*/+-]\?=\|><\?\|</
" objectives
syn keyword mcScoreboardKeyword contained skipwhite nextgroup=mcDoubleSpace,mcScoreboardObjectives objectives
syn keyword mcScoreboardObjectives contained skipwhite nextgroup=mcDoubleSpace,mcObjectiveObjAdd add
call s:addInstance('Objective','ObjAdd','mcCriteriaObjAdd')