-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBitBake.sublime-syntax
More file actions
387 lines (337 loc) · 11.4 KB
/
Copy pathBitBake.sublime-syntax
File metadata and controls
387 lines (337 loc) · 11.4 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
%YAML 1.2
---
# https://docs.yoctoproject.org/bitbake/
# https://www.sublimetext.com/docs/syntax.html
name: BitBake
scope: source.bitbake
file_extensions:
- bb
- bbappend
- bbclass
- conf
- inc
contexts:
main:
- include: comments
- include: directives
- include: python-function-definitions
- include: bitbake-function-definitions
- include: function-calls
- include: namespaces
- include: strings
- include: variable-assignments
expressions:
- include: function-calls
- include: strings
- include: namespaces
- include: variables
### [ COMMENTS ] ##############################################################
comments:
- match: \#
scope: punctuation.definition.comment.bitbake
push: inside-comment
inside-comment:
- meta_scope: comment.line.bitbake
- match: $\n?
pop: true
### [ DIRECTIVES ] ############################################################
directives:
- match: ^\s*(EXPORT_FUNCTIONS)\b
captures:
1: keyword.control.directive.bitbake
push: inside-export-directive
- match: ^\s*(addfragments|inherit|inherit_defer|include|include_all|require)\b
captures:
1: keyword.control.directive.bitbake
push: inside-import-directive
- match: ^\s*(addpylib)\b
captures:
1: keyword.control.directive.bitbake
push: inside-pylib-directive
- match: ^\s*(addhandler)\b
captures:
1: keyword.control.directive.bitbake
push: inside-handler-directive
- match: ^\s*(addtask|deltask)\b
captures:
1: keyword.control.directive.bitbake
push:
- inside-task-directive
- inside-task-directive-name
- match: ^\s*(unset)\b
captures:
1: keyword.control.directive.bitbake
push: inside-unset-directive
inside-export-directive:
- meta_scope: meta.directive.export.bitbake
- include: eol-pop
- match: '{{identifier}}'
scope: entity.name.function.bitbake
inside-handler-directive:
- meta_scope: meta.directive.handler.bitbake
- include: eol-pop
- include: expressions
inside-import-directive:
- meta_scope: meta.directive.import.bitbake
- include: eol-pop
- include: strings
- include: unquoted-strings
inside-pylib-directive:
- meta_scope: meta.directive.pylib.bitbake
- include: eol-pop
- include: expressions
inside-task-directive-name:
- match: '{{identifier}}'
scope: entity.name.task.bitbake
pop: true
- include: else-pop
inside-task-directive:
- meta_scope: meta.directive.task.bitbake
- include: eol-pop
- match: \b(before|after)\b
scope: keyword.control.directive.bitbake
- include: expressions
inside-unset-directive:
- meta_scope: meta.directive.unset.bitbake
- include: eol-pop
- include: expressions
### [ BITBAKE FUNCTION DEFINITIONS ]###########################################
bitbake-function-definitions:
- match: ^(?:(fakeroot)\s+)?(python)\b
captures:
1: storage.modifier.bitbake
2: storage.type.bitbake
push: bitbake-python-function
- match: ^(({{identifier}})(?:(:)(append|prepend)?)?\s*)?(\()(\))(\s*)({)
captures:
1: meta.function.identifier.bitbake
2: entity.name.function.bitbake
3: punctuation.accessor.colon.bitbake
4: support.function.bitbake
5: meta.function.parameters.bitbake meta.group.bitbake punctuation.section.group.begin.bitbake
6: meta.function.parameters.bitbake meta.group.bitbake punctuation.section.group.end.bitbake
7: meta.function.bitbake.bitbake
8: meta.function.body.bitbake meta.block.bitbake punctuation.section.block.begin.bitbake
embed: scope:source.shell
embed_scope: meta.function.body.bitbake meta.block.bitbake source.shell.embedded.bitbake
escape: ^(\s*(\}))\s*$
escape_captures:
1: meta.function.body.bitbake meta.block.bitbake
2: punctuation.section.block.end.bitbake
bitbake-python-function:
- meta_scope: meta.function.bitbake
- match: (({{identifier}})(?:(:)(append|prepend)?)?\s*)?(\()(\))(\s*)({)
captures:
1: meta.function.identifier.bitbake
2: entity.name.function.bitbake
3: punctuation.accessor.colon.bitbake
4: support.function.bitbake
5: meta.function.parameters.bitbake meta.group.bitbake punctuation.section.group.begin.bitbake
6: meta.function.parameters.bitbake meta.group.bitbake punctuation.section.group.end.bitbake
7: meta.function.bitbake.bitbake
8: meta.function.body.bitbake meta.block.bitbake punctuation.section.block.begin.bitbake
embed: scope:source.python
embed_scope: meta.function.body.bitbake meta.block.bitbake source.python.embedded.bitbake
escape: ^(\s*(\}))\s*$
escape_captures:
1: meta.function.body.bitbake meta.block.bitbake
2: punctuation.section.block.end.bitbake
pop: true
- include: else-pop
### [ PYTHON FUNCTION DEFINITIONS ]############################################
python-function-definitions:
# Note: Implement own simple python function signature implementation
# for backward compatibility with ST3
- match: ^def\b
scope: meta.function.python keyword.declaration.function.python
push:
- python-function-body
- python-function-name
python-function-name:
- meta_scope: meta.function.python
- match: \w+
scope: entity.name.function.python
set: python-function-parameter-list
- include: python-function-parameter-list
python-function-parameter-list:
- meta_include_prototype: false
- meta_content_scope: meta.function.python
- match: \(
scope: meta.function.parameters.python punctuation.section.parameters.begin.python
set: python-function-parameter-list-body
- include: python-function-signature-end
python-function-parameter-list-body:
- meta_content_scope: meta.function.parameters.python
- match: \)
scope: meta.function.parameters.python punctuation.section.parameters.end.python
set: python-function-signature-end
- match: ','
scope: punctuation.separator.comma.python
- match: '{{identifier}}'
scope: variable.parameter.python
python-function-signature-end:
- meta_content_scope: meta.function.python
- match: ':'
scope: meta.function.python punctuation.section.block.begin.python
pop: true
- include: eol-pop
python-function-body:
- meta_include_prototype: false
- meta_scope: source.python.embedded.bitbake
- match: ^
pop: true
- match: ''
embed: scope:source.python
embed_scope: source.python.embedded.bitbake meta.function.body.python meta.block.python
escape: ^(?=\S)
### [ VARIABLE DEFINITIONS ]###################################################
variable-assignments:
- match: ^\s*(?:(export)\s+)?({{identifier}})
captures:
1: storage.modifier.bitbake
2: variable.other.bitbake
push:
- variable-assignment-value
- variable-assignment-operator
- variable-assignment-condition
variable-assignment-condition:
- match: \[
scope: punctuation.section.brackets.begin.bitbake
set: inside-dependency-list
- match: (:)(append|prepend)\b
captures:
1: punctuation.accessor.colon.bitbake
2: support.function.bitbake
- match: (:)({{identifier}})
captures:
1: punctuation.accessor.colon.bitbake
2: storage.modifier.bitbake
- match: ''
pop: true
inside-dependency-list:
- meta_scope: meta.flags.bitbake meta.brackets.bitbake
- match: \]
scope: punctuation.section.brackets.end.bitbake
pop: true
- match: '{{flags}}'
scope: constant.language.flag.bitbake
- match: '{{identifier}}'
scope: constant.other.bitbake
variable-assignment-operator:
- match: '{{assignment_operators}}'
scope: keyword.operator.assignment.bitbake
pop: true
- include: else-pop
- include: eol-pop
variable-assignment-value:
- meta_scope: meta.binding.bitbake
- include: eol-pop
- include: expressions
### [ EXPRESSIONS ] ###########################################################
function-calls:
- match: ({{identifier}})(\()
captures:
1: meta.function-call.identifier.bitbake variable.function.bitbake
2: meta.function-call.arguments.bitbake meta.group.bitbake punctuation.section.group.begin.bitbake
push: inside-function-call-argument-list
inside-function-call-argument-list:
- meta_content_scope: meta.function-call.arguments.bitbake meta.group.bitbake
- match: \)
scope: meta.function-call.arguments.bitbake meta.group.bitbake punctuation.section.group.end.bitbake
pop: true
- match: ','
scope: punctuation.separator.comma.python
- include: expressions
strings:
- match: \"
scope: punctuation.definition.string.begin.bitbake
push: inside-double-quoted-string
- match: \'
scope: punctuation.definition.string.begin.bitbake
push: inside-single-quoted-string
inside-double-quoted-string:
- meta_scope: meta.string.bitbake string.quoted.double.bitbake
- match: \"
scope: punctuation.definition.string.end.bitbake
pop: true
- include: string-content
inside-single-quoted-string:
- meta_scope: meta.string.bitbake string.quoted.single.bitbake
- match: \'
scope: punctuation.definition.string.end.bitbake
pop: true
- include: string-content
unquoted-strings:
- match: (?=\S)
push: inside-unquoted-string
inside-unquoted-string:
- meta_scope: meta.string.bitbake string.unquoted.bitbake
- match: (?=\s)
pop: true
- include: string-content
string-content:
- match: \\$
scope: punctuation.separator.continuation.line.bitbake
- match: \\.
scope: constant.character.escape.bitbake
- match: (\$)(\{)
captures:
1: punctuation.definition.interpolation.begin.bitbake
2: punctuation.section.interpolation.begin.bitbake
push: inside-interpolation
inside-interpolation:
- clear_scopes: 1
- meta_scope: meta.interpolation.bitbake
- match: \}
scope: punctuation.section.interpolation.end.bitbake
pop: true
- match: \@
scope: punctuation.definition.expansion.bitbake
embed: scope:source.python
escape: (?=\})
- include: expressions
namespaces:
- match: ({{identifier}})\s*(\.)
captures:
1: variable.namespace.bitbake
2: punctuation.accessor.dot.bitbake
variables:
- match: '{{identifier}}'
scope: variable.other.bitbake
push: variable-assignment-condition
### [ PROTOTYPES ] ############################################################
else-pop:
- match: (?=\S)
pop: true
eol-pop:
- match: (?=\s*[#\n])
pop: true
###############################################################################
variables:
assignment_operators: (\?\?\=|\?\=|\:\=|\+\=|\=\+|\.\=|\=\.|\=)
identifier: '[[:alpha:]][[:alnum:]_-]*\b'
flags: |-
(?x:
cleandirs
| depends
| deptask
| dirs
| file-checksums
| lockfiles
| network
| noexec
| nostamp
| number_threads
| postfuncs
| prefuncs
| rdepends
| rdeptask
| recideptask
| recrdeptask
| stamp-extra-info
| umask
| vardeps
| vardepsexclude
| vardepvalue
| vardepvalueexclude
)\b