-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
source.bp.js
113 lines (111 loc) · 3.09 KB
/
source.bp.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
// This is a TextMate grammar distributed by `starry-night`.
// This grammar is developed at
// <https://github.com/flimberger/android-system-tools>
// and licensed `mit`.
// See <https://github.com/wooorm/starry-night> for more info.
/**
* @import {Grammar} from '@wooorm/starry-night'
*/
/** @type {Grammar} */
const grammar = {
extensions: [],
names: ['soong'],
patterns: [
{include: '#comments'},
{include: '#variables'},
{include: '#module'}
],
repository: {
bool: {match: '\\b(true|false)\\b', name: 'constant.language.bp'},
comments: {
patterns: [
{match: '(//).*$\\n?', name: 'comment.line.double-slash.bp'},
{begin: '/\\*', end: '\\*/', name: 'comment.block.bp'}
]
},
lists: {
patterns: [
{
begin: '\\[',
beginCaptures: {0: {name: 'punctuation.definition.array.begin.bp'}},
end: '\\]',
endCaptures: {0: {name: 'punctuation.definition.array.end.bp'}},
name: 'meta.structure.array.bp',
patterns: [
{match: ',', name: 'punctuation.separator.array.json'},
{include: '#strings'},
{include: '#comments'}
]
}
]
},
map: {
patterns: [
{
begin: '\\{',
beginCaptures: {
0: {name: 'punctuation.definition.dictionary.begin.bp'}
},
end: '\\}',
endCaptures: {0: {name: 'punctuation.definition.dictionary.end.bp'}},
name: 'meta.structure.dictionary.bp',
patterns: [
{include: '#comments'},
{match: '\\w+', name: 'support.variable'},
{
begin: ':',
beginCaptures: {
0: {name: 'punctuation.separator.dictionary.key-value.bp'}
},
end: '(,)|(?=\\})',
endCaptures: {
1: {name: 'punctuation.separator.dictionary.pair.bp'}
},
name: 'meta.structure.dictionary.value.bp',
patterns: [{include: '#values'}]
}
]
}
]
},
module: {
begin: '\\b(\\w+)\\b',
beginCaptures: {1: {name: 'support.variable.bp'}},
end: '\\n',
name: 'meta.structure.module.bp',
patterns: [{include: '#map'}]
},
strings: {
begin: '"',
beginCaptures: {0: {name: 'punctuation.definition.string.begin.bp'}},
end: '"',
endCaptures: {0: {name: 'punctuation.definition.string.end.bp'}},
name: 'string.quoted.double.bp'
},
values: {
patterns: [
{include: '#bool'},
{include: '#lists'},
{include: '#map'},
{include: '#strings'},
{include: '#comments'}
]
},
variables: {
patterns: [
{
begin: '(\\w+)\\s*(=)',
beginCaptures: {
1: {name: 'variable.other.bp'},
2: {name: 'punctuation.definition.assignment.bp'}
},
end: '\\n',
name: 'meta.assignment',
patterns: [{include: '#values'}]
}
]
}
},
scopeName: 'source.bp'
}
export default grammar