aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam <adamdharrison@gmail.com>2021-11-23 23:36:39 -0500
committerGitHub <noreply@github.com>2021-11-23 23:36:39 -0500
commitc75f20b1eeac107bfbe3ba38f515cdf0c445dc61 (patch)
tree8318cc94bcc196769cd2280b3ec435e9ba25afbf
parent3e7571030df2404873c8320ff976fb3fb41448c9 (diff)
parentbf3c9f44882ef14b2f5c0cf7355f2377a208638e (diff)
downloadlite-xl-plugins-c75f20b1eeac107bfbe3ba38f515cdf0c445dc61.tar.gz
lite-xl-plugins-c75f20b1eeac107bfbe3ba38f515cdf0c445dc61.zip
Merge pull request #94 from JobinsJC/dev
Add syntax highlighting for Julia
-rw-r--r--README.md1
-rw-r--r--plugins/language_julia.lua86
-rw-r--r--plugins/language_rust.lua1
3 files changed, 88 insertions, 0 deletions
diff --git a/README.md b/README.md
index 1f5f35f..a49c21c 100644
--- a/README.md
+++ b/README.md
@@ -68,6 +68,7 @@ Plugin | Description
[`language_java`](plugins/language_java.lua?raw=1) | Syntax for the [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) programming language
[`language_jiyu`](plugins/language_jiyu.lua?raw=1) | Syntax for the [jiyu](https://github.com/machinamentum/jiyu) programming language
[`language_jsx`](plugins/language_jsx.lua?raw=1) | Syntax for the [JSX](https://reactjs.org/docs/introducing-jsx.html) language for the React framework in JavaScript
+[`language_julia`](plugins/language_julia.lua?raw=1) | Syntax for the [Julia](https://julialang.org/) programming language
[`language_ksy`](https://raw.githubusercontent.com/whiteh0le/lite-plugins/main/plugins/language_ksy.lua?raw=1) | Syntax for [Kaitai](http://kaitai.io/) struct files
[`language_liquid`](plugins/language_liquid.lua?raw=1) | Syntax for [Liquid](https://shopify.github.io/liquid/) templating language
[`language_lobster`](plugins/language_lobster.lua?raw=1) | Syntax for [Lobster](https://strlen.com/lobster/) programming language
diff --git a/plugins/language_julia.lua b/plugins/language_julia.lua
new file mode 100644
index 0000000..65bc1ce
--- /dev/null
+++ b/plugins/language_julia.lua
@@ -0,0 +1,86 @@
+-- mod-version:2 -- lite-xl 2.0
+-- Support for the Julia programming language:
+-- Covers the most used keywords up to Julia version 1.6.4
+
+local syntax = require "core.syntax"
+
+syntax.add {
+ name = "Julia",
+ files = { "%.jl$" },
+ comment = "#",
+ patterns = {
+ { pattern = { "#=", "=#" }, type = "comment" },
+ { pattern = "#.-\n", type = "comment" },
+ { pattern = { '"', '"', '\\' }, type = "string" },
+ { pattern = { "`", "`", '\\' }, type = "string" },
+ { pattern = "0[oO_][0-7]+", type = "number" },
+ { pattern = "-?0x[%x_]+", type = "number" },
+ { pattern = "-?%d+_%d", type = "number" },
+ { pattern = "-?%d+[%d%.eE]*f?", type = "number" },
+ { pattern = "-?%.?%d+f?", type = "number" },
+ { pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" },
+ { pattern = "[%a_][%w_]*%f[(]", type = "function" },
+ { pattern = "[%a_][%w_]*", type = "symbol" },
+ },
+ symbols = {
+ -- keywords
+ ["abstract type"] = "keyword",
+ ["baremodule"] = "keyword",
+ ["begin"] = "keyword",
+ ["break`"] = "keyword",
+ ["catch"] = "keyword",
+ ["const"] = "keyword",
+ ["continue"] = "keyword",
+ ["do"] = "keyword",
+ ["Dict"] = "keyword",
+ ["Set"] = "keyword",
+ ["Union"] = "keyword",
+ ["else"] = "keyword",
+ ["elseif"] = "keyword",
+ ["end"] = "keyword",
+ ["export"] = "keyword",
+ ["finally"] = "keyword",
+ ["for"] = "keyword",
+ ["function"] = "keyword",
+ ["global"] = "keyword",
+ ["if"] = "keyword",
+ ["import"] = "keyword",
+ ["let"] = "keyword",
+ ["local"] = "keyword",
+ ["macro"] = "keyword",
+ ["module"] = "keyword",
+ ["quote"] = "keyword",
+ ["return"] = "keyword",
+ ["try"] = "keyword",
+ ["typeof"] = "keyword",
+ ["using"] = "keyword",
+ ["while"] = "keyword",
+
+ -- types
+ ["struct"] = "keyword2",
+ ["mutable struct"] = "keyword2",
+ ["Char"] = "keyword2",
+ ["Bool"] = "keyword2",
+ ["Int"] = "keyword2",
+ ["Int8"] = "keyword2",
+ ["UInt8"] = "keyword2",
+ ["Int16"] = "keyword2",
+ ["UInt16"] = "keyword2",
+ ["Int32"] = "keyword2",
+ ["UInt32"] = "keyword2",
+ ["Int64"] = "keyword2",
+ ["UInt64"] = "keyword2",
+ ["Int128"] = "keyword2",
+ ["UInt128"] = "keyword2",
+ ["Float16"] = "keyword2",
+ ["Float32"] = "keyword2",
+ ["Float64"] = "keyword2",
+ ["Vector"] = "keyword2",
+ ["Matrix"] = "keyword2",
+
+ -- literals
+ ["missing"] = "literal",
+ ["true"] = "literal",
+ ["false"] = "literal",
+ },
+}
diff --git a/plugins/language_rust.lua b/plugins/language_rust.lua
index 4c8b8ff..a8dc017 100644
--- a/plugins/language_rust.lua
+++ b/plugins/language_rust.lua
@@ -16,6 +16,7 @@ syntax.add {
{ pattern = "-?%d+[%d%.eE]*f?", type = "number" },
{ pattern = "-?%.?%d+f?", type = "number" },
{ pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" },
+ { pattern = "[%a_][%w_]*!%f[%[(]", type = "function" },
{ pattern = "[%a_][%w_]*%f[(]", type = "function" },
{ pattern = "[%a_][%w_]*", type = "symbol" },
},