From bc47b916104837450ea14a104f92912aba898657 Mon Sep 17 00:00:00 2001 From: Radu Potop Date: Thu, 2 May 2024 22:41:47 +0100 Subject: [PATCH 1/4] Added language_conf.lua --- plugins/language_conf.lua | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 plugins/language_conf.lua diff --git a/plugins/language_conf.lua b/plugins/language_conf.lua new file mode 100644 index 00000000..b949213a --- /dev/null +++ b/plugins/language_conf.lua @@ -0,0 +1,38 @@ +-- mod-version:3 + +local syntax = require "core.syntax" + +syntax.add { + name = "Conf", + files = { ".rclone.conf", ".gitconfig", "%.conf$" }, + comment = '#', + patterns = { + { pattern = ";.-\n", type = "comment" }, + { pattern = "#.-\n", type = "comment" }, + { pattern = { "%[", "%]" }, type = "keyword" }, + + { pattern = { '"""', '"""', '\\' }, type = "string" }, + { pattern = { '"', '"', '\\' }, type = "string" }, + { pattern = { "'''", "'''" }, type = "string" }, + { pattern = { "'", "'" }, type = "string" }, + { pattern = "[A-Za-z0-9_%.%-]+%s*%f[=]", type = "function" }, + { pattern = "%s+%-%-[A-Za-z0-9%-]+", type = "normal" }, + { pattern = "[a-z]+", type = "symbol" }, + { pattern = "HEAD+", type = "symbol" }, + }, + symbols = { + -- Git + ["true"] = "literal", + ["false"] = "literal", + ["auto"] = "literal", + ["HEAD"] = "literal", + ["main"] = "literal", + ["master"] = "literal", + ["origin"] = "literal", + ["remote"] = "literal", + ["local"] = "literal", + ["always"] = "literal", + ["format"] = "literal", + }, +} + From 8b42945d3c89e1daf7524133362ae2a8e713e342 Mon Sep 17 00:00:00 2001 From: Radu Potop Date: Thu, 2 May 2024 22:46:52 +0100 Subject: [PATCH 2/4] Updated manifest --- manifest.json | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/manifest.json b/manifest.json index b1863db8..c7eb1c35 100644 --- a/manifest.json +++ b/manifest.json @@ -76,6 +76,7 @@ "language_carbon": {}, "language_clojure": {}, "language_cmake": {}, + "language_conf": {}, "language_containerfile": {}, "language_crystal": {}, "language_csharp": {}, @@ -781,6 +782,16 @@ ], "version": "0.2" }, + { + "description": "Syntax for .gitconfig, .rclone.conf and other generic configuration files based on the INI format", + "id": "language_conf", + "mod_version": "3", + "path": "plugins/language_conf.lua", + "tags": [ + "language" + ], + "version": "0.2" + }, { "description": "Syntax for [Containerfile](https://github.com/containers/common/blob/main/docs/Containerfile.5.md)/[Dockerfile](https://docs.docker.com/engine/reference/builder/)", "id": "language_containerfile", From 53e810677caf48fac8eb2b84551dedc2f96ad8d1 Mon Sep 17 00:00:00 2001 From: Radu Potop Date: Thu, 2 May 2024 23:10:01 +0100 Subject: [PATCH 3/4] Updated language_conf.lua --- plugins/language_conf.lua | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/plugins/language_conf.lua b/plugins/language_conf.lua index b949213a..28c54ed9 100644 --- a/plugins/language_conf.lua +++ b/plugins/language_conf.lua @@ -4,7 +4,7 @@ local syntax = require "core.syntax" syntax.add { name = "Conf", - files = { ".rclone.conf", ".gitconfig", "%.conf$" }, + files = { ".gitconfig", ".rclone.conf", "%.conf$" }, comment = '#', patterns = { { pattern = ";.-\n", type = "comment" }, @@ -17,15 +17,23 @@ syntax.add { { pattern = { "'", "'" }, type = "string" }, { pattern = "[A-Za-z0-9_%.%-]+%s*%f[=]", type = "function" }, { pattern = "%s+%-%-[A-Za-z0-9%-]+", type = "normal" }, - { pattern = "[a-z]+", type = "symbol" }, - { pattern = "HEAD+", type = "symbol" }, + -- Git + { pattern = "HEAD", type = "literal" }, + -- Rclone AWS S3 canned ACLs + { pattern = "private", type="literal" }, + { pattern = "public%-read", type="literal" }, + { pattern = "public%-read%-write", type="literal" }, + { pattern = "aws%-exec%-read", type="literal" }, + { pattern = "authenticated%-read", type="literal" }, + { pattern = "bucket%-owner%-read", type="literal" }, + { pattern = "bucket%-owner%-full%-control", type="literal" }, + { pattern = "log%-delivery%-write", type="literal" }, }, symbols = { -- Git ["true"] = "literal", ["false"] = "literal", ["auto"] = "literal", - ["HEAD"] = "literal", ["main"] = "literal", ["master"] = "literal", ["origin"] = "literal", From 7fb721452cc66612476d3f66a456209a83ff7f6d Mon Sep 17 00:00:00 2001 From: Radu Potop Date: Sun, 5 May 2024 21:17:01 +0100 Subject: [PATCH 4/4] Apply suggestions from code review Co-authored-by: Guldoman --- plugins/language_conf.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/language_conf.lua b/plugins/language_conf.lua index 28c54ed9..5c0fd346 100644 --- a/plugins/language_conf.lua +++ b/plugins/language_conf.lua @@ -4,11 +4,11 @@ local syntax = require "core.syntax" syntax.add { name = "Conf", - files = { ".gitconfig", ".rclone.conf", "%.conf$" }, + files = { ".gitconfig$", ".rclone.conf$", "%.conf$" }, comment = '#', patterns = { - { pattern = ";.-\n", type = "comment" }, - { pattern = "#.-\n", type = "comment" }, + { pattern = ";.*", type = "comment" }, + { pattern = "#.*", type = "comment" }, { pattern = { "%[", "%]" }, type = "keyword" }, { pattern = { '"""', '"""', '\\' }, type = "string" },