aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrxi <rxi@users.noreply.github.com>2020-05-31 16:11:56 +0100
committerGitHub <noreply@github.com>2020-05-31 16:11:56 +0100
commit7f6e1bea6816ea7352d9a6f9d5683a0c8fde97b7 (patch)
treebae905109702b5f345f3b11dd736e2829452bb3d
parent28dcd2863440d9c00f259d4aa06ecc6cd1863288 (diff)
parent9335268ed1af3260c4c08b928bc7afc18c20893a (diff)
downloadlite-xl-plugins-7f6e1bea6816ea7352d9a6f9d5683a0c8fde97b7.tar.gz
lite-xl-plugins-7f6e1bea6816ea7352d9a6f9d5683a0c8fde97b7.zip
Merge pull request #48 from p0nce/d-language-support
Add syntax for D language
-rw-r--r--README.md1
-rw-r--r--plugins/language_d.lua135
2 files changed, 136 insertions, 0 deletions
diff --git a/README.md b/README.md
index 35f57f6..4435d82 100644
--- a/README.md
+++ b/README.md
@@ -32,6 +32,7 @@ Plugin | Description
[`language_batch`](plugins/language_batch.lua?raw=1) | Syntax for Windows [Batch Files](https://en.wikipedia.org/wiki/Batch_file)
[`language_cpp`](plugins/language_cpp.lua?raw=1) | Syntax for the [C++](https://isocpp.org/) programming language
[`language_csharp`](plugins/language_csharp.lua?raw=1) | Syntax for the [C#](http://csharp.net) programming language
+[`language_d`](plugins/language_d.lua?raw=1) | Syntax for the [D](https://dlang.org/) programming language
[`language_fe`](plugins/language_fe.lua?raw=1) | Syntax for the [fe](https://github.com/rxi/fe) programming language
[`language_fennel`](plugins/language_fennel.lua?raw=1) | Syntax for the [fennel](https://fennel-lang.org) programming language
[`language_gdscript`](plugins/language_gdscript.lua?raw=1) | Syntax for the [Godot Engine](https://godotengine.org/)'s GDScript scripting language
diff --git a/plugins/language_d.lua b/plugins/language_d.lua
new file mode 100644
index 0000000..4597943
--- /dev/null
+++ b/plugins/language_d.lua
@@ -0,0 +1,135 @@
+local syntax = require "core.syntax"
+
+syntax.add {
+ files = { "%.d$", "%.di$" },
+ comment = "//",
+ patterns = {
+ { pattern = "//.-\n", type = "comment" },
+ { pattern = { "/%*", "%*/" }, type = "comment" },
+ { pattern = { "/%+", "%+/" }, type = "comment" },
+ { pattern = { '`', '`', '\\' }, type = "string" },
+ { pattern = { '"', '"', '\\' }, type = "string" },
+ { pattern = { "'", "'", '\\' }, type = "string" },
+ { pattern = "-?0x%x+", type = "number" },
+ { pattern = "-?%d+[%d%.eE]*f?", type = "number" },
+ { pattern = "-?%.?%d+f?", type = "number" },
+ { pattern = "[%+%-=/%*%^%%<>!~|&%$]+", type = "operator" },
+ { pattern = "[%a_][%w_]*!", type = "function" }, -- highlight templates
+ { pattern = "[%a_][%w_]*", type = "symbol" },
+ { pattern = "@safe", type = "keyword" },
+ { pattern = "@trusted", type = "keyword" },
+ { pattern = "@nogc", type = "keyword" },
+ },
+ symbols = {
+ ["abstract"] = "keyword",
+ ["alias"] = "keyword",
+ ["align"] = "keyword",
+ ["asm"] = "keyword",
+ ["assert"] = "keyword",
+ ["auto"] = "keyword",
+ ["body"] = "keyword",
+ ["bool"] = "keyword2",
+ ["break"] = "keyword",
+ ["byte"] = "keyword2",
+ ["case"] = "keyword",
+ ["cast"] = "keyword",
+ ["catch"] = "keyword",
+ ["cdouble"] = "keyword2",
+ ["cent"] = "keyword2",
+ ["cfloat"] = "keyword2",
+ ["char"] = "keyword2",
+ ["class"] = "keyword",
+ ["const"] = "keyword",
+ ["continue"] = "keyword",
+ ["creal"] = "keyword2",
+ ["dchar"] = "keyword2",
+ ["debug"] = "keyword",
+ ["default"] = "keyword",
+ ["delegate"] = "keyword",
+ ["deprecated"] = "keyword",
+ ["do"] = "keyword",
+ ["double"] = "keyword2",
+ ["else"] = "keyword",
+ ["enum"] = "keyword",
+ ["export"] = "keyword",
+ ["extern"] = "keyword",
+ ["false"] = "literal",
+ ["final"] = "keyword",
+ ["finally"] = "keyword",
+ ["float"] = "keyword2",
+ ["for"] = "keyword",
+ ["foreach"] = "keyword",
+ ["foreach_reverse"] = "keyword",
+ ["function"] = "keyword",
+ ["goto"] = "keyword",
+ ["idouble"] = "keyword2",
+ ["if"] = "keyword",
+ ["ifloat"] = "keyword2",
+ ["immutable"] = "keyword",
+ ["import"] = "keyword",
+ ["in"] = "keyword",
+ ["inout"] = "keyword",
+ ["int"] = "keyword2",
+ ["interface"] = "keyword",
+ ["invariant"] = "keyword",
+ ["ireal"] = "keyword2",
+ ["is"] = "keyword",
+ ["lazy"] = "keyword",
+ ["long"] = "keyword2",
+ ["macro"] = "keyword",
+ ["mixin"] = "keyword",
+ ["module"] = "keyword",
+ ["new"] = "keyword",
+ ["nothrow"] = "keyword",
+ ["null"] = "literal",
+ ["out"] = "keyword",
+ ["override"] = "keyword",
+ ["package"] = "keyword",
+ ["pragma"] = "keyword",
+ ["private"] = "keyword",
+ ["protected"] = "keyword",
+ ["public"] = "keyword",
+ ["pure"] = "keyword",
+ ["real"] = "keyword2",
+ ["ref"] = "keyword",
+ ["return"] = "keyword",
+ ["scope"] = "keyword",
+ ["shared"] = "keyword",
+ ["short"] = "keyword2",
+ ["static"] = "keyword",
+ ["struct"] = "keyword",
+ ["super"] = "keyword",
+ ["switch"] = "keyword",
+ ["synchronized"] = "keyword",
+ ["template"] = "keyword",
+ ["this"] = "keyword",
+ ["throw"] = "keyword",
+ ["true"] = "literal",
+ ["try"] = "keyword",
+ ["typeid"] = "keyword",
+ ["typeof"] = "keyword",
+ ["ubyte"] = "keyword2",
+ ["ucent"] = "keyword2",
+ ["uint"] = "keyword2",
+ ["ulong"] = "keyword2",
+ ["union"] = "keyword",
+ ["unittest"] = "keyword",
+ ["ushort"] = "keyword2",
+ ["version"] = "keyword",
+ ["void"] = "keyword",
+ ["wchar"] = "keyword2",
+ ["while"] = "keyword",
+ ["with"] = "keyword",
+ ["__FILE__"] = "keyword",
+ ["__FILE_FULL_PATH__"] = "keyword",
+ ["__MODULE__"] = "keyword",
+ ["__LINE__"] = "keyword",
+ ["__FUNCTION__"] = "keyword",
+ ["__PRETTY_FUNCTION__"] = "keyword",
+ ["__gshared"] = "keyword",
+ ["__traits"] = "keyword",
+ ["__vector"] = "keyword",
+ ["__parameters"] = "keyword",
+ },
+}
+