From 83c9ad731e45013e2b21a02fd803c58fd0fa746c Mon Sep 17 00:00:00 2001 From: Li-yao Xia Date: Mon, 30 Dec 2024 11:47:51 +0100 Subject: [PATCH] syntax: highlight function calls, namespaces, self, let, and more operators --- vscode/syntaxes/pearlite.json | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/vscode/syntaxes/pearlite.json b/vscode/syntaxes/pearlite.json index 4a3aff0..91db75e 100644 --- a/vscode/syntaxes/pearlite.json +++ b/vscode/syntaxes/pearlite.json @@ -8,12 +8,16 @@ "expr": { "patterns": [ { "include": "#keyword" }, + { "include": "#other-keyword" }, { "include": "#mut" }, { "include": "#constructor"}, { "include": "#quantifier" }, { "include": "#braces" }, { "include": "#parentheses" }, { "include": "#brackets" }, + { "include": "#self" }, + { "include": "#function" }, + { "include": "#namespace" }, { "include": "#identifier" }, { "include": "#number" }, { "include": "#special" }, @@ -22,7 +26,7 @@ ] }, "special": { - "match": "[@*^&]", + "match": "\\|\\||&&|==>|==|!=|<=|>=|[@*^&<>/!-]", "name": "keyword.operator" }, "keyword": { @@ -33,6 +37,10 @@ "match": "\\bmut\\b", "name": "storage.modifier" }, + "other-keyword": { + "match": "\\blet\\b", + "name": "storage.type.rust" + }, "constant": { "match": "\\b(?:true|false)\\b", "name": "constant.language" @@ -123,6 +131,18 @@ { "include": "#type" } ] }, + "self": { + "match": "\\b[sS]elf\\b", + "name": "variable.language.self.rust" + }, + "function": { + "match": "\\b[a-zA-Z][a-zA-Z0-9_']*\\b(?=(?:\\(|::<))", + "name": "entity.name.function.pearlite" + }, + "namespace": { + "match": "\\b[a-zA-Z][a-zA-Z0-9_']*\\b(?=::[^a-zA-Z])", + "name": "entity.name.namespace.pearlite" + }, "identifier": { "match": "\\b[a-zA-Z][a-zA-Z0-9_']*\\b", "name": "variable"