-
Notifications
You must be signed in to change notification settings - Fork 0
/
aoe2-rms.YAML-tmLanguage
115 lines (98 loc) · 2.72 KB
/
aoe2-rms.YAML-tmLanguage
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
# [PackageDev] target_format: plist, ext: tmLanguage
---
name: AoE2 Random Map Script
scopeName: source.aoe2-rms
fileTypes: [rms]
uuid: 0b2a431f-f33a-4fdb-97db-f9974ad80a0a
patterns:
- include: '#multilineComment'
- include: '#sectionHeader'
- include: '#conditional'
- include: '#random'
- include: '#command'
- include: '#directive'
repository:
multilineComment:
name: comment.block.aoe2-rms
begin: /\*
end: \*/
sectionHeader:
name: storage.type.section.aoe2-rms
match: \<[A-Z_]+\>
conditional:
patterns:
- include: '#conditionalStart'
- include: '#conditionalEnd'
random:
patterns:
- include: '#randomStart'
- include: '#randomEnd'
- include: '#randomChance'
command:
patterns:
- include: '#commandStatement'
- include: '#commandBlock'
directive:
name: meta.directive.aoe2-rms
begin: \#(const|define|include_drs)\b
beginCaptures:
'0': { name: keyword.other.directive.aoe2-rms }
end: (?=\n|/\*)
patterns:
- include: '#number'
- include: '#identifier'
conditionalStart:
name: meta.conditional.aoe2-rms
match: (if|elseif|else)(\s+(\b[^\s!@#\$%\^&\*\(\)\-\+=;:'"<>{}\[\]\?\/\\][^\s;'"<>{}\[\]\/\\]*\b))?
captures:
'1': { name: keyword.control.conditional.aoe2-rms }
'3': { name: variable.other.const.aoe2-rms }
conditionalEnd:
name: keyword.control.conditional.aoe2-rms
match: endif
randomStart:
name: keyword.control.random.aoe2-rms
match: \bstart_random\b
randomEnd:
name: keyword.control.random.aoe2-rms
match: \bend_random\b
randomChance:
name: meta.random.chance.aoe2-rms
match: \b(percent_chance)\s+(\d+)
captures:
'1': { name: keyword.control.random.aoe2-rms }
'2': { name: constant.numeric.aoe2-rms }
commandStatement:
name: meta.command.aoe2-rms
begin: \b[a-z_]+
beginCaptures:
'0': { name: entity.name.function.aoe2-rms }
end: (?=\n|/\*|\{)
patterns:
- include: '#number'
- include: '#identifier'
commandBlock:
name: meta.commandBlock.aoe2-rms
begin: \{
beginCaptures:
'0': { name: punctuation.definition.mapping.begin.aoe2-rms }
end: \}
endCaptures:
'0': { name: punctuation.definition.mapping.end.aoe2-rms }
patterns:
- include: '#conditional'
- include: '#random'
- include: '#directive'
- include: '#attribute'
- include: '#number'
- include: '#identifier'
- include: '#multilineComment'
attribute:
name: variable.parameter.attribute.aoe2-rms
match: \b[a-z_]+
identifier:
name: variable.other.const.aoe2-rms
match: \b[^\s!@#\$%\^&\*\(\)\-\+=;:'"<>{}\[\]\?\/\\][^\s;'"<>{}\[\]\/\\]*\b
number:
name: constant.numeric.aoe2-rms
match: \b\d+\b