-
-
Notifications
You must be signed in to change notification settings - Fork 33
/
source.opts.js
77 lines (75 loc) · 2.15 KB
/
source.opts.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
// This is a TextMate grammar distributed by `starry-night`.
// This grammar is developed at
// <https://github.com/Alhadis/language-etc>
// and licensed `isc`.
// See <https://github.com/wooorm/starry-night> for more info.
/**
* @import {Grammar} from '@wooorm/starry-night'
*/
/** @type {Grammar} */
const grammar = {
dependencies: ['etc'],
extensions: [],
names: ['option-list', 'opts', 'ackrc'],
patterns: [{include: '#main'}],
repository: {
escape: {
patterns: [
{include: 'etc#esc'},
{
captures: {
1: {name: 'punctuation.definition.character.percentage.opts'}
},
match: '(%)[A-Fa-f0-9]{2}',
name: 'constant.character.percent.url-encoded.opts'
}
]
},
main: {
patterns: [
{include: 'etc#comment'},
{include: '#option'},
{include: '#escape'}
]
},
option: {
patterns: [
{
begin: '((--?)[^-\\s=][^\\s=]*)',
beginCaptures: {
1: {name: 'entity.name.option.opts'},
2: {name: 'punctuation.definition.option.name.dash.opts'}
},
end: '(?!\\G)(?=\\$|\\S)',
name: 'meta.option.opts',
patterns: [
{
captures: {
1: {
name: 'string.regexp.opts',
patterns: [{include: 'source.regexp'}]
}
},
match:
'(?xi)\n(?<= # HACK: Fixed-width look-behinds enforced by Oniguruma\n\t\\w[-_]pattern \\G\n\t| reg[-_]exp \\G\n\t| regexp \\G\n\t| reg[-_]ex \\G\n\t| regex \\G\n) \\s+ (\\S+)'
},
{
captures: {
1: {patterns: [{include: 'etc#eql'}]},
2: {patterns: [{include: '#value'}]}
},
match: '\\G(=)(\\S*)'
},
{
captures: {1: {patterns: [{include: '#value'}]}},
match: '\\G\\s+(?!#|-)(\\S+)'
}
]
}
]
},
value: {patterns: [{include: 'etc'}, {include: 'etc#bareword'}]}
},
scopeName: 'source.opts'
}
export default grammar