github-linguist 5.0.0 → 5.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/bin/git-linguist +10 -2
  3. data/bin/linguist +26 -9
  4. data/grammars/config.xcompose.json +83 -0
  5. data/grammars/hint.haskell.json +21 -30
  6. data/grammars/hint.message.haskell.json +21 -30
  7. data/grammars/hint.type.haskell.json +21 -30
  8. data/grammars/source.bsl.json +42 -28
  9. data/grammars/source.cs.json +656 -131
  10. data/grammars/source.csound-document.json +142 -25
  11. data/grammars/source.csound-score.json +13 -10
  12. data/grammars/source.csound.json +136 -81
  13. data/grammars/source.css.json +1501 -331
  14. data/grammars/source.css.less.json +3 -3
  15. data/grammars/source.d.json +60 -44
  16. data/grammars/source.gn.json +240 -138
  17. data/grammars/source.graphql.json +781 -155
  18. data/grammars/source.haskell.json +21 -30
  19. data/grammars/source.js.json +46 -46
  20. data/grammars/source.mask.json +1 -1
  21. data/grammars/source.perl6fe.json +1151 -763
  22. data/grammars/source.python.json +45 -23
  23. data/grammars/source.quoting.perl6fe.json +2170 -0
  24. data/grammars/source.reason.json +296 -0
  25. data/grammars/source.regexp.perl6fe.json +27 -0
  26. data/grammars/source.rust.json +522 -125
  27. data/grammars/source.sdbl.json +2 -2
  28. data/grammars/source.shell.json +125 -161
  29. data/grammars/source.solidity.json +137 -0
  30. data/grammars/source.ts.json +385 -137
  31. data/grammars/source.tsx.json +394 -167
  32. data/grammars/source.yaml.json +176 -171
  33. data/grammars/text.html.php.blade.json +2 -2
  34. data/grammars/text.tex.latex.haskell.json +1 -10
  35. data/lib/linguist/generated.rb +50 -4
  36. data/lib/linguist/heuristics.rb +1 -1
  37. data/lib/linguist/language.rb +12 -8
  38. data/lib/linguist/languages.json +1 -1
  39. data/lib/linguist/languages.yml +38 -1
  40. data/lib/linguist/samples.json +4605 -581
  41. data/lib/linguist/vendor.yml +6 -0
  42. data/lib/linguist/version.rb +1 -1
  43. metadata +10 -7
  44. data/grammars/source.hy.json +0 -270
