|
158 | 158 | },
|
159 | 159 | {
|
160 | 160 | "comment": "modules",
|
161 |
| - "match": "(mod)\\s+([a-z][A-Za-z0-9_]*)", |
| 161 | + "match": "(mod)\\s+((?:r#(?!crate|[Ss]elf|super))?[a-z][A-Za-z0-9_]*)", |
162 | 162 | "captures": {
|
163 | 163 | "1": {
|
164 | 164 | "name": "keyword.control.rust"
|
|
295 | 295 | "comment": "line comments",
|
296 | 296 | "name": "comment.line.double-slash.rust",
|
297 | 297 | "match": "\\s*//.*"
|
298 |
| - }, |
299 |
| - { |
300 |
| - "comment": "inferred types, wildcard patterns, ignored params", |
301 |
| - "name": "comment.char.underscore.rust", |
302 |
| - "match": "\\b_\\w*\\b[^!(]" |
303 | 298 | }
|
304 | 299 | ]
|
305 | 300 | },
|
|
431 | 426 | },
|
432 | 427 | "functions": {
|
433 | 428 | "patterns": [
|
| 429 | + { |
| 430 | + "comment": "pub as a function", |
| 431 | + "match": "\\b(pub)(\\()", |
| 432 | + "captures": { |
| 433 | + "1": { |
| 434 | + "name": "keyword.other.rust" |
| 435 | + }, |
| 436 | + "2": { |
| 437 | + "name": "punctuation.brackets.round.rust" |
| 438 | + } |
| 439 | + } |
| 440 | + }, |
434 | 441 | {
|
435 | 442 | "comment": "function definition",
|
436 | 443 | "name": "meta.function.definition.rust",
|
437 |
| - "begin": "\\b(fn)\\s+([A-Za-z0-9_]+)((\\()|(<))", |
| 444 | + "begin": "\\b(fn)\\s+((?:r#(?!crate|[Ss]elf|super))?[A-Za-z0-9_]+)((\\()|(<))", |
438 | 445 | "beginCaptures": {
|
439 | 446 | "1": {
|
440 | 447 | "name": "keyword.control.fn.rust"
|
|
503 | 510 | {
|
504 | 511 | "comment": "function/method calls, chaining",
|
505 | 512 | "name": "meta.function.call.rust",
|
506 |
| - "begin": "(?:(pub)|(?:(\\.)?([A-Za-z0-9_]+)))(\\()", |
| 513 | + "begin": "((?:r#(?!crate|[Ss]elf|super))?[A-Za-z0-9_]+)(\\()", |
507 | 514 | "beginCaptures": {
|
508 | 515 | "1": {
|
509 |
| - "name": "keyword.other.rust" |
510 |
| - }, |
511 |
| - "2": { |
512 |
| - "name": "keyword.operator.access.dot.rust" |
513 |
| - }, |
514 |
| - "3": { |
515 | 516 | "name": "entity.name.function.rust"
|
516 | 517 | },
|
517 |
| - "4": { |
| 518 | + "2": { |
518 | 519 | "name": "punctuation.brackets.round.rust"
|
519 | 520 | }
|
520 | 521 | },
|
|
1042 | 1043 | {
|
1043 | 1044 | "comment": "variables",
|
1044 | 1045 | "name": "variable.other.rust",
|
1045 |
| - "match": "\\b(?<!\\.)[a-z0-9_]+\\b" |
| 1046 | + "match": "\\b(?<!\\.)(?:r#(?!(crate|[Ss]elf|super)))?[a-z0-9_]+\\b" |
1046 | 1047 | }
|
1047 | 1048 | ]
|
1048 | 1049 | }
|
|
0 commit comments