Clean up grammar by a lot
This commit is contained in:
parent
fa95da97ae
commit
8d8d6ac336
@ -1,56 +1,11 @@
|
|||||||
{
|
{
|
||||||
"scopeName": "source.reid",
|
"scopeName": "source.reid",
|
||||||
"patterns": [
|
"patterns": [
|
||||||
{
|
|
||||||
"include": "#import"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"include": "#expression"
|
"include": "#expression"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"repository": {
|
"repository": {
|
||||||
"import": {
|
|
||||||
"begin": "(import)\\s*",
|
|
||||||
"end": ";",
|
|
||||||
"beginCaptures": {
|
|
||||||
"1": {
|
|
||||||
"name": "keyword"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"endCaptures": {
|
|
||||||
"0": {
|
|
||||||
"name": "punctuation.semi.reid"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"patterns": [
|
|
||||||
{
|
|
||||||
"include": "#identifier"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"include": "#punctiation"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"punctuation": {
|
|
||||||
"patterns": [
|
|
||||||
{
|
|
||||||
"match": "::",
|
|
||||||
"name": "keyword.operator.namespace.reid"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"match": ";",
|
|
||||||
"name": "punctuation.semi.reid"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"match": ".",
|
|
||||||
"name": "punctuation.dot.reid"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"match": ",",
|
|
||||||
"name": "punctuation.comma.reid"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"expression": {
|
"expression": {
|
||||||
"patterns": [
|
"patterns": [
|
||||||
{
|
{
|
||||||
@ -59,27 +14,18 @@
|
|||||||
{
|
{
|
||||||
"include": "#fn-signature"
|
"include": "#fn-signature"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"include": "#namespace"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"include": "#common-type"
|
"include": "#common-type"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"include": "#binop-impl"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"include": "#type-impl"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"include": "#struct-definition"
|
"include": "#struct-definition"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"include": "#block"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"include": "#binop"
|
"include": "#binop"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"include": "#namespace"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"include": "#cast"
|
"include": "#cast"
|
||||||
},
|
},
|
||||||
@ -95,9 +41,6 @@
|
|||||||
{
|
{
|
||||||
"include": "#keywords"
|
"include": "#keywords"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"include": "#struct-expression"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"include": "#number-literal"
|
"include": "#number-literal"
|
||||||
},
|
},
|
||||||
@ -112,93 +55,44 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"punctuation": {
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"match": "::",
|
||||||
|
"name": "keyword.operator.namespace.reid"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": ":",
|
||||||
|
"name": "keyword.operator.colon.reid"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": ";",
|
||||||
|
"name": "punctuation.semi.reid"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": ".",
|
||||||
|
"name": "punctuation.dot.reid"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": ",",
|
||||||
|
"name": "punctuation.comma.reid"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "\\{|\\}",
|
||||||
|
"name": "punctuation.brackets.curly.reid"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "\\(|\\)",
|
||||||
|
"name": "punctuation.parenthesis.reid"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"comment": {
|
"comment": {
|
||||||
"match": "\\/\\/(.|\\/)*",
|
"match": "\\/\\/(.|\\/)*",
|
||||||
"name": "comment.line.double-slash.reid"
|
"name": "comment.line.double-slash.reid"
|
||||||
},
|
},
|
||||||
"fn-signature": {
|
|
||||||
"begin": "(fn)\\s*(\\w+)\\(",
|
|
||||||
"beginCaptures": {
|
|
||||||
"1": {
|
|
||||||
"name": "keyword.fn.reid"
|
|
||||||
},
|
|
||||||
"2": {
|
|
||||||
"name": "entity.name.function.reid"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"end": "\\)",
|
|
||||||
"patterns": [
|
|
||||||
{
|
|
||||||
"include": "#annotated-identifier"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"include": "#keywords"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"include": "#binop"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"endCaptures": {
|
|
||||||
"2": {
|
|
||||||
"name": "entity.name.type.reid"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"type-impl": {
|
|
||||||
"begin": "(impl)\\s* (\\w+)\\s* \\{\n",
|
|
||||||
"end": "\\}",
|
|
||||||
"captures": {
|
|
||||||
"1": {
|
|
||||||
"name": "keyword.impl.reid"
|
|
||||||
},
|
|
||||||
"2": {
|
|
||||||
"name": "entity.name.type"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"patterns": [
|
|
||||||
{
|
|
||||||
"include": "#expression"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"binop-impl": {
|
|
||||||
"begin": "(impl)\\s+(binop)\\s+\\(((.*)\\s*:\\s*(.*))\\)(.*)\\(((.*)\\s*:\\s*(.*))\\)\\s*->\\s*(\\w+)\\s*\\{",
|
|
||||||
"end": "\\}",
|
|
||||||
"beginCaptures": {
|
|
||||||
"1": {
|
|
||||||
"name": "keyword.impl.reid"
|
|
||||||
},
|
|
||||||
"2": {
|
|
||||||
"name": "keyword.impl.reid"
|
|
||||||
},
|
|
||||||
"4": {
|
|
||||||
"name": "variable.parameter.binop.reid"
|
|
||||||
},
|
|
||||||
"5": {
|
|
||||||
"name": "entity.name.type.parameter.binop.reid"
|
|
||||||
},
|
|
||||||
"6": {
|
|
||||||
"name": "keyword.operator.math.reid"
|
|
||||||
},
|
|
||||||
"8": {
|
|
||||||
"name": "variable.parameter.binop.reid"
|
|
||||||
},
|
|
||||||
"9": {
|
|
||||||
"name": "entity.name.type.parameter.binop.reid"
|
|
||||||
},
|
|
||||||
"10": {
|
|
||||||
"name": "entity.name.type.return.binop.reid"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"patterns": [
|
|
||||||
{
|
|
||||||
"include": "#expression"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"struct-definition": {
|
"struct-definition": {
|
||||||
"begin": "(struct)\\s*(\\w+)\\s*\\{",
|
"match": "(struct)\\s*(\\w+)",
|
||||||
"end": "\\}",
|
|
||||||
"captures": {
|
"captures": {
|
||||||
"1": {
|
"1": {
|
||||||
"name": "keyword.struct.reid"
|
"name": "keyword.struct.reid"
|
||||||
@ -206,15 +100,10 @@
|
|||||||
"2": {
|
"2": {
|
||||||
"name": "entity.name.type"
|
"name": "entity.name.type"
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
"patterns": [
|
|
||||||
{
|
|
||||||
"include": "#annotated-identifier"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"struct-expression": {
|
"struct-expression": {
|
||||||
"begin": "([A-Z]\\w*)\\s*\\{",
|
"begin": "\\b([A-Z]\\w*)\\s*\\{",
|
||||||
"end": "\\}",
|
"end": "\\}",
|
||||||
"captures": {
|
"captures": {
|
||||||
"1": {
|
"1": {
|
||||||
@ -230,19 +119,19 @@
|
|||||||
"number-literal": {
|
"number-literal": {
|
||||||
"patterns": [
|
"patterns": [
|
||||||
{
|
{
|
||||||
"match": "0x[0-9a-fA-F]+(\\.[0-9a-fA-F]+)?",
|
"match": "\\b0x[0-9a-fA-F]+(\\.[0-9a-fA-F]+)?\\b",
|
||||||
"name": "constant.hexadecimal"
|
"name": "constant.hexadecimal"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"match": "0o[0-7]+(\\.[0-7]+)?",
|
"match": "\\b0o[0-7]+(\\.[0-7]+)?\\b",
|
||||||
"name": "constant.octal"
|
"name": "constant.octal"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"match": "0b[01]+(\\.[01]+)?",
|
"match": "\\b0b[01]+(\\.[01]+)?\\b",
|
||||||
"name": "constant.binary"
|
"name": "constant.binary"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"match": "[0-9]+(\\.[0-9]+)?",
|
"match": "\\b[0-9]+(\\.[0-9]+)?\\b",
|
||||||
"name": "constant.numeric"
|
"name": "constant.numeric"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -253,25 +142,16 @@
|
|||||||
"name": "string.quoted.double",
|
"name": "string.quoted.double",
|
||||||
"patterns": [
|
"patterns": [
|
||||||
{
|
{
|
||||||
"match": "\\.",
|
"match": "\\\\\\w",
|
||||||
"name": "constant.character.escape"
|
"name": "constant.character.escape"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"block": {
|
|
||||||
"begin": "\\{",
|
|
||||||
"end": "\\}",
|
|
||||||
"patterns": [
|
|
||||||
{
|
|
||||||
"include": "#expression"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"namespace": {
|
"namespace": {
|
||||||
"match": "(\\w+)(\\:\\:)",
|
"match": "(\\w+)(\\:\\:)",
|
||||||
"captures": {
|
"captures": {
|
||||||
"1": {
|
"1": {
|
||||||
"name": "entity.name.function.reid"
|
"name": "entity.name.namespace.reid"
|
||||||
},
|
},
|
||||||
"2": {
|
"2": {
|
||||||
"name": "keyword.operator.namespace.reid"
|
"name": "keyword.operator.namespace.reid"
|
||||||
@ -290,11 +170,19 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"function-call": {
|
"function-call": {
|
||||||
"begin": "(\\w+)?\\(",
|
"begin": "(\\w+)?(\\()",
|
||||||
"end": "\\)",
|
"end": "(\\))",
|
||||||
"beginCaptures": {
|
"beginCaptures": {
|
||||||
"1": {
|
"1": {
|
||||||
"name": "entity.name.function.reid"
|
"name": "entity.name.function.reid"
|
||||||
|
},
|
||||||
|
"2": {
|
||||||
|
"name": "punctuation.parenthesis.reid"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"endCaptures": {
|
||||||
|
"1": {
|
||||||
|
"name": "punctuation.parenthesis.reid"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"patterns": [
|
"patterns": [
|
||||||
@ -322,28 +210,10 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"annotated-identifier": {
|
|
||||||
"begin": "(\\w+)\\:",
|
|
||||||
"end": ",",
|
|
||||||
"beginCaptures": {
|
|
||||||
"1": {
|
|
||||||
"name": "variable.language.reid"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"patterns": [
|
|
||||||
{
|
|
||||||
"include": "#expression"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"identifier": {
|
"identifier": {
|
||||||
"patterns": [
|
"patterns": [
|
||||||
{
|
{
|
||||||
"match": "[A-Z]\\w*",
|
"match": "\\b(?:\\w+)\\b",
|
||||||
"name": "entity.name.type.reid"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"match": "\\w+",
|
|
||||||
"name": "variable.language.reid"
|
"name": "variable.language.reid"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -351,16 +221,32 @@
|
|||||||
"keywords": {
|
"keywords": {
|
||||||
"patterns": [
|
"patterns": [
|
||||||
{
|
{
|
||||||
"match": "let|mut|pub|extern",
|
"match": "\\b(?:let|mut|pub|extern)\\b",
|
||||||
"name": "storage.type.reid"
|
"name": "storage.type.reid"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"match": "if|return",
|
"match": "\\bimport\\b",
|
||||||
|
"name": "keyword.import.reid"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "\\bbinop\\b",
|
||||||
|
"name": "keyword.binop.reid"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "\\bimpl\\b",
|
||||||
|
"name": "keyword.impl.reid"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "\\b(?:if|return|for|in)\\b",
|
||||||
"name": "keyword.control"
|
"name": "keyword.control"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"match": "self",
|
"match": "\\bself\\b",
|
||||||
"name": "variable.language.self.reid"
|
"name": "variable.language.self.reid"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "\\bfn\\b",
|
||||||
|
"name": "keyword.fn.reid"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -388,7 +274,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"common-type": {
|
"common-type": {
|
||||||
"match": "u8|u16|u32|u64|u128|i8|i16|i32|i64|i128|bool",
|
"match": "\\b(?:u8|u16|u32|u64|u128|i8|i16|i32|i64|i128|f16|f16b|f32|f64|f80|f128|f128ppc|bool|char|([A-Z]\\w*))\\b",
|
||||||
"name": "entity.name.type.common.reid"
|
"name": "entity.name.type.common.reid"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,133 +1,52 @@
|
|||||||
scopeName: source.reid
|
scopeName: source.reid
|
||||||
patterns:
|
patterns:
|
||||||
- include: "#import"
|
|
||||||
- include: "#expression"
|
- include: "#expression"
|
||||||
repository:
|
repository:
|
||||||
# function-definition:
|
expression:
|
||||||
# begin: "(fn)\\s*(\\w+)\\(((\\w+)\\s*\\:\\s*(\\w+),?)*\\)\\s*->\\s*(\\w+)\\s*\\{"
|
|
||||||
# end: "\\}"
|
|
||||||
# beginCaptures:
|
|
||||||
# 1:
|
|
||||||
# name: "keyword.other"
|
|
||||||
# 2:
|
|
||||||
# name: "entity.name.function"
|
|
||||||
# 4:
|
|
||||||
# name: "entity.name.parameter"
|
|
||||||
# 5:
|
|
||||||
# name: "entity.name.type"
|
|
||||||
# 6:
|
|
||||||
# name: "entity.name.type"
|
|
||||||
# patterns:
|
|
||||||
# - include: "#type"
|
|
||||||
# - include: "#expression"
|
|
||||||
import:
|
|
||||||
begin: "(import)\\s*"
|
|
||||||
end: ";"
|
|
||||||
beginCaptures:
|
|
||||||
1:
|
|
||||||
name: keyword
|
|
||||||
endCaptures:
|
|
||||||
0:
|
|
||||||
name: punctuation.semi.reid
|
|
||||||
patterns:
|
patterns:
|
||||||
|
- include: "#comment"
|
||||||
|
- include: "#fn-signature"
|
||||||
|
- include: "#namespace"
|
||||||
|
- include: "#common-type"
|
||||||
|
- include: "#struct-definition"
|
||||||
|
- include: "#binop"
|
||||||
|
- include: "#cast"
|
||||||
|
- include: "#function-call"
|
||||||
|
- include: "#parenthesis"
|
||||||
|
- include: "#array"
|
||||||
|
- include: "#keywords"
|
||||||
|
- include: "#number-literal"
|
||||||
|
- include: "#string-literal"
|
||||||
- include: "#identifier"
|
- include: "#identifier"
|
||||||
- include: "#punctiation"
|
- include: "#punctuation"
|
||||||
punctuation:
|
punctuation:
|
||||||
patterns:
|
patterns:
|
||||||
- match: "::"
|
- match: "::"
|
||||||
name: keyword.operator.namespace.reid
|
name: keyword.operator.namespace.reid
|
||||||
|
- match: ":"
|
||||||
|
name: keyword.operator.colon.reid
|
||||||
- match: ";"
|
- match: ";"
|
||||||
name: punctuation.semi.reid
|
name: punctuation.semi.reid
|
||||||
- match: "."
|
- match: "."
|
||||||
name: punctuation.dot.reid
|
name: punctuation.dot.reid
|
||||||
- match: ","
|
- match: ","
|
||||||
name: punctuation.comma.reid
|
name: punctuation.comma.reid
|
||||||
expression:
|
- match: "\\{|\\}"
|
||||||
patterns:
|
name: punctuation.brackets.curly.reid
|
||||||
- include: "#comment"
|
- match: "\\(|\\)"
|
||||||
- include: "#fn-signature"
|
name: punctuation.parenthesis.reid
|
||||||
- include: "#common-type"
|
|
||||||
- include: "#binop-impl"
|
|
||||||
- include: "#type-impl"
|
|
||||||
- include: "#struct-definition"
|
|
||||||
- include: "#block"
|
|
||||||
- include: "#binop"
|
|
||||||
- include: "#namespace"
|
|
||||||
- include: "#cast"
|
|
||||||
- include: "#function-call"
|
|
||||||
- include: "#parenthesis"
|
|
||||||
- include: "#array"
|
|
||||||
- include: "#keywords"
|
|
||||||
- include: "#struct-expression"
|
|
||||||
- include: "#number-literal"
|
|
||||||
- include: "#string-literal"
|
|
||||||
- include: "#identifier"
|
|
||||||
- include: "#punctuation"
|
|
||||||
comment:
|
comment:
|
||||||
match: "\\/\\/(.|\\/)*"
|
match: "\\/\\/(.|\\/)*"
|
||||||
name: comment.line.double-slash.reid
|
name: comment.line.double-slash.reid
|
||||||
fn-signature:
|
|
||||||
begin: "(fn)\\s*(\\w+)\\("
|
|
||||||
beginCaptures:
|
|
||||||
1:
|
|
||||||
name: keyword.fn.reid
|
|
||||||
2:
|
|
||||||
name: entity.name.function.reid
|
|
||||||
end: "\\)"
|
|
||||||
patterns:
|
|
||||||
- include: "#annotated-identifier"
|
|
||||||
- include: "#keywords"
|
|
||||||
- include: "#binop"
|
|
||||||
endCaptures:
|
|
||||||
2:
|
|
||||||
name: entity.name.type.reid
|
|
||||||
type-impl:
|
|
||||||
begin: >
|
|
||||||
(impl)\s*
|
|
||||||
(\w+)\s*
|
|
||||||
\{
|
|
||||||
end: "\\}"
|
|
||||||
captures:
|
|
||||||
1:
|
|
||||||
name: keyword.impl.reid
|
|
||||||
2:
|
|
||||||
name: entity.name.type
|
|
||||||
patterns:
|
|
||||||
- include: "#expression"
|
|
||||||
binop-impl:
|
|
||||||
begin: "(impl)\\s+(binop)\\s+\\(((.*)\\s*:\\s*(.*))\\)(.*)\\(((.*)\\s*:\\s*(.*))\\)\\s*->\\s*(\\w+)\\s*\\{"
|
|
||||||
end: "\\}"
|
|
||||||
beginCaptures:
|
|
||||||
1:
|
|
||||||
name: keyword.impl.reid
|
|
||||||
2:
|
|
||||||
name: keyword.impl.reid
|
|
||||||
4:
|
|
||||||
name: variable.parameter.binop.reid
|
|
||||||
5:
|
|
||||||
name: entity.name.type.parameter.binop.reid
|
|
||||||
6:
|
|
||||||
name: keyword.operator.math.reid
|
|
||||||
8:
|
|
||||||
name: variable.parameter.binop.reid
|
|
||||||
9:
|
|
||||||
name: entity.name.type.parameter.binop.reid
|
|
||||||
10:
|
|
||||||
name: entity.name.type.return.binop.reid
|
|
||||||
patterns:
|
|
||||||
- include: "#expression"
|
|
||||||
struct-definition:
|
struct-definition:
|
||||||
begin: "(struct)\\s*(\\w+)\\s*\\{"
|
match: "(struct)\\s*(\\w+)"
|
||||||
end: "\\}"
|
|
||||||
captures:
|
captures:
|
||||||
1:
|
1:
|
||||||
name: keyword.struct.reid
|
name: keyword.struct.reid
|
||||||
2:
|
2:
|
||||||
name: entity.name.type
|
name: entity.name.type
|
||||||
patterns:
|
|
||||||
- include: "#annotated-identifier"
|
|
||||||
struct-expression:
|
struct-expression:
|
||||||
begin: "([A-Z]\\w*)\\s*\\{"
|
begin: "\\b([A-Z]\\w*)\\s*\\{"
|
||||||
end: "\\}"
|
end: "\\}"
|
||||||
captures:
|
captures:
|
||||||
1:
|
1:
|
||||||
@ -136,31 +55,26 @@ repository:
|
|||||||
- include: "#expression"
|
- include: "#expression"
|
||||||
number-literal:
|
number-literal:
|
||||||
patterns:
|
patterns:
|
||||||
- match: "0x[0-9a-fA-F]+(\\.[0-9a-fA-F]+)?"
|
- match: "\\b0x[0-9a-fA-F]+(\\.[0-9a-fA-F]+)?\\b"
|
||||||
name: "constant.hexadecimal"
|
name: "constant.hexadecimal"
|
||||||
- match: "0o[0-7]+(\\.[0-7]+)?"
|
- match: "\\b0o[0-7]+(\\.[0-7]+)?\\b"
|
||||||
name: "constant.octal"
|
name: "constant.octal"
|
||||||
- match: "0b[01]+(\\.[01]+)?"
|
- match: "\\b0b[01]+(\\.[01]+)?\\b"
|
||||||
name: "constant.binary"
|
name: "constant.binary"
|
||||||
- match: "[0-9]+(\\.[0-9]+)?"
|
- match: "\\b[0-9]+(\\.[0-9]+)?\\b"
|
||||||
name: "constant.numeric"
|
name: "constant.numeric"
|
||||||
string-literal:
|
string-literal:
|
||||||
begin: '"'
|
begin: '"'
|
||||||
end: '"'
|
end: '"'
|
||||||
name: string.quoted.double
|
name: string.quoted.double
|
||||||
patterns:
|
patterns:
|
||||||
- match: "\\."
|
- match: "\\\\\\w"
|
||||||
name: constant.character.escape
|
name: constant.character.escape
|
||||||
block:
|
|
||||||
begin: "\\{"
|
|
||||||
end: "\\}"
|
|
||||||
patterns:
|
|
||||||
- include: "#expression"
|
|
||||||
namespace:
|
namespace:
|
||||||
match: "(\\w+)(\\:\\:)"
|
match: "(\\w+)(\\:\\:)"
|
||||||
captures:
|
captures:
|
||||||
1:
|
1:
|
||||||
name: entity.name.function.reid
|
name: entity.name.namespace.reid
|
||||||
2:
|
2:
|
||||||
name: keyword.operator.namespace.reid
|
name: keyword.operator.namespace.reid
|
||||||
cast:
|
cast:
|
||||||
@ -171,11 +85,16 @@ repository:
|
|||||||
2:
|
2:
|
||||||
name: entity.name.type.reid
|
name: entity.name.type.reid
|
||||||
function-call:
|
function-call:
|
||||||
begin: "(\\w+)?\\("
|
begin: "(\\w+)?(\\()"
|
||||||
end: "\\)"
|
end: "(\\))"
|
||||||
beginCaptures:
|
beginCaptures:
|
||||||
1:
|
1:
|
||||||
name: entity.name.function.reid
|
name: entity.name.function.reid
|
||||||
|
2:
|
||||||
|
name: punctuation.parenthesis.reid
|
||||||
|
endCaptures:
|
||||||
|
1:
|
||||||
|
name: punctuation.parenthesis.reid
|
||||||
patterns:
|
patterns:
|
||||||
- include: "#expression"
|
- include: "#expression"
|
||||||
parenthesis:
|
parenthesis:
|
||||||
@ -189,28 +108,26 @@ repository:
|
|||||||
name: keyword.operator.parenthesis.reid
|
name: keyword.operator.parenthesis.reid
|
||||||
patterns:
|
patterns:
|
||||||
- include: "#expression"
|
- include: "#expression"
|
||||||
annotated-identifier:
|
|
||||||
begin: "(\\w+)\\:"
|
|
||||||
end: ","
|
|
||||||
beginCaptures:
|
|
||||||
1:
|
|
||||||
name: variable.language.reid
|
|
||||||
patterns:
|
|
||||||
- include: "#expression"
|
|
||||||
identifier:
|
identifier:
|
||||||
patterns:
|
patterns:
|
||||||
- match: "[A-Z]\\w*"
|
- match: "\\b(?:\\w+)\\b"
|
||||||
name: entity.name.type.reid
|
|
||||||
- match: "\\w+"
|
|
||||||
name: variable.language.reid
|
name: variable.language.reid
|
||||||
keywords:
|
keywords:
|
||||||
patterns:
|
patterns:
|
||||||
- match: "let|mut|pub|extern"
|
- match: "\\b(?:let|mut|pub|extern)\\b"
|
||||||
name: "storage.type.reid"
|
name: storage.type.reid
|
||||||
- match: "if|return"
|
- match: "\\bimport\\b"
|
||||||
name: "keyword.control"
|
name: keyword.import.reid
|
||||||
- match: "self"
|
- match: "\\bbinop\\b"
|
||||||
name: "variable.language.self.reid"
|
name: keyword.binop.reid
|
||||||
|
- match: "\\bimpl\\b"
|
||||||
|
name: keyword.impl.reid
|
||||||
|
- match: "\\b(?:if|return|for|in)\\b"
|
||||||
|
name: keyword.control
|
||||||
|
- match: "\\bself\\b"
|
||||||
|
name: variable.language.self.reid
|
||||||
|
- match: "\\bfn\\b"
|
||||||
|
name: keyword.fn.reid
|
||||||
binop:
|
binop:
|
||||||
match: "\\<\\=|\\>\\=|\\=\\=|\\<|\\>|\\*|\\+|\\-|\\^|\\&\\&|\\&"
|
match: "\\<\\=|\\>\\=|\\=\\=|\\<|\\>|\\*|\\+|\\-|\\^|\\&\\&|\\&"
|
||||||
name: keyword.operator.math.reid
|
name: keyword.operator.math.reid
|
||||||
@ -226,7 +143,7 @@ repository:
|
|||||||
patterns:
|
patterns:
|
||||||
- include: "#expression"
|
- include: "#expression"
|
||||||
common-type:
|
common-type:
|
||||||
match: "u8|u16|u32|u64|u128|i8|i16|i32|i64|i128|bool"
|
match: "\\b(?:u8|u16|u32|u64|u128|i8|i16|i32|i64|i128|f16|f16b|f32|f64|f80|f128|f128ppc|bool|char|([A-Z]\\w*))\\b"
|
||||||
name: entity.name.type.common.reid
|
name: entity.name.type.common.reid
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user