aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Stigsen <benstigsen@posteo.net>2023-03-21 15:26:51 +0100
committerGitHub <noreply@github.com>2023-03-21 15:26:51 +0100
commit04472993f7808d2df2fd500ceabb3127b36663db (patch)
treed71e7689bd11a967a438ee5f693089db61fde4db
parent4a5aaef3114a141d86eb0751671b72dd1dd69b4c (diff)
downloadlite-xl-plugins-04472993f7808d2df2fd500ceabb3127b36663db.tar.gz
lite-xl-plugins-04472993f7808d2df2fd500ceabb3127b36663db.zip
Language support for Blade (#228)
* Create language_blade.lua Adds support for the Blade programming language. https://github.com/blade-lang/blade * Update README.md * Change pattern match Co-authored-by: Guldoman <giulio.lettieri@gmail.com> * Update manifest.json --------- Co-authored-by: Guldoman <giulio.lettieri@gmail.com>
-rw-r--r--README.md1
-rw-r--r--language_blade.lua57
-rw-r--r--manifest.json7
3 files changed, 65 insertions, 0 deletions
diff --git a/README.md b/README.md
index 6fa3df1..ff6bb3f 100644
--- a/README.md
+++ b/README.md
@@ -91,6 +91,7 @@ but only with a `url` must provide a `checksum` that matches the existing plugin
| [`language_autohotkey_v1`](plugins/language_autohotkey_v1.lua?raw=1) | Syntax for the [AutoHotkey](https://www.autohotkey.com)(v1) programming language |
| [`language_batch`](plugins/language_batch.lua?raw=1) | Syntax for Windows [Batch Files](https://en.wikipedia.org/wiki/Batch_file) |
| [`language_bib`](plugins/language_bib.lua?raw=1) | Syntax for [BibTex](https://en.wikipedia.org/wiki/BibTeX) files |
+| [`language_blade`](plugins/language_blade.lua?raw=1) | Syntax for [Blade](https://github.com/blade-lang/blade) files |
| [`language_caddyfile`](plugins/language_caddyfile.lua?raw=1) | Syntax for the Caddyfile used on the [Caddy](https://caddyserver.com/) web server |
| [`language_cmake`](plugins/language_cmake.lua?raw=1) | Syntax for the CMake build system language |
| [`language_containerfile`](https://github.com/FilBot3/lite-xl-language-containerfile)\* | Syntax for [Containerfile](https://github.com/containers/common/blob/main/docs/Containerfile.5.md)/[Dockerfile](https://docs.docker.com/engine/reference/builder/) |
diff --git a/language_blade.lua b/language_blade.lua
new file mode 100644
index 0000000..0b82387
--- /dev/null
+++ b/language_blade.lua
@@ -0,0 +1,57 @@
+-- mod-version:3
+local syntax = require "core.syntax"
+
+syntax.add {
+ name = "Blade",
+ files = { "%.b$" },
+ comment = "#",
+ patterns = {
+ { pattern = "#.*", type = "comment" },
+ { pattern = { "/%*", "%*/" }, type = "comment" },
+ { pattern = { '"', '"', '\\' }, type = "string" },
+ { pattern = { "'", "'", '\\' }, type = "string" },
+ { pattern = "%d+%.%d+", type = "number" },
+ { pattern = "0x%x+", type = "number" },
+ { pattern = "0c[0-8]+", type = "number" },
+ { pattern = "0c[01]+", type = "number" },
+ { pattern = "%d+", type = "number" },
+ { pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" },
+ { pattern = "[%a_][%w_]*%f[(]", type = "function" },
+ { pattern = "%a[%w_]+", type = "symbol" },
+ },
+ -- https://bladelang.com/tutorial/reserved.html#reserved-words
+ symbols = {
+ ["and"] = "keyword",
+ ["continue"] = "keyword",
+ ["else"] = "keyword",
+ ["in"] = "keyword",
+ ["self"] = "keyword2",
+ ["when"] = "keyword",
+ ["as"] = "keyword",
+ ["def"] = "keyword",
+ ["iter"] = "keyword",
+ ["static"] = "keyword",
+ ["while"] = "keyword",
+ ["assert"] = "keyword",
+ ["default"] = "keyword",
+ ["finally"] = "keyword",
+ ["break"] = "keyword",
+ ["die"] = "keyword",
+ ["for"] = "keyword",
+ ["or"] = "keyword",
+ ["try"] = "keyword",
+ ["catch"] = "keyword",
+ ["do"] = "keyword",
+ ["if"] = "keyword",
+ ["parent"] = "keyword",
+ ["using"] = "keyword",
+ ["class"] = "keyword",
+ ["echo"] = "function",
+ ["import"] = "keyword",
+ ["return"] = "keyword",
+ ["var"] = "keyword",
+ ["true"] = "literal",
+ ["false"] = "literal",
+ ["nil"] = "literal",
+ },
+}
diff --git a/manifest.json b/manifest.json
index f372b41..c85b195 100644
--- a/manifest.json
+++ b/manifest.json
@@ -382,6 +382,13 @@
"mod_version": "3"
},
{
+ "description": "Syntax for [Blade](https://github.com/blade-lang/blade/) files",
+ "version": "0.1",
+ "path": "plugins/language_blade.lua",
+ "id": "language_blade",
+ "mod_version": "3"
+ },
+ {
"description": "Syntax for the Caddyfile used on the [Caddy](https://caddyserver.com/) web server",
"version": "0.1",
"path": "plugins/language_caddyfile.lua",