aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlejandro Ramallo <alejandro@ramallo.me>2023-02-16 15:49:54 -0500
committerGitHub <noreply@github.com>2023-02-16 16:49:54 -0400
commitddb6d26402250b2798c7ee8bf22a92c36705808e (patch)
tree4636649de4b3df636e49947d0c854575a0678241
parentd957a57209ee4f62911b6278c054803ac5a1b9d6 (diff)
downloadlite-xl-plugins-ddb6d26402250b2798c7ee8bf22a92c36705808e.tar.gz
lite-xl-plugins-ddb6d26402250b2798c7ee8bf22a92c36705808e.zip
Added Haxe language support (#208)
-rw-r--r--manifest.json7
-rw-r--r--plugins/language_haxe.lua113
2 files changed, 120 insertions, 0 deletions
diff --git a/manifest.json b/manifest.json
index c3279d9..5285e4a 100644
--- a/manifest.json
+++ b/manifest.json
@@ -515,6 +515,13 @@
"mod_version": "3"
},
{
+ "description": "Syntax for the [Haxe](https://haxe.org) programming language",
+ "version": "0.1",
+ "path": "plugins/language_haxe.lua",
+ "id": "language_haxe",
+ "mod_version": "3"
+ },
+ {
"description": "Syntax for the [HLSL](https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl) programming language",
"version": "0.1",
"path": "plugins/language_hlsl.lua",
diff --git a/plugins/language_haxe.lua b/plugins/language_haxe.lua
new file mode 100644
index 0000000..0289d8d
--- /dev/null
+++ b/plugins/language_haxe.lua
@@ -0,0 +1,113 @@
+-- mod-version:3
+local syntax = require "core.syntax"
+
+syntax.add {
+ name = "Haxe Compiler Arguments",
+ files = "%.hxml$",
+ comment = "#",
+ patterns = {
+ { pattern = "#.*", type = "comment"},
+ { pattern = "%-[%-%w_]*", type="keyword"},
+ { pattern = "%.()%u[%w_]*", type = {"normal", "keyword2"}},
+ },
+ symbols = {}
+}
+
+syntax.add {
+ name = "Haxe String Interpolation",
+ files = "%.hx__string_interp$",
+ patterns = {
+ { pattern = {"%${", "}", "\\"}, type="keyword", syntax = ".hx" },
+ { pattern = {"%$", "%s", "\\"}, type="keyword", syntax = ".hx" },
+ { pattern = "[^ ]", type = "string"}
+ },
+ symbols = {}
+}
+
+syntax.add {
+ name = "Haxe Regular Expressions",
+ files = "%.hx__regex$",
+ patterns = {
+ { pattern = "[%[%]%(%)]", type = "string" },
+ { pattern = "[%.%*%+%?%^%$%|%-]", type = "operator" },
+ },
+ symbols = {}
+}
+
+syntax.add {
+ name = "Haxe",
+ files = "%.hx$",
+ comment = "//",
+ patterns = {
+ { pattern = {"%~%/", "%/[igmsu]*"}, type = "keyword2", syntax = ".hx__regex" },
+ { pattern = "%.%.%.", type = "operator" },
+ { pattern = "%<()%u[%w_]*()%>*", type = {"operator", "keyword2", "operator"}},
+ { pattern = "%#%s*[%a_]*().*\n", type = {"keyword", "normal"} },
+ { pattern = "import%s+()%u[%w]*", type = {"keyword", "keyword2"}},
+ { pattern = "import%s+()[%w%.]*%.()%u[%w]*", type = {"keyword", "normal", "keyword2"}},
+ { pattern = "abstract%s+()%u[%w_]*%s*%(()%s*%u[%w_]*", type = {"keyword2", "normal", "keyword2"} },
+ { pattern = "from%s+()%u[%w_]*%s+()to%s+()%u[%w_]*", type = {"keyword", "keyword2", "keyword", "keyword2"}},
+ { pattern = "//.*\n", type = "comment" },
+ { pattern = { "/%*", "%*/" }, type = "comment" },
+ { pattern = { '"', '"', '\\' }, type = "string" },
+ { pattern = { "'", "'", "\\" }, type = "string", syntax = ".hx__string_interp"},
+ { pattern = "-?%.?%d+", type = "number" },
+ { pattern = "-?0x%x+", type = "number" },
+ { pattern = "-?%d+%.[%deE]+", type = "number" },
+ { pattern = "-?%d+[%deE]+", type = "number" },
+ { pattern = "[%+%-%.=/%*%^%%<>!~|&]", type = "operator" },
+ { pattern = "[%a_][%w_]*()%s*%f[(]", type = {"function", "normal"} },
+ { pattern = "[%a_][%w_]*", type = "symbol" },
+ { pattern = ":()%u[%a_][%w_]*", type = {"normal", "keyword2"}},
+ { pattern = "@:[%a_][%w_]*%f[(]", type = "keyword" },
+ { pattern = "%$type", type = "keyword" },
+ },
+ symbols = {
+ ["abstract"] = "keyword2",
+ ["extends"] = "keyword2",
+ ["typedef"] = "keyword2",
+ ["implements"] = "keyword2",
+ ["import"] = "keyword",
+ ["package"] = "keyword",
+ ["using"] = "keyword2",
+ ["macro"] = "keyword2",
+ ["class"] = "keyword",
+ ["function"] = "keyword2",
+ ["var"] = "keyword2",
+ ["extern"] = "keyword2",
+ ["in"] = "keyword",
+ ["cast"] = "keyword",
+ ["get"] = "keyword",
+ ["set"] = "keyword",
+ ["never"] = "keyword",
+ ["inline"] = "keyword",
+ ["trace"] = "keyword",
+ ["final"] = "keyword",
+ ["break"] = "keyword",
+ ["case"] = "keyword",
+ ["catch"] = "keyword",
+ ["continue"] = "keyword",
+ ["default"] = "keyword",
+ ["do"] = "keyword",
+ ["else"] = "keyword",
+ ["enum"] = "keyword",
+ ["for"] = "keyword",
+ ["if"] = "keyword",
+ ["interface"] = "keyword",
+ ["new"] = "keyword",
+ ["override"] = "keyword",
+ ["private"] = "keyword",
+ ["public"] = "keyword",
+ ["return"] = "keyword",
+ ["static"] = "keyword",
+ ["switch"] = "keyword",
+ ["this"] = "keyword",
+ ["throw"] = "keyword",
+ ["try"] = "keyword",
+ ["while"] = "keyword",
+ ["true"] = "literal",
+ ["false"] = "literal",
+ ["null"] = "literal",
+ },
+}
+