Skip to content

Commit fa03bfb

Browse files
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]>
2 parents ed9f8d5 + ffc5f4c commit fa03bfb

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

editors/code/rust.tmGrammar.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
{
5151
"comment": "macro type metavariables",
5252
"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))?",
5454
"captures": {
5555
"1": {
5656
"name": "keyword.operator.macro.dollar.rust"
@@ -77,7 +77,7 @@
7777
{
7878
"comment": "macro metavariables",
7979
"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))?",
8181
"captures": {
8282
"1": {
8383
"name": "keyword.operator.macro.dollar.rust"
@@ -675,11 +675,6 @@
675675
"name": "storage.modifier.mut.rust",
676676
"match": "\\bmut\\b"
677677
},
678-
{
679-
"comment": "math operators",
680-
"name": "keyword.operator.math.rust",
681-
"match": "(([+%]|(\\*(?!\\w)))(?!=))|(-(?!>))|(/(?!/))"
682-
},
683678
{
684679
"comment": "logical operators",
685680
"name": "keyword.operator.logical.rust",
@@ -705,6 +700,11 @@
705700
"name": "keyword.operator.comparison.rust",
706701
"match": "(=(=)?(?!>)|!=|<=|(?<!=)>=)"
707702
},
703+
{
704+
"comment": "math operators",
705+
"name": "keyword.operator.math.rust",
706+
"match": "(([+%]|(\\*(?!\\w)))(?!=))|(-(?!>))|(/(?!/))"
707+
},
708708
{
709709
"comment": "less than, greater than (special case)",
710710
"match": "(?:\\b|(?:(\\))|(\\])|(\\})))[ \\t]+([<>])[ \\t]+(?:\\b|(?:(\\()|(\\[)|(\\{)))",

0 commit comments

Comments
 (0)