Skip to content

Commit

Permalink
re-classify keywords (control, storage, other); bundle bangs into macros
Browse files Browse the repository at this point in the history
  • Loading branch information
dustypomerleau committed Oct 10, 2020
1 parent 8ab2761 commit 575a1b5
Showing 1 changed file with 30 additions and 26 deletions.
56 changes: 30 additions & 26 deletions editors/code/rust.tmGrammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,21 +98,18 @@
{
"comment": "macro rules",
"name": "meta.macro.rules.rust",
"match": "\\b(macro_rules)(!)\\s+(([a-z0-9_]+)|([A-Z][a-z0-9_]*))\\s+(\\{)",
"match": "\\b(macro_rules!)\\s+(([a-z0-9_]+)|([A-Z][a-z0-9_]*))\\s+(\\{)",
"captures": {
"1": {
"name": "entity.name.function.macro.rust"
"name": "entity.name.function.macro.rules.rust"
},
"2": {
"name": "keyword.operator.macro.not.rust"
"3": {
"name": "entity.name.function.macro.rust"
},
"4": {
"name": "entity.name.function.rust"
},
"5": {
"name": "entity.name.type.macro.rust"
},
"6": {
"5": {
"name": "punctuation.brackets.curly.rust"
}
}
Expand Down Expand Up @@ -564,7 +561,22 @@
{
"comment": "control flow keywords",
"name": "keyword.control.rust",
"match": "\\b(abstract|as|async|await|become|box|break|const|continue|do|dyn|else|enum|extern|final|for|if|impl|in|let|loop|macro|match|mod|move|override|priv|pub|ref|return|static|struct|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\\b"
"match": "\\b(async|await|break|continue|do|else|for|if|loop|match|move|return|try|where|while|yield)\\b"
},
{
"comment": "storage keywords",
"name": "storage.type.rust",
"match": "\\b(const|enum|extern|let|macro|mod|struct|trait|type)\\b"
},
{
"comment": "storage modifiers",
"name": "storage.modifier.rust",
"match": "\\b(abstract|static)\\b"
},
{
"comment": "other keywords",
"name": "keyword.other.rust",
"match": "\\b(as|become|box|dyn|final|impl|in|override|priv|pub|ref|typeof|union|unsafe|unsized|use|virtual)\\b"
},
{
"comment": "pub as a function",
Expand All @@ -580,7 +592,7 @@
},
{
"comment": "fn",
"name": "keyword.control.fn.rust",
"name": "keyword.other.fn.rust",
"match": "\\bfn\\b"
},
{
Expand All @@ -590,7 +602,7 @@
},
{
"comment": "mut",
"name": "keyword.other.mut.rust",
"name": "storage.modifier.mut.rust",
"match": "\\bmut\\b"
},
{
Expand All @@ -601,12 +613,7 @@
{
"comment": "logical operators",
"name": "keyword.operator.logical.rust",
"match": "(\\^|\\||\\|\\||&&|<<|>>)(?!=)"
},
{
"comment": "macro bang and not",
"name": "keyword.operator.macro.not.rust",
"match": "!(?!=)"
"match": "(\\^|\\||\\|\\||&&|<<|>>|!)(?!=)"
},
{
"comment": "logical AND, borrow references",
Expand Down Expand Up @@ -652,7 +659,7 @@
}
},
{
"comment": "subpattern bindng",
"comment": "subpattern binding",
"name": "keyword.operator.subpattern.rust",
"match": "@"
},
Expand Down Expand Up @@ -750,16 +757,13 @@
{
"comment": "macros",
"name": "meta.macro.rust",
"match": "(([a-z_][A-Za-z0-9_]*)|([A-Z_][A-Za-z0-9_]*))(!)",
"match": "(([a-z_][A-Za-z0-9_]*!)|([A-Z_][A-Za-z0-9_]*!))",
"captures": {
"2": {
"name": "entity.name.function.macro.rust"
},
"3": {
"name": "entity.name.type.macro.rust"
},
"4": {
"name": "keyword.operator.macro.not.rust"
}
}
}
Expand Down Expand Up @@ -843,7 +847,7 @@
"match": "\\b(trait)\\s+([A-Z][A-Za-z0-9]*)\\b",
"captures": {
"1": {
"name": "keyword.control.rust"
"name": "storage.type.rust"
},
"2": {
"name": "entity.name.type.trait.rust"
Expand All @@ -855,7 +859,7 @@
"match": "\\b(struct)\\s+([A-Z][A-Za-z0-9]*)\\b",
"captures": {
"1": {
"name": "keyword.control.rust"
"name": "storage.type.rust"
},
"2": {
"name": "entity.name.type.struct.rust"
Expand All @@ -867,7 +871,7 @@
"match": "\\b(enum)\\s+([A-Z][A-Za-z0-9_]*)\\b",
"captures": {
"1": {
"name": "keyword.control.rust"
"name": "storage.type.rust"
},
"2": {
"name": "entity.name.type.enum.rust"
Expand All @@ -879,7 +883,7 @@
"match": "\\b(type)\\s+([A-Z][A-Za-z0-9_]*)\\b",
"captures": {
"1": {
"name": "keyword.control.rust"
"name": "storage.type.rust"
},
"2": {
"name": "entity.name.type.declaration.rust"
Expand Down

0 comments on commit 575a1b5

Please sign in to comment.