-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
text.browserslist.js
101 lines (99 loc) · 2.8 KB
/
text.browserslist.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
// This is a TextMate grammar distributed by `starry-night`.
// This grammar is developed at
// <https://github.com/browserslist/browserslist-vscode>
// 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: ['browserslist'],
patterns: [
{include: '#comments'},
{include: '#marketshares'},
{include: '#dates'},
{include: '#versions'},
{include: '#keywords'},
{include: '#browsers'},
{include: '#sections'},
{include: '#configs'}
],
repository: {
browsers: {
patterns: [
{
match:
'(?i)\\b(Android|Baidu|BlackBerry|bb|Chrome|ChromeAndroid|and_chr|Edge|Electron|Explorer|ie|ExplorerMobile|ie_mob|Firefox|ff|FirefoxAndroid|and_ff|iOS|ios_saf|Node|Opera|OperaMini|op_mini|OperaMobile|op_mob|PhantomJS|QQAndroid|and_qq|Safari|Samsung|UCAndroid|and_uc|kaios)\\b',
name: 'string.unquoted.browserslist'
}
]
},
comments: {
patterns: [
{begin: '#', end: '\n', name: 'comment.line.number-sign.browserslist'}
]
},
configs: {
patterns: [
{
match: '@\\w+\\/browserslist-config(-.+)?',
name: 'entity.name.class.browserslist'
},
{
match: '\\bbrowserslist-config-\\w+\\b',
name: 'entity.name.class.browserslist'
}
]
},
dates: {
patterns: [
{
match: '\\d{4}(-\\d{1,2}){0,2}',
name: 'constant.numeric.date.browserslist'
},
{match: 'years?', name: 'constant.numeric.date.browserslist'}
]
},
keywords: {
patterns: [
{match: '(<=?|>=?|,)', name: 'keyword.control.browserslist'},
{
match: '\\b(not|and|or|extends|in|last|since|cover|supports)\\b',
name: 'keyword.control.browserslist'
}
]
},
marketshares: {
patterns: [
{match: '(\\d*\\.)?\\d+%', name: 'constant.numeric.browserslist'}
]
},
sections: {
patterns: [
{match: 'defaults', name: 'entity.name.function.browserslist'},
{match: '(\\[|\\])', name: 'constant.character.browserslist'},
{match: '(?!\\[)(.+)(?=\\])', name: 'entity.name.function.browserslist'}
]
},
versions: {
patterns: [
{
match: '\\b\\d+(.\\d+){0,2}\\b',
name: 'constant.numeric.browserslist'
},
{
match: '(?i)\\b(esr|tp|all|dead|unreleased|major|versions?)\\b',
name: 'constant.numeric.browserslist'
},
{
match: '(?i)\\b(current|maintained?)\\b',
name: 'constant.numeric.node.browserslist'
}
]
}
},
scopeName: 'text.browserslist'
}
export default grammar