From ffc5f4cf2b3959c38e5fa9830a11e5a6c4dfd57e Mon Sep 17 00:00:00 2001 From: Dusty Pomerleau Date: Sat, 7 Nov 2020 14:56:06 +1100 Subject: precedence fixes: - prevent `pat` from matching before `path` in metavariable types - reduce the precedence of math operators so that assignment operators match correctly --- editors/code/rust.tmGrammar.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'editors') 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 @@ { "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" @@ -675,11 +675,6 @@ "name": "storage.modifier.mut.rust", "match": "\\bmut\\b" }, - { - "comment": "math operators", - "name": "keyword.operator.math.rust", - "match": "(([+%]|(\\*(?!\\w)))(?!=))|(-(?!>))|(/(?!/))" - }, { "comment": "logical operators", "name": "keyword.operator.logical.rust", @@ -705,6 +700,11 @@ "name": "keyword.operator.comparison.rust", "match": "(=(=)?(?!>)|!=|<=|(?=)" }, + { + "comment": "math operators", + "name": "keyword.operator.math.rust", + "match": "(([+%]|(\\*(?!\\w)))(?!=))|(-(?!>))|(/(?!/))" + }, { "comment": "less than, greater than (special case)", "match": "(?:\\b|(?:(\\))|(\\])|(\\})))[ \\t]+([<>])[ \\t]+(?:\\b|(?:(\\()|(\\[)|(\\{)))", -- cgit v1.2.3