-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
source.yaml.salt.js
194 lines (192 loc) · 6.28 KB
/
source.yaml.salt.js
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
// This is a TextMate grammar distributed by `starry-night`.
// This grammar is developed at
// <https://github.com/saltstack/atom-salt>
// and licensed `mit`.
// See <https://github.com/wooorm/starry-night> for more info.
/**
* @import {Grammar} from '@wooorm/starry-night'
*/
/** @type {Grammar} */
const grammar = {
dependencies: ['source.python'],
extensions: ['.sls'],
names: ['saltstack', 'saltstate', 'salt'],
patterns: [
{include: '#jinja-control'},
{include: '#jinja-value'},
{
begin: '^(\\s*)(?:(-)|(?:(-\\s*)?(\\w+\\s*(:))))\\s*(\\||>)',
beginCaptures: {
2: {name: 'punctuation.definition.entry.yaml'},
3: {name: 'punctuation.definition.entry.yaml'},
4: {name: 'entity.name.tag.yaml'},
5: {name: 'punctuation.separator.key-value.yaml'}
},
end: '^(?!^\\1)|^(?=\\1(-|\\w+\\s*:)|#)',
name: 'string.unquoted.block.yaml',
patterns: [{include: '#jinja-control'}, {include: '#jinja-value'}]
},
{
captures: {
1: {name: 'punctuation.definition.entry.yaml'},
2: {name: 'entity.name.tag.yaml'},
3: {name: 'punctuation.separator.key-value.yaml'},
4: {name: 'punctuation.definition.entry.yaml'}
},
match:
'(?:(?:(-\\s*)?(\\w+\\s*(:)))|(-))\\s*((0(x|X)[0-9a-fA-F]*)|(([0-9]+\\.?[0-9]*)|(\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?)(L|l|UL|ul|u|U|F|f)?\\s*$',
name: 'constant.numeric.yaml'
},
{
captures: {
1: {name: 'punctuation.definition.entry.yaml'},
10: {name: 'punctuation.definition.string.end.yaml'},
11: {name: 'string.unquoted.yaml'},
2: {name: 'entity.name.tag.yaml'},
3: {name: 'punctuation.separator.key-value.yaml'},
4: {name: 'punctuation.definition.entry.yaml'},
5: {name: 'string.quoted.double.yaml'},
6: {name: 'punctuation.definition.string.begin.yaml'},
7: {name: 'punctuation.definition.string.end.yaml'},
8: {name: 'string.quoted.single.yaml'},
9: {name: 'punctuation.definition.string.begin.yaml'}
},
match:
'(?:(?:(-\\s*)?(\\w+\\s*(:)))|(-))\\s*(?:((")[^"]*("))|((\')[^\']*(\'))|([^,{}&#\\[\\]]+))\\s*',
name: 'string.unquoted.yaml'
},
{
captures: {
1: {name: 'punctuation.definition.entry.yaml'},
2: {name: 'entity.name.tag.yaml'},
3: {name: 'punctuation.separator.key-value.yaml'},
4: {name: 'punctuation.definition.entry.yaml'}
},
match:
'(?:(?:(-\\s*)?(\\w+\\s*(:)))|(-))\\s*([0-9]{4}-[0-9]{2}-[0-9]{2})\\s*$',
name: 'constant.other.date.yaml'
},
{
captures: {
1: {name: 'entity.name.tag.yaml'},
2: {name: 'punctuation.separator.key-value.yaml'},
3: {name: 'keyword.other.omap.yaml'},
4: {name: 'punctuation.definition.keyword.yaml'}
},
match: '(\\w.*?)(:)\\s*((\\!\\!)omap)?',
name: 'meta.tag.yaml'
},
{
captures: {1: {name: 'punctuation.definition.variable.yaml'}},
match: '(\\&|\\*)\\w.*?$',
name: 'variable.other.yaml'
},
{
begin: '"',
beginCaptures: {0: {name: 'punctuation.definition.string.begin.yaml'}},
end: '"',
endCaptures: {0: {name: 'punctuation.definition.string.end.yaml'}},
name: 'string.quoted.double.yaml',
patterns: [
{include: '#escaped_char'},
{include: '#jinja-control'},
{include: '#jinja-value'}
]
},
{
begin: "'",
beginCaptures: {0: {name: 'punctuation.definition.string.begin.yaml'}},
end: "'",
endCaptures: {0: {name: 'punctuation.definition.string.end.yaml'}},
name: 'string.quoted.single.yaml',
patterns: [
{include: '#escaped_char'},
{include: '#jinja-control'},
{include: '#jinja-value'}
]
},
{
begin: '`',
beginCaptures: {0: {name: 'punctuation.definition.string.begin.yaml'}},
end: '`',
endCaptures: {0: {name: 'punctuation.definition.string.end.yaml'}},
name: 'string.interpolated.yaml',
patterns: [{include: '#escaped_char'}, {include: '#jinja-control'}]
},
{
captures: {
1: {name: 'entity.name.tag.yaml'},
2: {name: 'keyword.operator.merge-key.yaml'},
3: {name: 'punctuation.definition.keyword.yaml'}
},
match: '(\\<\\<): ((\\*).*)$',
name: 'keyword.operator.merge-key.yaml'
},
{
begin: '(^[ \\t]+)?(?<!\\$)(?=#)(?!#\\{)',
beginCaptures: {1: {name: 'punctuation.whitespace.comment.leading.yaml'}},
end: '(?!\\G)',
patterns: [
{
begin: '#',
beginCaptures: {0: {name: 'punctuation.definition.comment.yaml'}},
end: '\\n',
name: 'comment.line.number-sign.yaml'
}
]
},
{match: '-', name: 'keyword.operator.symbol'},
{
begin: '^(?=\\t)',
end: '(?=[^\\t])',
name: 'meta.leading-tabs.yaml',
patterns: [
{
captures: {1: {name: 'meta.odd-tab'}, 2: {name: 'meta.even-tab'}},
match: '(\\t)(\\t)?'
}
]
}
],
repository: {
escaped_char: {match: '\\\\.', name: 'constant.character.escape.yaml'},
'jinja-control': {
begin: '\\{%+(?!>)=?',
beginCaptures: {0: {name: 'punctuation.definition.embedded.begin.jinja'}},
contentName: 'source.python',
end: '(%)\\}',
endCaptures: {0: {name: 'punctuation.definition.embedded.end.jinja'}},
name: 'meta.embedded.line.jinja',
patterns: [
{
captures: {1: {name: 'punctuation.definition.comment.jinja'}},
match: '(#).*?(?=%>)',
name: 'comment.line.number-sign.jinja'
},
{include: 'source.python'}
]
},
'jinja-value': {
begin: '\\{\\{(?!\\})',
beginCaptures: {
0: {name: 'punctuation.definition.embedded.begin.jinja-value'}
},
contentName: 'source.python',
end: '\\}\\}',
endCaptures: {
0: {name: 'punctuation.definition.embedded.end.jinja-value'}
},
name: 'meta.embedded.line.jinja',
patterns: [
{
captures: {1: {name: 'punctuation.definition.comment.jinja-value'}},
match: '(#).*?(?=%>)',
name: 'comment.line.number-sign.jinja-value'
},
{include: 'source.python'}
]
}
},
scopeName: 'source.yaml.salt'
}
export default grammar