@@ -0,0 +1,296 @@
1
+ {
2
+ "fileTypes": [
3
+ "re",
4
+ "rei"
5
+ ],
6
+ "foldingStartMarker": "^.*\\bfun\\s*(\\w+\\s*)?\\([^\\)]*\\)(\\s*\\{[^\\}]*)?\\s*$",
7
+ "foldingStopMarker": "^\\s*\\}",
8
+ "name": "Reason",
9
+ "patterns": [
10
+ {
11
+ "include": "#reason_comment_doc_block"
12
+ },
13
+ {
14
+ "include": "#reason_comment_block"
15
+ },
16
+ {
17
+ "include": "#reason_named_arg"
18
+ },
19
+ {
20
+ "include": "#reason_module"
21
+ },
22
+ {
23
+ "include": "#reason_lifetime"
24
+ },
25
+ {
26
+ "include": "#reason_self"
27
+ },
28
+ {
29
+ "include": "#reason_string"
30
+ },
31
+ {
32
+ "include": "#reason_raw_string"
33
+ },
34
+ {
35
+ "match": "\\'([^\\'\\\\]|\\\\(x\\h{2}|u\\{\\h{1,6}\\}|.))\\'",
36
+ "name": "string.quoted.single.source.reason"
37
+ },
38
+ {
39
+ "captures": {
40
+ "1": {
41
+ "name": "keyword.source.reason"
42
+ },
43
+ "2": {
44
+ "name": "entity.name.function.source.reason"
45
+ }
46
+ },
47
+ "match": "\\b(fun)\\s+([a-zA-Z_][a-zA-Z0-9_]?[\\w\\:,+ \\'<>?]*)\\s*(?:\\()",
48
+ "name": "meta.function.source.reason"
49
+ },
50
+ {
51
+ "captures": {
52
+ "1": {
53
+ "name": "keyword.source.reason"
54
+ },
55
+ "2": {
56
+ "name": "keyword.source.reason"
57
+ },
58
+ "3": {
59
+ "name": "keyword.source.reason"
60
+ },
61
+ "4": {
62
+ "name": "variable.other.reason"
63
+ },
64
+ "5": {
65
+ "name": "storage.type.source.reason"
66
+ },
67
+ "6": {
68
+ "name": "keyword.operator.reason"
69
+ }
70
+ },
71
+ "comment": "This matches the 'let x = val' style of variable intitialization.",
72
+ "match": "(let|and)\\s+(module\\s+)(rec\\s+)?([[:alpha:]_][[:alnum:]_]*)\\s*(:[^=]*)?(=?)",
73
+ "name": "meta.initialization.reason"
74
+ },
75
+ {
76
+ "captures": {
77
+ "1": {
78
+ "name": "keyword.source.reason"
79
+ },
80
+ "2": {
81
+ "name": "keyword.source.reason"
82
+ },
83
+ "4": {
84
+ "name": "storage.type.source.reason"
85
+ },
86
+ "5": {
87
+ "name": "keyword.operator.reason"
88
+ }
89
+ },
90
+ "comment": "This matches the 'let x = val' style of variable intitialization.",
91
+ "match": "(let)\\s+(rec\\s+)?([[:alpha:]_][[:alnum:]_]*)\\s*(:[^=]*)?(=?)",
92
+ "name": "meta.initialization.reason"
93
+ },
94
+ {
95
+ "captures": {
96
+ "1": {
97
+ "name": "keyword.source.reason"
98
+ },
99
+ "2": {
100
+ "name": "support"
101
+ }
102
+ },
103
+ "match": "(extern\\s+crate)\\s+(\\w+)",
104
+ "name": "meta.import.reason"
105
+ },
106
+ {
107
+ "captures": {
108
+ "1": {
109
+ "name": "keyword.source.reason"
110
+ },
111
+ "2": {
112
+ "name": "entity.name.macro.source.reason"
113
+ }
114
+ },
115
+ "match": "\\b(macro_rules!)\\s+([a-zA-Z_][a-zA-Z0-9_]*)\\s*(?:\\{)",
116
+ "name": "meta.macro.source.reason"
117
+ },
118
+ {
119
+ "match": "\\b(as|box|break|claim|const|continue|copy|Copy|crate|do|drop|then|else|extern|for|if|impl|in|let|and|loop|switch|fun|open|include|mod|move|mutable|Owned|priv|pub|pure|ref|return|unsafe|use|while|mod|Send|static|trait|struct|enum|exception|type|module|rec|where)\\b",
120
+ "name": "keyword.source.reason"
121
+ },
122
+ {
123
+ "match": "\\b(Self|m32|m64|m128|f80|f16|f128|int|uint|isize|usize|float|char|bool|u8|u16|u32|u64|f32|f64|i8|i16|i32|i64|str|Option|Either|c_float|c_double|c_void|FILE|fpos_t|DIR|dirent|c_char|c_schar|c_uchar|c_short|c_ushort|c_int|c_uint|c_long|c_ulong|size_t|ptrdiff_t|clock_t|time_t|c_longlong|c_ulonglong|intptr_t|uintptr_t|off_t|dev_t|ino_t|pid_t|mode_t|ssize_t)\\b",
124
+ "name": "storage.type.source.reason"
125
+ },
126
+ {
127
+ "match": "\\bself\\b",
128
+ "name": "variable.language.source.reason"
129
+ },
130
+ {
131
+ "match": "\\b(true|false|Some|None|Ok|Err)\\b",
132
+ "name": "constant.language.source.reason"
133
+ },
134
+ {
135
+ "match": "\\b(EXIT_FAILURE|EXIT_SUCCESS|RAND_MAX|EOF|SEEK_SET|SEEK_CUR|SEEK_END|_IOFBF|_IONBF|_IOLBF|BUFSIZ|FOPEN_MAX|FILENAME_MAX|L_tmpnam|TMP_MAX|O_RDONLY|O_WRONLY|O_RDWR|O_APPEND|O_CREAT|O_EXCL|O_TRUNC|S_IFIFO|S_IFCHR|S_IFBLK|S_IFDIR|S_IFREG|S_IFMT|S_IEXEC|S_IWRITE|S_IREAD|S_IRWXU|S_IXUSR|S_IWUSR|S_IRUSR|F_OK|R_OK|W_OK|X_OK|STDIN_FILENO|STDOUT_FILENO|STDERR_FILENO)\\b",
136
+ "name": "support.constant.source.reason"
137
+ },
138
+ {
139
+ "begin": "#!?\\[",
140
+ "end": "\\]",
141
+ "name": "comment.block.attribute.reason",
142
+ "patterns": [
143
+ {
144
+ "include": "#reason_string"
145
+ },
146
+ {
147
+ "include": "#reason_raw_string"
148
+ }
149
+ ]
150
+ },
151
+ {
152
+ "match": "\\b(([0-9][0-9_]*)|([0-9][0-9_]*(usize|u8|u16|u32|u64))|([0-9][0-9_]*(isize|i8|i16|i32|i64)))\\b",
153
+ "name": "constant.numeric.integer.source.reason"
154
+ },
155
+ {
156
+ "match": "\\b((0x[a-fA-F0-9_]+)|(0x[a-fA-F0-9_]+(usize|u8|u16|u32|u64))|(0x[a-fA-F0-9_]+(isize|i8|i16|i32|i64)))\\b",
157
+ "name": "constant.numeric.hex.source.reason"
158
+ },
159
+ {
160
+ "match": "\\b((0b[01_]+)|(0b[01_]+(usize|u8|u16|u32|u64))|(0b[01_]+(isize|i8|i16|i32|i64)))\\b",
161
+ "name": "constant.numeric.binary.source.reason"
162
+ },
163
+ {
164
+ "match": "\\b(([0-9][0-9_]*(f32|f64|f))|([0-9][0-9_]*([eE][+-]=[0-9_]+))|([0-9][0-9_]*([eE][+-]=[0-9_]+)(f32|f64|f))|([0-9][0-9_]*\\.[0-9_]+)|([0-9][0-9_]*\\.[0-9_]+(f32|f64|f))|([0-9][0-9_]*\\.[0-9_]+%([eE][+-]=[0-9_]+))|([0-9][0-9_]*\\.[0-9_]+%([eE][+-]=[0-9_]+)(f32|f64|f)))\\b",
165
+ "name": "constant.numeric.float.source.reason"
166
+ },
167
+ {
168
+ "match": "(=>)|(->)|[-:=*,!.+|%/&~@<>;]",
169
+ "name": "keyword.operator.reason"
170
+ },
171
+ {
172
+ "match": "\\b_\\b",
173
+ "name": "support.function.reason"
174
+ },
175
+ {
176
+ "match": "\\b(\\w+)\\b(?=\\()",
177
+ "name": "support.function.reason"
178
+ },
179
+ {
180
+ "match": "\\b(\\w+!)(?=\\()",
181
+ "name": "support.macro.reason"
182
+ },
183
+ {
184
+ "match": "\\b(\\w+)::",
185
+ "name": "meta.namespace-block.reason"
186
+ },
187
+ {
188
+ "captures": {
189
+ "1": {
190
+ "name": "meta.preprocessor.reason"
191
+ }
192
+ },
193
+ "match": "\\b(\\w+!)\\s*[({\\[]",
194
+ "name": "meta.macro.source.reason"
195
+ },
196
+ {
197
+ "match": "(\\[|\\]|{|}|\\(|\\))",
198
+ "name": "punctuation.definition.bracket.reason"
199
+ },
200
+ {
201
+ "match": "\\b(Box|Vec|StrBuf|Path|Option|Result|Reader|Writer|Stream|Seek|Buffer|IoError|IoResult|Sender|SyncSender|Receiver|Cell|RefCell|Any)\\b",
202
+ "name": "support.class.std.source.reason"
203
+ },
204
+ {
205
+ "match": "\\b(Send|Sized|Copy|Share)\\b",
206
+ "name": "support.type.kind.source.reason"
207
+ },
208
+ {
209
+ "match": "\\bbox\\b",
210
+ "name": "storage.modifier.box.source.reason"
211
+ },
212
+ {
213
+ "match": "\\brec\\b",
214
+ "name": "storage.modifier.rec.source.reason"
215
+ },
216
+ {
217
+ "match": "\\bmodule\\b",
218
+ "name": "storage.modifier.module.source.reason"
219
+ }
220
+ ],
221
+ "repository": {
222
+ "reason_comment_block": {
223
+ "begin": "/\\*",
224
+ "end": "\\*/",
225
+ "name": "comment.block.source.reason",
226
+ "patterns": [
227
+ {
228
+ "include": "#reason_comment_block"
229
+ }
230
+ ]
231
+ },
232
+ "reason_comment_doc_block": {
233
+ "begin": "/\\*[!\\*][^\\*]",
234
+ "end": "\\*/",
235
+ "name": "comment.block.documentation.source.reason",
236
+ "patterns": [
237
+ {
238
+ "include": "#reason_comment_doc_block"
239
+ }
240
+ ]
241
+ },
242
+ "reason_escaped_character": {
243
+ "match": "\\\\(x\\h{2}|u\\{\\h{1,6}\\}|.)",
244
+ "name": "constant.character.escape.source.reason"
245
+ },
246
+ "reason_lifetime": {
247
+ "captures": {
248
+ "1": {
249
+ "name": "entity.name.lifetime.source.reason"
250
+ }
251
+ },
252
+ "match": "\\'([a-zA-Z_][a-zA-Z0-9_]*)(?!\\')\\b",
253
+ "name": "storage.modifier.lifetime.source.reason"
254
+ },
255
+ "reason_module": {
256
+ "captures": {
257
+ "1": {
258
+ "name": "variable.other.reason"
259
+ }
260
+ },
261
+ "match": "\\b([A-Z][a-zA-Z0-9_]*)\\b"
262
+ },
263
+ "reason_named_arg": {
264
+ "captures": {
265
+ "1": {
266
+ "name": "storage.modifier.lifetime.source.reason"
267
+ },
268
+ "2": {
269
+ "name": "entity.name.lifetime.source.reason"
270
+ }
271
+ },
272
+ "match": "(@([a-zA-Z_][a-zA-Z0-9_]*))\\b"
273
+ },
274
+ "reason_raw_string": {
275
+ "begin": "r(#*)\"",
276
+ "end": "\"(\\1)",
277
+ "name": "string.quoted.double.raw.source.reason"
278
+ },
279
+ "reason_self": {
280
+ "match": "\\bself\\b",
281
+ "name": "variable.language.source.reason"
282
+ },
283
+ "reason_string": {
284
+ "begin": "\"",
285
+ "end": "\"",
286
+ "name": "string.quoted.double.source.reason",
287
+ "patterns": [
288
+ {
289
+ "include": "#reason_escaped_character"
290
+ }
291
+ ]
292
+ }
293
+ },
294
+ "scopeName": "source.reason",
295
+ "uuid": "4339386b-4d67-4f0e-9e78-09ecbcddf71d"
296
+ }
@@ -93,6 +93,10 @@
93
93
  ],
