aboutsummaryrefslogtreecommitdiff
path: root/plugins/language_julia.lua
diff options
context:
space:
mode:
authorAdam <adamdharrison@gmail.com>2021-12-05 14:40:55 -0500
committerGitHub <noreply@github.com>2021-12-05 14:40:55 -0500
commit4a72fc9bec2ea5755326bfb4ba945ba8c20c29e1 (patch)
treed89ca433fa4fcdc607d2c9fb74cbcae227662b0f /plugins/language_julia.lua
parentfe80d07579a6ba5e0972c7cde506785143984fb4 (diff)
parent9d91e39bf3711f14c5badb300d4ba8a4c24117c0 (diff)
downloadlite-xl-plugins-4a72fc9bec2ea5755326bfb4ba945ba8c20c29e1.tar.gz
lite-xl-plugins-4a72fc9bec2ea5755326bfb4ba945ba8c20c29e1.zip
Merge pull request #96 from Nightwing13/dev
Updated Julia Syntax
Diffstat (limited to 'plugins/language_julia.lua')
-rw-r--r--plugins/language_julia.lua52
1 files changed, 39 insertions, 13 deletions
diff --git a/plugins/language_julia.lua b/plugins/language_julia.lua
index 65bc1ce..e62a9b2 100644
--- a/plugins/language_julia.lua
+++ b/plugins/language_julia.lua
@@ -1,5 +1,5 @@
-- mod-version:2 -- lite-xl 2.0
--- Support for the Julia programming language:
+-- Support for the Julia programming language:
-- Covers the most used keywords up to Julia version 1.6.4
local syntax = require "core.syntax"
@@ -9,25 +9,37 @@ syntax.add {
files = { "%.jl$" },
comment = "#",
patterns = {
- { pattern = { "#=", "=#" }, type = "comment" },
- { pattern = "#.-\n", type = "comment" },
- { pattern = { '"', '"', '\\' }, type = "string" },
- { pattern = { "`", "`", '\\' }, type = "string" },
+ {pattern = {"#=", "=#"}, type="comment" },
+ {pattern = "#.*$", type="comment" },
+ { pattern = { 'icxx"""', '"""' }, type = "string", syntax = ".cpp" },
+ { pattern = { 'cxx"""', '"""' }, type = "string", syntax = ".cpp" },
+ { pattern = { 'py"""', '"""' }, type = "string", syntax = ".py" },
+ { pattern = { 'js"""', '"""' }, type = "string", syntax = ".js" },
+ { pattern = { 'md"""', '"""' }, type = "string", syntax = ".md" },
+ { pattern = "%d%w*[%.-+*//]", type = "number" },
{ pattern = "0[oO_][0-7]+", type = "number" },
{ pattern = "-?0x[%x_]+", type = "number" },
+ { pattern = "-?0b[%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" },
+ { pattern = "[^%d%g]%:%a*", type = "function" },
+ { pattern = "[%+%-=/%*%^%%<>!~|&%:]",type = "operator"},
+ { pattern = '""".*"""', type = "string" },
+ { pattern = '".*"', type = "string" },
+ { pattern = '[bv]".*"', type = "string" },
+ { pattern = 'r".*$', type = "string" },
+ { pattern = "'\\.*'", type = "string" },
+ { pattern = "'.'", type = "string" },
+ { pattern = "[%a_][%w_]*%f[(]", type = "function" },
+ { pattern = "%g*!", type="function"},
+ { pattern = "[%a_][%w_]*", type = "symbol" },
},
symbols = {
-- keywords
- ["abstract type"] = "keyword",
["baremodule"] = "keyword",
["begin"] = "keyword",
- ["break`"] = "keyword",
+ ["break"] = "keyword",
["catch"] = "keyword",
["const"] = "keyword",
["continue"] = "keyword",
@@ -44,24 +56,31 @@ syntax.add {
["function"] = "keyword",
["global"] = "keyword",
["if"] = "keyword",
+ ["in"] = "keyword",
["import"] = "keyword",
["let"] = "keyword",
["local"] = "keyword",
["macro"] = "keyword",
+ ["type"] = "keyword",
["module"] = "keyword",
+ ["mutable"] = "keyword",
["quote"] = "keyword",
["return"] = "keyword",
["try"] = "keyword",
["typeof"] = "keyword",
["using"] = "keyword",
["while"] = "keyword",
-
+ ["where"] = "keyword",
+
-- types
["struct"] = "keyword2",
- ["mutable struct"] = "keyword2",
+ ["abstract"] = "keyword2",
+ ["primitive"] = "keyword2",
+ ["mutable"] = "keyword2",
["Char"] = "keyword2",
["Bool"] = "keyword2",
["Int"] = "keyword2",
+ ["Integer"] = "keyword2",
["Int8"] = "keyword2",
["UInt8"] = "keyword2",
["Int16"] = "keyword2",
@@ -77,10 +96,17 @@ syntax.add {
["Float64"] = "keyword2",
["Vector"] = "keyword2",
["Matrix"] = "keyword2",
+ ["Ref"] = "keyword2",
+ ["String"] = "keyword2",
+ ["Function"] = "keyword2",
+ ["Number"] = "keyword2",
-- literals
["missing"] = "literal",
["true"] = "literal",
["false"] = "literal",
- },
+ ["nothing"] = "literal",
+ ["Inf"] = "literal",
+ ["NaN"] = "literal",
+ }
}