diff options
| author | Dusty Pomerleau <dustypomerleau@users.noreply.github.com> | 2020-11-07 14:56:06 +1100 |
|---|---|---|
| committer | Dusty Pomerleau <dustypomerleau@users.noreply.github.com> | 2020-11-07 14:56:06 +1100 |
| commit | ffc5f4cf2b3959c38e5fa9830a11e5a6c4dfd57e (patch) | |
| tree | 0985f4d70612cf6abb1e5d822d43fe9ae3cbb54f /editors/code | |
| parent | ed9f8d53bc6f779ec006141e1f99e25d8ce4427d (diff) | |
| download | rust-ffc5f4cf2b3959c38e5fa9830a11e5a6c4dfd57e.tar.gz rust-ffc5f4cf2b3959c38e5fa9830a11e5a6c4dfd57e.zip | |
precedence fixes:
- prevent `pat` from matching before `path` in metavariable types - reduce the precedence of math operators so that assignment operators match correctly
Diffstat (limited to 'editors/code')
| -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 7475aadbb9c..f551498ac11 100644 --- a/editors/code/rust.tmGrammar.json +++ b/editors/code/rust.tmGrammar.json @@ -50,7 +50,7 @@ { "comment": "macro type metavariables", "name": "meta.macro.metavariable.type.rust", - "match": "(\\$)((crate)|([A-Z][A-Za-z0-9_]*))((:)(block|expr|ident|item|lifetime|literal|meta|pat|path|stmt|tt|ty|vis))?", + "match": "(\\$)((crate)|([A-Z][A-Za-z0-9_]*))((:)(block|expr|ident|item|lifetime|literal|meta|path?|stmt|tt|ty|vis))?", "captures": { "1": { "name": "keyword.operator.macro.dollar.rust" @@ -77,7 +77,7 @@ { "comment": "macro metavariables", "name": "meta.macro.metavariable.rust", - "match": "(\\$)([a-z][A-Za-z0-9_]*)((:)(block|expr|ident|item|lifetime|literal|meta|pat|path|stmt|tt|ty|vis))?", + "match": "(\\$)([a-z][A-Za-z0-9_]*)((:)(block|expr|ident|item|lifetime|literal|meta|path?|stmt|tt|ty|vis))?", "captures": { "1": { "name": "keyword.operator.macro.dollar.rust" @@ -676,11 +676,6 @@ "match": "\\bmut\\b" }, { - "comment": "math operators", - "name": "keyword.operator.math.rust", - "match": "(([+%]|(\\*(?!\\w)))(?!=))|(-(?!>))|(/(?!/))" - }, - { "comment": "logical operators", "name": "keyword.operator.logical.rust", "match": "(\\^|\\||\\|\\||&&|<<|>>|!)(?!=)" @@ -706,6 +701,11 @@ "match": "(=(=)?(?!>)|!=|<=|(?<!=)>=)" }, { + "comment": "math operators", + "name": "keyword.operator.math.rust", + "match": "(([+%]|(\\*(?!\\w)))(?!=))|(-(?!>))|(/(?!/))" + }, + { "comment": "less than, greater than (special case)", "match": "(?:\\b|(?:(\\))|(\\])|(\\})))[ \\t]+([<>])[ \\t]+(?:\\b|(?:(\\()|(\\[)|(\\{)))", "captures": { |
