diff options
-rw-r--r-- | plugins/language_julia.lua | 38 |
1 files changed, 27 insertions, 11 deletions
diff --git a/plugins/language_julia.lua b/plugins/language_julia.lua index 65bc1ce..6dea1a8 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,29 @@ syntax.add { files = { "%.jl$" }, comment = "#", patterns = { - { pattern = { "#=", "=#" }, type = "comment" }, + { pattern = { "#=", "=#" }, type = "comment" }, { pattern = "#.-\n", type = "comment" }, - { pattern = { '"', '"', '\\' }, type = "string" }, - { pattern = { "`", "`", '\\' }, type = "string" }, + { pattern = '[%a_][%w_]*"""*[%a_][%w_]*"""', type = "function" }, + { pattern = { '[ruU]?"', '"', '\\' }, type = "string" }, + { pattern = { "[ruU]?'", "'", '\\' }, type = "string" }, { 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 = "[%+%-=/%*%^%%<>!~|&%:]", type = "operator" }, + { pattern = "[%a_][%w_]*%f[(]", type = "function" }, + { pattern = "@[%a_][%w_]*[%a_][%w_]", type = "function" }, + { pattern = "[%a_][%w_]*%.*!", type = "keyword2" }, + { pattern = "{[%a_][%w_]*}", type = "string" }, + { 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,20 +48,25 @@ syntax.add { ["function"] = "keyword", ["global"] = "keyword", ["if"] = "keyword", + ["in"] = "keyword", ["import"] = "keyword", ["let"] = "keyword", ["local"] = "keyword", ["macro"] = "keyword", ["module"] = "keyword", + ["mutable"] = "keyword", ["quote"] = "keyword", ["return"] = "keyword", ["try"] = "keyword", ["typeof"] = "keyword", ["using"] = "keyword", ["while"] = "keyword", - + ["where"] = "keyword", + -- types ["struct"] = "keyword2", + ["abstract type"] = "keyword2", + ["primitive type"] = "keyword2", ["mutable struct"] = "keyword2", ["Char"] = "keyword2", ["Bool"] = "keyword2", @@ -77,10 +86,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", + } } |