94
94
  "name": "meta.interpolation.perl6fe"
95
95
  },
96
+ {
97
+ "match": "<\\(|\\)>",
98
+ "name": "keyword.operator.capture.marker.regexp.perl6fe"
99
+ },
96
100
  {
97
101
  "begin": "(?!\\\\)<",
98
102
  "beginCaptures": {
@@ -159,9 +163,22 @@
159
163
  },
160
164
  {
161
165
  "begin": "\\[",
166
+ "beginCaptures": {
167
+ "0": {
168
+ "name": "keyword.operator.charclass.open.regexp.perl6fe"
169
+ }
170
+ },
162
171
  "end": "\\]",
172
+ "endCaptures": {
173
+ "0": {
174
+ "name": "keyword.operator.charclass.close.regexp.perl6fe"
175
+ }
176
+ },
163
177
  "contentName": "constant.character.custom.property.regexp.perl6fe",
164
178
  "patterns": [
179
+ {
180
+ "include": "source.perl6fe#hex_escapes"
181
+ },
165
182
  {
166
183
  "match": "(?<!\\\\)\\\\\\]",
167
184
  "name": "constant.character.custom.property.regexp.perl6fe"
@@ -209,6 +226,16 @@
209
226
  "end": "(?<=\\\\\\\\)\\'|(?<!\\\\)\\'",
210
227
  "name": "string.literal.perl6fe"
211
228
  },
229
+ {
230
+ "begin": "(?<!\\\\)‘",
231
+ "end": "(?<=\\\\\\\\)\\’|(?<!\\\\)’",
232
+ "name": "string.literal.perl6fe",
233
+ "patterns": [
234
+ {
235
+ "include": "source.perl6fe#q_left_single_right_single_string_content"
236
+ }
237
+ ]
238
+ },
212
239
  {
213
240
  "begin": "(?<!\\\\)\\\"",
214
241
  "end": "(?<=\\\\\\\\)\\\"|(?<!\\\\)\\\"",
@@ -1,212 +1,609 @@
1
1
  {
2
+ "name": "Rust",
3
+ "scopeName": "source.rust",
2
4
  "fileTypes": [
3
5
  "rs"
4
6
  ],
5
- "foldingStartMarker": "^.*\\bfn\\s*(\\w+\\s*)?\\([^\\)]*\\)(\\s*\\{[^\\}]*)?\\s*$",
6
- "foldingStopMarker": "^\\s*\\}",
7
- "name": "Rust",
7
+ "repository": {
8
+ "block_doc_comment": {
9
+ "comment": "Block documentation comment",
10
+ "name": "comment.block.documentation.rust",
11
+ "begin": "/\\*[\\*!](?![\\*/])",
12
+ "end": "\\*/",
13
+ "patterns": [
14
+ {
15
+ "include": "#block_doc_comment"
16
+ },
17
+ {
18
+ "include": "#block_comment"
19
+ }
20
+ ]
21
+ },
22
+ "block_comment": {
23
+ "comment": "Block comment",
24
+ "name": "comment.block.rust",
25
+ "begin": "/\\*",
26
+ "end": "\\*/",
27
+ "patterns": [
28
+ {
29
+ "include": "#block_doc_comment"
30
+ },
31
+ {
32
+ "include": "#block_comment"
33
+ }
34
+ ]
35
+ },
36
+ "line_doc_comment": {
37
+ "comment": "Single-line documentation comment",
38
+ "name": "comment.line.documentation.rust",
39
+ "begin": "//[!/](?=[^/])",
40
+ "end": "$"
41
+ },
42
+ "line_comment": {
43
+ "comment": "Single-line comment",
44
+ "name": "comment.line.double-slash.rust",
45
+ "begin": "//",
46
+ "end": "$"
47
+ },
48
+ "escaped_character": {
49
+ "name": "constant.character.escape.rust",
50
+ "match": "\\\\(x\\h{2}|[0-2][0-7]{,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)"
51
+ },
52
+ "string_literal": {
53
+ "comment": "Double-quote string literal",
54
+ "name": "string.quoted.double.rust",
55
+ "begin": "b?\"",
56
+ "end": "\"",
57
+ "patterns": [
58
+ {
59
+ "include": "#escaped_character"
60
+ }
61
+ ]
62
+ },
63
+ "raw_string_literal": {
64
+ "comment": "Raw double-quote string literal",
65
+ "name": "string.quoted.double.raw.rust",
66
+ "begin": "b?r(#*)\"",
67
+ "end": "\"\\1"
68
+ },
69
+ "sigils": {
70
+ "comment": "Sigil",
71
+ "name": "keyword.operator.sigil.rust",
72
+ "match": "[&*](?=[a-zA-Z0-9_\\(\\[\\|\\\"]+)"
73
+ },
74
+ "self": {
75
+ "comment": "Self variable",
76
+ "name": "variable.language.rust",
77
+ "match": "\\bself\\b"
78
+ },
79
+ "mut": {
80
+ "comment": "Mutable storage modifier",
81
+ "name": "storage.modifier.mut.rust",
82
+ "match": "\\bmut\\b"
83
+ },
84
+ "box": {
85
+ "comment": "Box storage modifier",
86
+ "name": "storage.modifier.box.rust",
87
+ "match": "\\bbox\\b"
88
+ },
89
+ "const": {
90
+ "comment": "Const storage modifier",
91
+ "name": "storage.modifier.const.rust",
92
+ "match": "\\bconst\\b"
93
+ },
94
+ "pub": {
95
+ "comment": "Visibility modifier",
96
+ "name": "storage.modifier.visibility.rust",
97
+ "match": "\\bpub\\b"
98
+ },
99
+ "unsafe": {
100
+ "comment": "Unsafe code keyword",
101
+ "name": "keyword.other.unsafe.rust",
102
+ "match": "\\bunsafe\\b"
103
+ },
104
+ "where": {
105
+ "comment": "Generic where clause",
106
+ "name": "keyword.other.where.rust",
107
+ "match": "\\bwhere\\b"
108
+ },
109
+ "lifetime": {
110
+ "comment": "Named lifetime",
111
+ "name": "storage.modifier.lifetime.rust",
112
+ "match": "'([a-zA-Z_][a-zA-Z0-9_]*)\\b",
113
+ "captures": {
114
+ "1": {
115
+ "name": "entity.name.lifetime.rust"
116
+ }
117
+ }
118
+ },
119
+ "ref_lifetime": {
120
+ "comment": "Reference with named lifetime",
121
+ "match": "&('([a-zA-Z_][a-zA-Z0-9_]*))\\b",
122
+ "captures": {
123
+ "1": {
124
+ "name": "storage.modifier.lifetime.rust"
125
+ },
126
+ "2": {
127
+ "name": "entity.name.lifetime.rust"
128
+ }
129
+ }
130
+ },
131
+ "core_types": {
132
+ "comment": "Built-in/core type",
133
+ "name": "storage.type.core.rust",
134
+ "match": "\\b(bool|char|usize|isize|u8|u16|u32|u64|u128|i8|i16|i32|i64|i128|f32|f64|str|Self|Option|Result)\\b"
135
+ },
136
+ "core_vars": {
137
+ "comment": "Core type variant",
138
+ "name": "support.constant.core.rust",
139
+ "match": "\\b(Some|None|Ok|Err)\\b"
140
+ },
141
+ "core_marker": {
142
+ "comment": "Core trait (marker)",
143
+ "name": "support.type.marker.rust",
144
+ "match": "\\b(Copy|Send|Sized|Sync)\\b"
145
+ },
146
+ "core_traits": {
147
+ "comment": "Core trait",
148
+ "name": "support.type.core.rust",
149
+ "match": "\\b(Drop|Fn|FnMut|FnOnce|Clone|PartialEq|PartialOrd|Eq|Ord|AsRef|AsMut|Into|From|Default|Iterator|Extend|IntoIterator|DoubleEndedIterator|ExactSizeIterator)\\b"
150
+ },
151
+ "std_types": {
152
+ "comment": "Standard library type",
153
+ "name": "storage.class.std.rust",
154
+ "match": "\\b(Box|String|Vec|Path|PathBuf)\\b"
155
+ },
156
+ "std_traits": {
157
+ "comment": "Standard library trait",
158
+ "name": "support.type.std.rust",
159
+ "match": "\\b(ToOwned|ToString)\\b"
160
+ },
161
+ "type_params": {
162
+ "comment": "Type parameters",
163
+ "name": "meta.type_params.rust",
164
+ "begin": "<(?![=<])",
165
+ "end": ">",
166
+ "patterns": [
167
+ {
168
+ "include": "#block_comment"
169
+ },
170
+ {
171
+ "include": "#line_comment"
172
+ },
173
+ {
174
+ "include": "#sigils"
175
+ },
176
+ {
177
+ "include": "#mut"
178
+ },
179
+ {
180
+ "include": "#lifetime"
181
+ },
182
+ {
183
+ "include": "#core_types"
184
+ },
185
+ {
186
+ "include": "#core_marker"
187
+ },
188
+ {
189
+ "include": "#core_traits"
190
+ },
191
+ {
192
+ "include": "#std_types"
193
+ },
194
+ {
195
+ "include": "#std_traits"
196
+ },
197
+ {
198
+ "include": "#type_params"
199
+ }
200
+ ]
201
+ }
202
+ },
8
203
  "patterns": [
9
204
  {
10
- "include": "#rust_comment_doc_block"
205
+ "include": "#block_doc_comment"
11
206
  },
12
207
  {
13
- "include": "#rust_comment_block"
208
+ "include": "#block_comment"
14
209
  },
15
210
  {
16
- "include": "#rust_string"
211
+ "include": "#line_doc_comment"
17
212
  },
18
213
  {
19
- "include": "#rust_raw_string"
214
+ "include": "#line_comment"
20
215
  },
21
216
  {
22
- "match": "\\b[A-Z]\\b",
23
- "name": "storage.type.source.rust"
217
+ "comment": "Attribute",
218
+ "name": "meta.attribute.rust",
219
+ "begin": "#\\!?\\[",
220
+ "end": "\\]",
221
+ "patterns": [
222
+ {
223
+ "include": "#string_literal"
224
+ }
225
+ ]
24
226
  },
25
227
  {
26
- "match": "\\b_*[A-Z][a-zA-Z0-9_]*[a-z][a-zA-Z0-9_]*\\b",
27
- "name": "storage.type.source.rust"
228
+ "comment": "Single-quote string literal (character)",
229
+ "name": "string.quoted.single.rust",
230
+ "match": "b?'([^'\\\\]|\\\\(x\\h{2}|[0-2][0-7]{,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.))'"
28
231
  },
29
232
  {
30
- "match": "\\b(c_[a-z0-9_]+|[a-z_][a-z0-9_]*_t)\\b",
31
- "name": "storage.type.source.rust"
233
+ "include": "#string_literal"
32
234
  },
33
235
  {
34
- "match": "\\b([A-Z_][A-Z0-9_]+)\\b",
35
- "name": "constant.other.source.rust"
236
+ "include": "#raw_string_literal"
36
237
  },
37
238
  {
38
- "match": "\\'[a-zA-Z_][a-zA-Z0-9_]*(?!\\')\\b",
39
- "name": "storage.modifier.lifetime.source.rust"
239
+ "comment": "Floating point literal (fraction)",
240
+ "name": "constant.numeric.float.rust",
241
+ "match": "\\b[0-9][0-9_]*\\.[0-9][0-9_]*([eE][+-]?[0-9_]+)?(f32|f64)?\\b"
40
242
  },
41
243
  {
42
- "begin": "\\'(?=([^\\'\\\\]|\\\\(x\\h{2}|u\\{\\h{1,6}\\}|n|r|t|0|\"|'|\\\\))\\')",
43
- "end": "\\'",
44
- "name": "string.quoted.single.source.rust",
45
- "patterns": [
46
- {
47
- "include": "#rust_escaped_character"
48
- }
49
- ]
244
+ "comment": "Floating point literal (exponent)",
245
+ "name": "constant.numeric.float.rust",
246
+ "match": "\\b[0-9][0-9_]*(\\.[0-9][0-9_]*)?[eE][+-]?[0-9_]+(f32|f64)?\\b"
50
247
  },
51
248
  {
52
- "captures": {
53
- "1": {
54
- "name": "keyword.other.source.rust"
55
- },
56
- "2": {
57
- "name": "entity.name.function.source.rust"
58
- }
59
- },
60
- "match": "\\b(fn)\\s+([a-zA-Z_][a-zA-Z0-9_]*)\\b",
61
- "name": "meta.function.source.rust"
249
+ "comment": "Floating point literal (typed)",
250
+ "name": "constant.numeric.float.rust",
251
+ "match": "\\b[0-9][0-9_]*(\\.[0-9][0-9_]*)?([eE][+-]?[0-9_]+)?(f32|f64)\\b"
62
252
  },
63
253
  {
64
- "captures": {
65
- "1": {
66
- "name": "keyword.other.source.rust"
67
- },
68
- "2": {
69
- "name": "entity.name.macro.source.rust"
70
- }
71
- },
72
- "match": "\\b(macro_rules!)\\s+([a-zA-Z_][a-zA-Z0-9_]*)\\b",
73
- "name": "meta.macro.source.rust"
254
+ "comment": "Integer literal (decimal)",
255
+ "name": "constant.numeric.integer.decimal.rust",
256
+ "match": "\\b[0-9][0-9_]*([ui](8|16|32|64|128|s|size))?\\b"
74
257
  },
75
258
  {
76
- "match": "\\b(crate|enum|extern|fn|impl|let|mod|move|mut|pub|ref|static|struct|super|trait|type|unsafe|use|const|where)\\b",
77
- "name": "keyword.other.source.rust"
259
+ "comment": "Integer literal (hexadecimal)",
260
+ "name": "constant.numeric.integer.hexadecimal.rust",
261
+ "match": "\\b0x[a-fA-F0-9_]+([ui](8|16|32|64|128|s|size))?\\b"
78
262
  },
79
263
  {
80
- "match": "\\b(break|else|for|if|loop|match|return|while|continue)\\b",
81
- "name": "keyword.control.source.rust"
264
+ "comment": "Integer literal (octal)",
265
+ "name": "constant.numeric.integer.octal.rust",
266
+ "match": "\\b0o[0-7_]+([ui](8|16|32|64|128|s|size))?\\b"
82
267
  },
83
268
  {
84
- "match": "\\b(as|in|box)\\b",
85
- "name": "keyword.operator.source.rust"
269
+ "comment": "Integer literal (binary)",
270
+ "name": "constant.numeric.integer.binary.rust",
271
+ "match": "\\b0b[01_]+([ui](8|16|32|64|128|s|size))?\\b"
86
272
  },
87
273
  {
88
- "match": "\\b(virtual|proc|alignof|become|offsetof|priv|pure|sizeof|typeof|unsized|yield|do|abstract|final|override|macro)\\b",
89
- "name": "invalid.illegal.source.rust"
274
+ "comment": "Static storage modifier",
275
+ "name": "storage.modifier.static.rust",
276
+ "match": "\\bstatic\\b"
90
277
  },
91
278
  {
92
- "match": "\\b(true|false)\\b",
93
- "name": "constant.language.source.rust"
279
+ "comment": "Boolean constant",
280
+ "name": "constant.language.boolean.rust",
281
+ "match": "\\b(true|false)\\b"
94
282
  },
95
283
  {
96
- "match": "\\b(self)\\b",
97
- "name": "variable.language.source.rust"
284
+ "comment": "Control keyword",
285
+ "name": "keyword.control.rust",
286
+ "match": "\\b(break|continue|else|if|in|for|loop|match|return|while)\\b"
98
287
  },
99
288
  {
100
- "match": "(?<!::)\\b(Self|i8|i16|i32|i64|isize|u8|u16|u32|u64|usize|f32|f64|bool|char|str)\\b",
101
- "name": "storage.type.source.rust"
289
+ "comment": "Keyword",
290
+ "name": "keyword.other.rust",
291
+ "match": "\\b(crate|extern|mod|let|proc|ref|use|super|as|move)\\b"
102
292
  },
103
293
  {
104
- "begin": "#!?\\[",
105
- "end": "\\]",
106
- "name": "comment.block.attribute.source.rust",
107
- "patterns": [
108
- {
109
- "include": "#rust_string"
110
- },
111
- {
112
- "include": "#rust_raw_string"
113
- }
114
- ]
294
+ "include": "#unsafe"
115
295
  },
116
296
  {
117
- "match": "\\b[0-9][0-9_]*(i8|i16|i32|i64|isize|u8|u16|u32|u64|usize)?\\b",
118
- "name": "constant.numeric.integer.decimal.source.rust"
297
+ "include": "#sigils"
119
298
  },
120
299
  {
121
- "match": "\\b0x[0-9a-fA-F_]*[0-9a-fA-F][0-9a-fA-F_]*(i8|i16|i32|i64|isize|u8|u16|u32|u64|usize)?\\b",
122
- "name": "constant.numeric.integer.hexadecimal.source.rust"
300
+ "include": "#self"
123
301
  },
124
302
  {
125
- "match": "\\b0o[0-7_]*[0-7][0-7_]*(i8|i16|i32|i64|isize|u8|u16|u32|u64|usize)?\\b",
126
- "name": "constant.numeric.integer.octal.source.rust"
303
+ "include": "#mut"
127
304
  },
128
305
  {
129
- "match": "\\b0b[0-1_]*[0-1][0-1_]*(i8|i16|i32|i64|isize|u8|u16|u32|u64|usize)?\\b",
130
- "name": "constant.numeric.integer.binary.source.rust"
306
+ "include": "#box"
131
307
  },
132
308
  {
133
- "match": "\\b[0-9][0-9_]*((f32|f64)|([eE][+-]?[0-9_]*[0-9][0-9_]*(f32|f64)?)|(\\.([0-9][0-9_]*([eE][+-]?[0-9_]*[0-9][0-9_]*)?(f32|f64)?)?))\\b",
134
- "name": "constant.numeric.float.source.rust"
309
+ "include": "#lifetime"
135
310
  },
136
311
  {
137
- "begin": "//[!/][^/].*",
138
- "end": "$",
139
- "name": "comment.line.documentation.source.rust"
312
+ "include": "#ref_lifetime"
140
313
  },
141
314
  {
142
- "begin": "//",
143
- "end": "$",
144
- "name": "comment.line.double-slash.source.rust"
315
+ "include": "#const"
145
316
  },
146
317
  {
147
- "match": "[-=<>&|!~@.,;:?+*/%^'#$]|\\b_\\b",
148
- "name": "keyword.operator.source.rust"
318
+ "include": "#pub"
149
319
  },
150
320
  {
151
- "match": "[(){}\\[\\]]|::",
152
- "name": "meta.default.source.rust"
321
+ "comment": "Miscellaneous operator",
322
+ "name": "keyword.operator.misc.rust",
323
+ "match": "(=>|::|\\bas\\b)"
153
324
  },
154
325
  {
155
- "match": "\\b[a-z_][a-z0-9_]*(?=\\()",
156
- "name": "support.function.source.rust"
326
+ "comment": "Comparison operator",
327
+ "name": "keyword.operator.comparison.rust",
328
+ "match": "(&&|\\|\\||==|!=)"
157
329
  },
158
330
  {
159
- "match": "\\b(Copy|Send|Sized|Sync|Drop|Fn|FnMut|FnOnce|Box|ToOwned|Clone|PartialEq|PartialOrd|Eq|Ord|AsRef|AsMut|Into|From|Default|Iterator|Extend|IntoIterator|DoubleEndedIterator|ExactSizeIterator|Option|Some|None|Result|Ok|Err|SliceConcatExt|String|ToString|Vec)\\b",
160
- "name": "support.type.source.rust"
161
- }
162
- ],
163
- "repository": {
164
- "rust_comment_block": {
165
- "begin": "/\\*",
166
- "end": "\\*/",
167
- "name": "comment.block.source.rust",
331
+ "comment": "Assignment operator",
332
+ "name": "keyword.operator.assignment.rust",
333
+ "match": "(\\+=|-=|/=|\\*=|%=|\\^=|&=|\\|=|<<=|>>=|=)"
334
+ },
335
+ {
336
+ "comment": "Arithmetic operator",
337
+ "name": "keyword.operator.arithmetic.rust",
338
+ "match": "(!|\\+|-|/|\\*|%|\\^|&|\\||<<|>>)"
339
+ },
340
+ {
341
+ "comment": "Comparison operator (second group because of regex precedence)",
342
+ "name": "keyword.operator.comparison.rust",
343
+ "match": "(<=|>=|<|>)"
344
+ },
345
+ {
346
+ "include": "#core_types"
347
+ },
348
+ {
349
+ "include": "#core_vars"
350
+ },
351
+ {
352
+ "include": "#core_marker"
353
+ },
354
+ {
355
+ "include": "#core_traits"
356
+ },
357
+ {
358
+ "include": "#std_types"
359
+ },
360
+ {
361
+ "include": "#std_traits"
362
+ },
363
+ {
364
+ "comment": "Built-in macro",
365
+ "name": "support.function.builtin.rust",
366
+ "match": "\\b(macro_rules|format_args|env|option_env|concat_idents|concat|log_syntax|line|column|file|stringify|include|include_str|include_bytes|module_path|asm|cfg|trace_macros)!"
367
+ },
368
+ {
369
+ "comment": "Core macro",
370
+ "name": "support.function.core.rust",
371
+ "match": "\\b(panic|assert|assert_eq|debug_assert|debug_assert_eq|try|write|writeln|unreachable|unimplemented)!"
372
+ },
373
+ {
374
+ "comment": "Standard library macro",
375
+ "name": "support.function.std.rust",
376
+ "match": "\\b(format|print|println|select|vec)!"
377
+ },
378
+ {
379
+ "comment": "Logging macro",
380
+ "name": "support.function.log.rust",
381
+ "match": "\\b(log|error|warn|info|debug|trace|log_enabled)!"
382
+ },
383
+ {
384
+ "comment": "Invokation of a macro",
385
+ "match": "\\b([a-zA-Z_][a-zA-Z0-9_]*\\!)\\s*[({\\[]",
386
+ "captures": {
387
+ "1": {
388
+ "name": "entity.name.function.macro.rust"
389
+ }
390
+ }
391
+ },
392
+ {
393
+ "comment": "Function call",
394
+ "match": "\\b([a-zA-Z_][a-zA-Z0-9_]*)\\s*\\(",
395
+ "captures": {
396
+ "1": {
397
+ "name": "entity.name.function.rust"
398
+ }
399
+ }
400
+ },
401
+ {
402
+ "comment": "Function definition",
403
+ "begin": "\\b(fn)\\s+([a-zA-Z_][a-zA-Z0-9_]*)",
404
+ "end": "[\\{;]",
405
+ "beginCaptures": {
406
+ "1": {
407
+ "name": "keyword.other.fn.rust"
408
+ },
409
+ "2": {
410
+ "name": "entity.name.function.rust"
411
+ }
412
+ },
168
413
  "patterns": [
169
414
  {
170
- "include": "#rust_comment_block"
415
+ "include": "#block_comment"
416
+ },
417
+ {
418
+ "include": "#line_comment"
419
+ },
420
+ {
421
+ "include": "#sigils"
422
+ },
423
+ {
424
+ "include": "#self"
425
+ },
426
+ {
427
+ "include": "#mut"
428
+ },
429
+ {
430
+ "include": "#ref_lifetime"
431
+ },
432
+ {
433
+ "include": "#core_types"
434
+ },
435
+ {
436
+ "include": "#core_marker"
437
+ },
438
+ {
439
+ "include": "#core_traits"
171
440
  },
172
441
  {
173
- "include": "#rust_comment_doc_block"
442
+ "include": "#std_types"
443
+ },
444
+ {
445
+ "include": "#std_traits"
446
+ },
447
+ {
448
+ "include": "#type_params"
449
+ },
450
+ {
451
+ "include": "#const"
452
+ },
453
+ {
454
+ "include": "#where"
455
+ },
456
+ {
457
+ "include": "#unsafe"
458
+ },
459
+ {
460
+ "comment": "Function arguments",
461
+ "match": "fn",
462
+ "name": "keyword.other.fn.rust"
174
463
  }
175
464
  ]
176
465
  },
177
- "rust_comment_doc_block": {
178
- "begin": "/\\*[!\\*][^\\*/]",
179
- "end": "\\*/",
180
- "name": "comment.block.documentation.source.rust",
466
+ {
467
+ "comment": "Type declaration",
468
+ "begin": "\\b(enum|struct|trait)\\s+([a-zA-Z_][a-zA-Z0-9_]*)",
469
+ "end": "[\\{\\(;]",
470
+ "beginCaptures": {
471
+ "1": {
472
+ "name": "storage.type.rust"
473
+ },
474
+ "2": {
475
+ "name": "entity.name.type.rust"
476
+ }
477
+ },
181
478
  "patterns": [
182
479
  {
183
- "include": "#rust_comment_block"
480
+ "include": "#block_comment"
481
+ },
482
+ {
483
+ "include": "#line_comment"
484
+ },
485
+ {
486
+ "include": "#core_traits"
487
+ },
488
+ {
489
+ "include": "#std_traits"
184
490
  },
185
491
  {
186
- "include": "#rust_comment_doc_block"
492
+ "include": "#type_params"
493
+ },
494
+ {
495
+ "include": "#core_types"
496
+ },
497
+ {
498
+ "include": "#pub"
499
+ },
500
+ {
501
+ "include": "#where"
187
502
  }
188
503
  ]
189
504
  },
190
- "rust_escaped_character": {
191
- "match": "\\\\(x\\h{2}|u\\{\\h{1,6}\\}|n|r|t|0|\"|'|\\\\)",
192
- "name": "constant.character.escape.source.rust"
193
- },
194
- "rust_raw_string": {
195
- "begin": "r(#*)\"",
196
- "end": "\"(\\1)",
197
- "name": "string.quoted.double.raw.source.rust"
505
+ {
506
+ "comment": "Type alias",
507
+ "begin": "\\b(type)\\s+([a-zA-Z_][a-zA-Z0-9_]*)",
508
+ "end": ";",
509
+ "beginCaptures": {
510
+ "1": {
511
+ "name": "storage.type.rust"
512
+ },
513
+ "2": {
514
+ "name": "entity.name.type.rust"
515
+ }
516
+ },
517
+ "patterns": [
518
+ {
519
+ "include": "#block_comment"
520
+ },
521
+ {
522
+ "include": "#line_comment"
523
+ },
524
+ {
525
+ "include": "#sigils"
526
+ },
527
+ {
528
+ "include": "#mut"
529
+ },
530
+ {
531
+ "include": "#lifetime"
532
+ },
533
+ {
534
+ "include": "#ref_lifetime"
535
+ },
536
+ {
537
+ "include": "#core_types"
538
+ },
539
+ {
540
+ "include": "#core_marker"
541
+ },
542
+ {
543
+ "include": "#core_traits"
544
+ },
545
+ {
546
+ "include": "#std_types"
547
+ },
548
+ {
549
+ "include": "#std_traits"
550
+ },
551
+ {
552
+ "include": "#type_params"
553
+ }
554
+ ]
198
555
  },
199
- "rust_string": {
200
- "begin": "\"",
201
- "end": "\"",
202
- "name": "string.quoted.double.source.rust",
556
+ {
557
+ "comment": "Implementation",
558
+ "begin": "\\b(impl)\\b",
559
+ "end": "\\{",
560
+ "beginCaptures": {
561
+ "1": {
562
+ "name": "storage.type.rust"
563
+ }
564
+ },
203
565
  "patterns": [
204
566
  {
205
- "include": "#rust_escaped_character"
567
+ "include": "#block_comment"
568
+ },
569
+ {
570
+ "include": "#line_comment"
571
+ },
572
+ {
573
+ "include": "#sigils"
574
+ },
575
+ {
576
+ "include": "#mut"
577
+ },
578
+ {
579
+ "include": "#ref_lifetime"
580
+ },
581
+ {
582
+ "include": "#core_types"
583
+ },
584
+ {
585
+ "include": "#core_marker"
586
+ },
587
+ {
588
+ "include": "#core_traits"
589
+ },
590
+ {
591
+ "include": "#std_types"
592
+ },
593
+ {
594
+ "include": "#std_traits"
595
+ },
596
+ {
597
+ "include": "#type_params"
598
+ },
599
+ {
600
+ "include": "#where"
601
+ },
602
+ {
603
+ "name": "storage.type.rust",
604
+ "match": "\\bfor\\b"
206
605
  }
207
606
  ]
208
607
  }
209
- },
210
- "scopeName": "source.rust",
211
- "uuid": "4339386b-4d67-4f0e-9e78-09ecbcddf71d"
608
+ ]
212
609
  }