precedence fixes:
prevent `pat` from matching before `path` in metavariable types
reduce the precedence of math operators so that assignment operators match correctly
{
"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"
{
"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"
"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",
"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|(?:(\\()|(\\[)|(\\{)))",
