diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-11-07 03:59:36 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-11-07 03:59:36 +0000 |
commit | fa03bfb115f49a681fb1ea6a9ea1209c847ac0be (patch) | |
tree | 0985f4d70612cf6abb1e5d822d43fe9ae3cbb54f /editors | |
parent | ed9f8d53bc6f779ec006141e1f99e25d8ce4427d (diff) | |
parent | ffc5f4cf2b3959c38e5fa9830a11e5a6c4dfd57e (diff) |
Merge #6489
6489: Textmate grammar: Precedence fixes r=dustypomerleau a=dustypomerleau
- prevent `pat` from matching before `path` in metavariable types
- reduce the precedence of math operators so that assignment operators match correctly
Co-authored-by: Dusty Pomerleau <[email protected]>
Diffstat (limited to 'editors')
-rw-r--r-- | editors/code/rust.tmGrammar.json | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/editors/code/rust.tmGrammar.json b/editors/code/rust.tmGrammar.json index 7475aadbb..f551498ac 100644 --- a/editors/code/rust.tmGrammar.json +++ b/editors/code/rust.tmGrammar.json | |||
@@ -50,7 +50,7 @@ | |||
50 | { | 50 | { |
51 | "comment": "macro type metavariables", | 51 | "comment": "macro type metavariables", |
52 | "name": "meta.macro.metavariable.type.rust", | 52 | "name": "meta.macro.metavariable.type.rust", |
53 | "match": "(\\$)((crate)|([A-Z][A-Za-z0-9_]*))((:)(block|expr|ident|item|lifetime|literal|meta|pat|path|stmt|tt|ty|vis))?", | 53 | "match": "(\\$)((crate)|([A-Z][A-Za-z0-9_]*))((:)(block|expr|ident|item|lifetime|literal|meta|path?|stmt|tt|ty|vis))?", |
54 | "captures": { | 54 | "captures": { |
55 | "1": { | 55 | "1": { |
56 | "name": "keyword.operator.macro.dollar.rust" | 56 | "name": "keyword.operator.macro.dollar.rust" |
@@ -77,7 +77,7 @@ | |||
77 | { | 77 | { |
78 | "comment": "macro metavariables", | 78 | "comment": "macro metavariables", |
79 | "name": "meta.macro.metavariable.rust", | 79 | "name": "meta.macro.metavariable.rust", |
80 | "match": "(\\$)([a-z][A-Za-z0-9_]*)((:)(block|expr|ident|item|lifetime|literal|meta|pat|path|stmt|tt|ty|vis))?", | 80 | "match": "(\\$)([a-z][A-Za-z0-9_]*)((:)(block|expr|ident|item|lifetime|literal|meta|path?|stmt|tt|ty|vis))?", |
81 | "captures": { | 81 | "captures": { |
82 | "1": { | 82 | "1": { |
83 | "name": "keyword.operator.macro.dollar.rust" | 83 | "name": "keyword.operator.macro.dollar.rust" |
@@ -676,11 +676,6 @@ | |||
676 | "match": "\\bmut\\b" | 676 | "match": "\\bmut\\b" |
677 | }, | 677 | }, |
678 | { | 678 | { |
679 | "comment": "math operators", | ||
680 | "name": "keyword.operator.math.rust", | ||
681 | "match": "(([+%]|(\\*(?!\\w)))(?!=))|(-(?!>))|(/(?!/))" | ||
682 | }, | ||
683 | { | ||
684 | "comment": "logical operators", | 679 | "comment": "logical operators", |
685 | "name": "keyword.operator.logical.rust", | 680 | "name": "keyword.operator.logical.rust", |
686 | "match": "(\\^|\\||\\|\\||&&|<<|>>|!)(?!=)" | 681 | "match": "(\\^|\\||\\|\\||&&|<<|>>|!)(?!=)" |
@@ -706,6 +701,11 @@ | |||
706 | "match": "(=(=)?(?!>)|!=|<=|(?<!=)>=)" | 701 | "match": "(=(=)?(?!>)|!=|<=|(?<!=)>=)" |
707 | }, | 702 | }, |
708 | { | 703 | { |
704 | "comment": "math operators", | ||
705 | "name": "keyword.operator.math.rust", | ||
706 | "match": "(([+%]|(\\*(?!\\w)))(?!=))|(-(?!>))|(/(?!/))" | ||
707 | }, | ||
708 | { | ||
709 | "comment": "less than, greater than (special case)", | 709 | "comment": "less than, greater than (special case)", |
710 | "match": "(?:\\b|(?:(\\))|(\\])|(\\})))[ \\t]+([<>])[ \\t]+(?:\\b|(?:(\\()|(\\[)|(\\{)))", | 710 | "match": "(?:\\b|(?:(\\))|(\\])|(\\})))[ \\t]+([<>])[ \\t]+(?:\\b|(?:(\\()|(\\[)|(\\{)))", |
711 | "captures": { | 711 | "captures": { |