-
-
Notifications
You must be signed in to change notification settings - Fork 107
/
EditorConfig.sublime-syntax
154 lines (142 loc) · 4.38 KB
/
EditorConfig.sublime-syntax
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
%YAML 1.2
---
# https://www.sublimetext.com/docs/syntax.html
# https://editorconfig-specification.readthedocs.io/#file-format
name: EditorConfig
scope: source.ini.editorconfig
file_extensions:
- .editorconfig
contexts:
main:
- include: comment
- include: section
- include: mapping
comment:
- match: ;
scope: punctuation.definition.comment.ini
push:
- meta_scope: comment.line.semicolon.ini
- match: \n
pop: true
- match: \#
scope: punctuation.definition.comment.ini
push:
- meta_scope: comment.line.number-sign.ini
- match: \n
pop: true
section:
- match: \[
scope: meta.section.ini punctuation.definition.section.begin.ini
push:
- meta_content_scope: meta.section.ini entity.name.section.ini
- match: \]
scope: meta.section.ini punctuation.definition.section.end.ini
pop: true
- match: \\\S
scope: constant.character.escape.ini
- match: /
scope: punctuation.separator.slash.ini
- include: glob-expression
- include: eol-pop
# https://editorconfig-specification.readthedocs.io/#glob-expressions
glob-expression:
- match: '[*?]'
scope: constant.character.wildcard.ini
- match: (\[)(!)?\w+(\])
scope: meta.set.ini
captures:
1: punctuation.section.brackets.begin.ini
2: keyword.operator.logical.ini
3: punctuation.section.brackets.end.ini
- match: \{
scope: punctuation.section.braces.begin.ini
push:
- meta_scope: meta.set.ini
- match: \}
scope: punctuation.section.braces.end.ini
pop: true
- match: \,
scope: punctuation.separator.sequence.ini
- match: \.\.
scope: punctuation.separator.range.ini
- include: eol-pop
# https://editorconfig-specification.readthedocs.io/#supported-pairs
mapping:
- match: (?=\S)
push:
- meta_content_scope: meta.mapping.key.ini
- match: (?=\s*=)
set:
- - meta_content_scope: meta.mapping.ini
- match: (?=\S)
set:
- mapping-value-meta
- mapping-value
- include: eol-pop
- - match: =
scope: punctuation.separator.key-value.ini
pop: true
- match: \b(?:indent_style|indent_size|tab_width|end_of_line|charset|trim_trailing_whitespace|insert_final_newline|root)\b
scope: variable.language.ini
- include: string
- include: eol-pop
mapping-value:
- match: \b(?i:tab|space|lf|cr(?:lf)?|latin1|utf-8(?:-bom)?|utf-16[bl]e)\b
scope: support.constant.ini
- match: \b(?i:true)\b
scope: constant.language.boolean.true.ini
- match: \b(?i:false)\b
scope: constant.language.boolean.false.ini
- include: number
- include: string
- include: eol-pop
mapping-value-meta:
- meta_scope: meta.mapping.value.ini
- match: ''
pop: true
number:
- match: '([-+])?\b(\d*(\.)\d+(?:(?:E|e)[-+]?\d+)?)(F|f)?\b'
scope: meta.number.float.decimal.ini
captures:
1: keyword.operator.arithmetic.ini
2: constant.numeric.value.ini
3: punctuation.separator.decimal.ini
4: constant.numeric.suffix.ini
- match: '([-+])?\b(\d+)\b'
scope: meta.number.integer.decimal.ini
captures:
1: keyword.operator.arithmetic.ini
2: constant.numeric.value.ini
string:
- match: \"
scope: punctuation.definition.string.begin.ini
push:
- meta_scope: string.quoted.double.ini
- include: character-escape
- match: \"
scope: punctuation.definition.string.end.ini
pop: true
- match: \n
pop: true
- match: \'
scope: punctuation.definition.string.begin.ini
push:
- meta_scope: string.quoted.single.ini
- include: character-escape
- match: \'
scope: punctuation.definition.string.end.ini
pop: true
- match: \n
pop: true
- match: (?=\S)
push:
- meta_content_scope: string.unquoted.ini
- include: character-escape
- match: (?=[\s=:,\[])
pop: true
character-escape:
- match: \\(?:[^*\s\w]|[abnrt0]|x\h{4})
scope: constant.character.escape.ini
eol-pop:
- match: $|(?=\s+[;#])
pop: true