-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
source.gitattributes.js
98 lines (96 loc) · 2.85 KB
/
source.gitattributes.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
// 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', 'source.gitignore'],
extensions: [],
names: ['git-attributes', 'gitattributes'],
patterns: [{include: '#main'}],
repository: {
attribute: {
patterns: [
{
captures: {
1: {patterns: [{include: '#attributePrefix'}]},
2: {name: 'invalid.illegal.syntax.bad-name.gitattributes'},
3: {name: 'invalid.illegal.syntax.bad-name.gitattributes'}
},
match: '([-!](?=\\S))?+([^-A-Za-z0-9_.\\s]\\S*)|([-!])(?=\\s|$)',
name: 'meta.attribute.gitattributes'
},
{
captures: {
1: {patterns: [{include: '#attributePrefix'}]},
2: {name: 'variable.parameter.attribute.gitattributes'},
3: {
name: 'punctuation.definition.assignment.equals-sign.gitattributes'
},
4: {name: 'constant.language.other.gitattributes'}
},
match: '(-|!)?([^\\s=]+)(?:(=)([^\\s]*))?',
name: 'meta.attribute.gitattributes'
}
]
},
attributePrefix: {
patterns: [
{
match: '-',
name: 'keyword.operator.logical.not.negation.gitattributes'
},
{match: '!', name: 'keyword.operator.unset.delete.gitattributes'}
]
},
comment: {
begin: '#',
beginCaptures: {
0: {name: 'punctuation.definition.comment.gitattributes'}
},
end: '$',
name: 'comment.line.number-sign.gitattributes'
},
macro: {
begin: '(?:^|\\G)(\\[)(attr)(\\])([-\\w.]+)',
beginCaptures: {
1: {patterns: [{include: 'etc#bracket'}]},
2: {name: 'storage.type.attribute.gitattributes'},
3: {patterns: [{include: 'etc#bracket'}]},
4: {name: 'entity.name.attribute.gitattributes'}
},
contentName: 'meta.attribute-list.gitattributes',
end: '$',
name: 'meta.definition.gitattributes',
patterns: [{include: '#attribute'}]
},
main: {
patterns: [
{include: '#comment'},
{include: '#macro'},
{include: '#pattern'},
{include: 'source.gitignore#escape'}
]
},
pattern: {
begin: '(?=[^#\\s])',
end: '$|(?=#)',
name: 'meta.pattern.gitattributes',
patterns: [
{include: 'source.gitignore#patternInnards'},
{
begin: '\\s',
end: '(?=$)',
name: 'meta.attribute-list.gitattributes',
patterns: [{include: '#attribute'}]
}
]
}
},
scopeName: 'source.gitattributes'
}
export default grammar