From 9ab18872c07618610610d507e2127dd835b50a66 Mon Sep 17 00:00:00 2001 From: Sarthak Shastri Date: Tue, 8 Aug 2023 15:36:30 +0530 Subject: [PATCH 1/8] Refactored func to endpoint - func with modifiers refactored to endpoints - func now does not allow any modifiers and acts as a local function by default --- syntaxes/coco.tmLanguage.json | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/syntaxes/coco.tmLanguage.json b/syntaxes/coco.tmLanguage.json index de96aae..2d663cb 100644 --- a/syntaxes/coco.tmLanguage.json +++ b/syntaxes/coco.tmLanguage.json @@ -17,6 +17,9 @@ { "include": "#contract_name" }, + { + "include": "#endpoints" + }, { "include": "#exceptions" }, @@ -126,6 +129,25 @@ } ] }, + "endpoints": { + "patterns": [ + { + "comment": "Callable Endpoints", + "match": "^(endpoint)\\s+(invokable|deployer)\\s+(\\w+!?)\\(", + "captures": { + "1": { + "name": "keyword.function.coco" + }, + "2": { + "name": "storage.modifier.func.coco" + }, + "3": { + "name": "entity.name.function.coco" + } + } + } + ] + }, "exceptions": { "patterns": [ { @@ -157,14 +179,11 @@ "patterns": [ { "comment": "Function declarations", - "match": "^(func)\\s+(?:(invokable|deployer|local)\\s+)?(\\w+!?)\\(", + "match": "^(func)\\s+(?:()\\s+)?(\\w+!?)\\(", "captures": { "1": { "name": "keyword.function.coco" }, - "2": { - "name": "storage.modifier.func.coco" - }, "3": { "name": "entity.name.function.coco" } From 293ce8f60891c1b606e51235b91f63f482d4928d Mon Sep 17 00:00:00 2001 From: Sarthak Shastri Date: Tue, 8 Aug 2023 15:38:42 +0530 Subject: [PATCH 2/8] elif support retracted - 'else if' must be used in conditional statements --- syntaxes/coco.tmLanguage.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntaxes/coco.tmLanguage.json b/syntaxes/coco.tmLanguage.json index 2d663cb..9ee68a1 100644 --- a/syntaxes/coco.tmLanguage.json +++ b/syntaxes/coco.tmLanguage.json @@ -201,7 +201,7 @@ { "comment": "Control Keywords", "name": "keyword.control.coco", - "match": "\\b(if|elif|else|for|break|pass|continue|return|yield|from|in)\\b" + "match": "\\b(if|else|for|break|pass|continue|return|yield|from|in)\\b" }, { "comment": "Action Keywords", From 74b953470efeff9bbfbf7d3c2a6aa31a0947d09b Mon Sep 17 00:00:00 2001 From: Sarthak Shastri Date: Tue, 8 Aug 2023 15:48:53 +0530 Subject: [PATCH 3/8] multiple var declarations - var a, b, c U64 and similar are now separated --- syntaxes/coco.tmLanguage.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntaxes/coco.tmLanguage.json b/syntaxes/coco.tmLanguage.json index 9ee68a1..cab866b 100644 --- a/syntaxes/coco.tmLanguage.json +++ b/syntaxes/coco.tmLanguage.json @@ -455,7 +455,7 @@ { "comment": "Variable Declaration", "name": "variable.declaration.coco", - "match": "\\b(var)\\b\\s+([a-zA-Z_][a-zA-Z0-9_]*)\\s+([a-zA-Z_][a-zA-Z0-9_]*\\b)?", + "match": "\\b(var)\\b\\s+((?:[a-zA-Z_][a-zA-Z0-9_]*\\s*,\\s*)*[a-zA-Z_][a-zA-Z0-9_]*)\\s+([a-zA-Z_][a-zA-Z0-9_]+\\b)?", "captures": { "1": { "name": "keyword.var.coco" From cfd14a80ec67a3cf5ccd8db08c3389c619c1fa5d Mon Sep 17 00:00:00 2001 From: Sarthak Shastri Date: Tue, 8 Aug 2023 16:02:01 +0530 Subject: [PATCH 4/8] version update -> 0.1.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 174faa3..25912aa 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "displayName": "Cocolang", "icon": "icons/coco.png", "description": "Syntax Highlighting for Cocolang on Visual Studio Code", - "version": "0.1.0", + "version": "0.1.1", "license": "MIT", "publisher": "sarvalabs", "author": { From 27695d3f2859236c6feb988edb8626819b44e080 Mon Sep 17 00:00:00 2001 From: Sarthak Shastri Date: Tue, 8 Aug 2023 16:13:48 +0530 Subject: [PATCH 5/8] added special method keywords - join is now highlighted as a keyword --- syntaxes/coco.tmLanguage.json | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/syntaxes/coco.tmLanguage.json b/syntaxes/coco.tmLanguage.json index cab866b..4b1591d 100644 --- a/syntaxes/coco.tmLanguage.json +++ b/syntaxes/coco.tmLanguage.json @@ -236,7 +236,12 @@ { "comment": "Crypto Builtins", "name": "keyword.builtins.coco", - "match": "\\b(Blake2b|Keccak256|len|Sha256)\\b" + "match": "\\b(Blake2b|Keccak256|Sha256)\\b" + }, + { + "comment": "Special Methods", + "name": "keyword.special.coco", + "match": "\\b(len|join)\\b" } ] }, From 91a4ab846de454aa9f4c39bb155a881b195ec4f6 Mon Sep 17 00:00:00 2001 From: Manish Meganathan Date: Wed, 9 Aug 2023 00:28:06 +0530 Subject: [PATCH 6/8] fix builtin keywords - moved polorize and depolorize as keywords for serial builtins. - fixed crypto builtins --- syntaxes/coco.tmLanguage.json | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/syntaxes/coco.tmLanguage.json b/syntaxes/coco.tmLanguage.json index 4b1591d..a2e07e7 100644 --- a/syntaxes/coco.tmLanguage.json +++ b/syntaxes/coco.tmLanguage.json @@ -191,7 +191,7 @@ }, { "comment": "Supporting functions", - "match": "\\b(append|popend|haskey|merge|polorize|depolorize)\\b(?=\\()", + "match": "\\b(append|popend|merge)\\b(?=\\()", "name": "support.function.builtin.coco" } ] @@ -206,7 +206,7 @@ { "comment": "Action Keywords", "name": "keyword.action.coco", - "match": "\\b(observe|transfer|polorize|depolorize)\\b" + "match": "\\b(observe|transfer)\\b" }, { "comment": "Exception Handling", @@ -236,7 +236,12 @@ { "comment": "Crypto Builtins", "name": "keyword.builtins.coco", - "match": "\\b(Blake2b|Keccak256|Sha256)\\b" + "match": "\\b(blake2b|keccak256|sha256|sigverify)\\b" + }, + { + "comment": "Serial Builtins", + "name": "keyword.builtins.coco", + "match": "\\b(polorize|depolorize)\\b" }, { "comment": "Special Methods", From 06aeba2d5ee2a4dc600185c43cdd764797ab46a5 Mon Sep 17 00:00:00 2001 From: Sarthak Shastri Date: Wed, 9 Aug 2023 01:00:45 +0530 Subject: [PATCH 7/8] Inclusivity Opertator - '?' inclusivity operator added --- syntaxes/coco.tmLanguage.json | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/syntaxes/coco.tmLanguage.json b/syntaxes/coco.tmLanguage.json index a2e07e7..a20bdca 100644 --- a/syntaxes/coco.tmLanguage.json +++ b/syntaxes/coco.tmLanguage.json @@ -39,7 +39,7 @@ "include": "#methods" }, { - "include": "#mutate" + "include": "#state_access" }, { "include": "#operators" @@ -272,14 +272,14 @@ } ] }, - "mutate": { + "state_access": { "patterns": [ { - "comment": "Open/Closed Mutate Statement", - "match": "\\b(mutate)\\b|(<-|->)\\s*|([A-Za-z_][A-Za-z0-9_]*)\\.(State|Sender|Receiver)\\s*", + "comment": "Open/Closed State Access Statement", + "match": "\\b(mutate|observe)\\b|(<-|->)\\s*|([A-Za-z_][A-Za-z0-9_]*)\\.(State|Sender|Receiver)\\s*", "captures": { "1": { - "name": "keyword.mutate.coco" + "name": "keyword.state.coco" }, "2": { "name": "keyword.operator.assignment.coco" @@ -325,6 +325,11 @@ "comment": "Logical Operators", "match": "(&&|\\|\\||!)", "name": "keyword.operator.logical.coco" + }, + { + "comment": "Inclusivity Operator", + "match": "\\?(?=(?:[^'\"]|\"[^\"]*\"|'[^']*')*$)", + "name": "keyword.operator.inclusivity.coco" } ] }, From 8a0819f9629a27e8888ae07bae97a64efcb81a4f Mon Sep 17 00:00:00 2001 From: Sarthak Shastri Date: Wed, 9 Aug 2023 12:27:11 +0530 Subject: [PATCH 8/8] Required Changes --- syntaxes/coco.tmLanguage.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntaxes/coco.tmLanguage.json b/syntaxes/coco.tmLanguage.json index a20bdca..3f23735 100644 --- a/syntaxes/coco.tmLanguage.json +++ b/syntaxes/coco.tmLanguage.json @@ -230,7 +230,7 @@ }, { "comment": "State Keyword", - "name": "keyword.state.coco", + "name": "keyword.state.accessor.coco", "match": "\\b(state)\\b" }, {