Bundle curated community plugins (2.1.8-4)

Vendored from upstream, pinned by commit (see debian/extra/README.source):
- gitstatus, gitopen, fontconfig, open_ext, select_colorscheme,
  smoothcaret, nerdicons (font mapping patched to DATADIR, Ships the
  Symbols Nerd Font Mono TTF, SIL OFL 1.1)
- lite-xl-lsp (complete LSP client; idle until a language server is
  configured) plus the lite-xl-widgets library it requires
- 104 language syntax plugins (none duplicate the nine bundled in core)

settings GUI left out upstream is broken: it requires a
libraries.widget.fonts widget that does not exist in
lite-xl-widgets at any revision.

Co-developed-with: ZCode (Z.ai)
This commit is contained in:
2026-09-16 22:45:02 +02:00
parent a693cb645c
commit 3bae6fd448
161 changed files with 42843 additions and 0 deletions
+118
View File
@@ -0,0 +1,118 @@
-- mod-version:3
local subprocess = require "process"
local core = require "core"
local style = require "core.style"
local config = require "core.config"
local common = require "core.common"
config.plugins.fontconfig = common.merge({ prefix = "" }, config.plugins.fontconfig)
--[[
Example config (put it in user module):
```
local fontconfig = require "plugins.fontconfig"
fontconfig.use {
font = { name = 'sans', size = 13 * SCALE },
code_font = { name = 'monospace', size = 13 * SCALE },
}
```
if you want the fonts to load instantaneously on startup,
you can try your luck on fontconfig.use_blocking. I won't be responsible for
the slow startup time.
]]
local function resolve_font(spec)
local scan_rate = 1 / config.fps
local proc = subprocess.start({ config.plugins.fontconfig.prefix .. "fc-match", "-s", "-f", "%{file}\n", spec }, {
stdin = subprocess.REDIRECT_DISCARD,
stdout = subprocess.REDIRECT_PIPE,
stderr = subprocess.REDIRECT_STDOUT
})
local prev
local lines = {}
while true do
coroutine.yield(scan_rate)
local buf = proc:read_stdout()
if not buf then break end
local last_line_start = 1
for line, ln in string.gmatch(buf, "([^\n]-)\n()") do
last_line_start = ln
if prev then line = prev .. line end
table.insert(lines, line)
end
prev = last_line_start < #buf and string.sub(buf, last_line_start)
end
if prev then table.insert(lines, prev) end
if proc:returncode() ~= 0 or #lines < 1 then
error(string.format("Cannot find a font matching the given specs: %q", spec), 0)
end
return lines[1]
end
local M = {}
function M.load(font_name, font_size, font_opt)
local font_file = resolve_font(font_name)
return renderer.font.load(font_file, font_size, font_opt)
end
function M.load_blocking(font_name, font_size, font_opt)
local co = coroutine.create(function()
return M.load(font_name, font_size, font_opt)
end)
local result
while coroutine.status(co) ~= "dead" do
local ok, err = coroutine.resume(co)
if not ok then error(err) end
result = err
end
return result
end
function M.load_group_blocking(group, font_size, font_opt)
local fonts = {}
for i in ipairs(group) do
local co = coroutine.create(function()
return M.load(group[i], font_size, font_opt)
end)
local result
while coroutine.status(co) ~= "dead" do
local ok, err = coroutine.resume(co)
if not ok then error(err) end
result = err
end
table.insert(fonts, result)
end
return renderer.font.group(fonts)
end
function M.use(spec)
core.add_thread(function()
for key, value in pairs(spec) do
style[key] = M.load(value.name, value.size, value)
end
end)
end
-- there is basically no need for this, but for the sake of completeness
-- I'll leave this here
function M.use_blocking(spec)
for key, value in pairs(spec) do
local font
if value.group then
font = M.load_group_blocking(value.group, value.size, value)
else
font = M.load_blocking(value.name, value.size, value)
end
style[key] = font
end
end
return M
+51
View File
@@ -0,0 +1,51 @@
-- mod-version:3
local core = require "core"
local command = require "core.command"
local common = require "core.common"
local config = require "core.config"
local function exec(cmd)
local proc = process.start(cmd)
while proc:running() do
coroutine.yield(0.1)
end
if proc:returncode() > 0 then
core.error("ERROR - command: " .. table.concat(cmd, " "))
end
return proc:read_stdout() or ""
end
local function git_find_files_and_open(commit)
local git_root = exec({"git", "rev-parse", "--show-toplevel"}):match("^%s*(.-)%s*$")
local file_list_str = exec({"git", "show", "--name-only", "--pretty=format:", commit})
for str in string.gmatch(file_list_str, "([^\n]+)") do
-- Nomalize path as Git for Windows uses / as Unix based systems
local filename = common.normalize_path(git_root .. PATHSEP .. str)
-- Only open files within the commit whose names do not match the configured ignore file patterns
if not common.match_pattern(common.basename(filename), config.ignore_files) then
core.root_view:open_doc(core.open_doc(filename))
end
end
end
-- works in any context
command.add(nil, {
["gitopen:open-from-commit"] = function(dv)
core.command_view:enter("Which commit? (default=HEAD)", {
submit = function(commit)
if commit == nil or commit == "" then
commit = "HEAD"
end
-- open the files in the background, return immediately
core.add_thread(
function ()
git_find_files_and_open(commit)
end
)
end
})
end,
})
+155
View File
@@ -0,0 +1,155 @@
-- mod-version:3
local core = require "core"
local common = require "core.common"
local config = require "core.config"
local style = require "core.style"
local StatusView = require "core.statusview"
local TreeView = require "plugins.treeview"
config.plugins.gitstatus = common.merge({
color_icons = true,
recurse_submodules = true,
-- The config specification used by the settings gui
config_spec = {
name = "Git Status",
{
label = "Colorize icons",
description = "Colorize the icons as well",
path = "color_icons",
type = "toggle",
default = true
},
{
label = "Recurse Submodules",
description = "Also retrieve git stats from submodules.",
path = "recurse_submodules",
type = "toggle",
default = true
}
}
}, config.plugins.gitstatus)
style.gitstatus_addition = {common.color "#587c0c"}
style.gitstatus_modification = {common.color "#0c7d9d"}
style.gitstatus_deletion = {common.color "#94151b"}
local scan_rate = config.project_scan_rate or 5
local cached_color_for_item = {}
-- Override TreeView's get_item_text to add modification color
local treeview_get_item_text = TreeView.get_item_text
function TreeView:get_item_text(item, active, hovered)
local text, font, color = treeview_get_item_text(self, item, active, hovered)
if cached_color_for_item[item.abs_filename] then
color = cached_color_for_item[item.abs_filename]
end
return text, font, color
end
-- Override TreeView's get_item_icon to add modification color
local treeview_get_item_icon = TreeView.get_item_icon
function TreeView:get_item_icon(item, active, hovered)
local character, font, color = treeview_get_item_icon(self, item, active, hovered)
if config.plugins.gitstatus and config.plugins.gitstatus.color_icons and cached_color_for_item[item.abs_filename] then
color = cached_color_for_item[item.abs_filename]
end
return character, font, color
end
local git = {
branch = nil,
inserts = 0,
deletes = 0,
}
local function exec(cmd)
local proc = process.start(cmd)
-- Don't use proc:wait() here - that will freeze the app.
-- Instead, rely on the fact that this is only called within
-- a coroutine, and yield for a fraction of a second, allowing
-- other stuff to happen while we wait for the process to complete.
while proc:running() do
coroutine.yield(0.1)
end
return proc:read_stdout() or ""
end
core.add_thread(function()
while true do
if system.get_file_info(".git") then
-- get branch name
git.branch = exec({"git", "rev-parse", "--abbrev-ref", "HEAD"}):match("[^\n]*")
local inserts = 0
local deletes = 0
-- get diff
local diff = exec({"git", "diff", "--numstat"})
if
config.plugins.gitstatus.recurse_submodules
and
system.get_file_info(".gitmodules")
then
local diff2 = exec({"git", "submodule", "foreach", "git diff --numstat"})
diff = diff .. diff2
end
-- forget the old state
cached_color_for_item = {}
local folder = core.project_dir
for line in string.gmatch(diff, "[^\n]+") do
local submodule = line:match("^Entering '(.+)'$")
if submodule then
folder = core.project_dir .. PATHSEP .. submodule
else
local ins, dels, path = line:match("(%d+)%s+(%d+)%s+(.+)")
if path then
inserts = inserts + (tonumber(ins) or 0)
deletes = deletes + (tonumber(dels) or 0)
local abs_path = folder .. PATHSEP .. path
-- Color this file, and each parent folder,
-- so you can see at a glance which folders
-- have modified files in them.
while abs_path do
cached_color_for_item[abs_path] = style.gitstatus_modification
abs_path = common.dirname(abs_path)
end
end
end
end
git.inserts = inserts
git.deletes = deletes
else
git.branch = nil
end
coroutine.yield(scan_rate)
end
end)
core.status_view:add_item({
name = "status:git",
alignment = StatusView.Item.RIGHT,
get_item = function()
if not git.branch then
return {}
end
return {
(git.inserts ~= 0 or git.deletes ~= 0) and style.accent or style.text,
git.branch,
style.dim, " ",
git.inserts ~= 0 and style.accent or style.text, "+", git.inserts,
style.dim, " / ",
git.deletes ~= 0 and style.accent or style.text, "-", git.deletes,
}
end,
position = -1,
tooltip = "branch and changes",
separator = core.status_view.separator2
})
+39
View File
@@ -0,0 +1,39 @@
-- mod-version:3
local syntax = require "core.syntax"
syntax.add{
name = "R",
files = {"%.r$", "%.rds$", "%.rda$", "%.rdata$", "%.R$"},
comment = "#",
patterns = {
{pattern = {"#", "\n"}, type = "comment"},
{pattern = {'"', '"'}, type = "string"},
{pattern = {"'", "'"}, type = "string"},
{pattern = "[%a_][%w_]*%f[(]", type = "function"},
{pattern = "[%a_][%w_]*", type = "symbol"},
{pattern = "[%+%-=/%*%^%%<>!|&]", type = "operator"},
{pattern = "0x[%da-fA-F]+", type = "number"},
{pattern = "-?%d+[%d%.eE]*", type = "number"},
{pattern = "-?%.?%d+", type = "number"},
},
symbols = {
["TRUE"] = "literal",
["FALSE"] = "literal",
["NA"] = "literal",
["NULL"] = "literal",
["Inf"] = "literal",
["if"] = "keyword",
["else"] = "keyword",
["while"] = "keyword",
["function"] = "keyword",
["break"] = "keyword",
["next"] = "keyword",
["repeat"] = "keyword",
["in"] = "keyword",
["for"] = "keyword",
["NA_integer"] = "keyword",
["NA_complex"] = "keyword",
["NA_character"] = "keyword",
["NA_real"] = "keyword"
}
}
+88
View File
@@ -0,0 +1,88 @@
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "AngelScript",
files = { "%.as$", "%.asc$" },
comment = "//",
patterns = {
{ pattern = "//.-\n", type = "comment" },
{ pattern = { "/%*", "%*/" }, type = "comment" },
{ pattern = { "#", "[^\\]\n" }, type = "comment" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = "-?0[xX]%x+", type = "number" },
{ pattern = "-?0[bB][0-1]+", type = "number" },
{ pattern = "-?0[oO][0-7]+", type = "number" },
{ pattern = "-?%d+[%d%.eE]*f?", type = "number" },
{ pattern = "-?%.?%d+f?", type = "number" },
{ pattern = "&inout", type = "keyword" },
{ pattern = "&in", type = "keyword" },
{ pattern = "&out", type = "keyword" },
{ pattern = "[%a_][%w_]*@", type = "keyword2" },
{ pattern = "[%-%+!~@%?:&|%^<>%*/=%%]", type = "operator" },
{ pattern = "[%a_][%w_]*%f[(]", type = "function" },
{ pattern = "[%a_][%w_]*", type = "symbol" },
},
symbols = {
-- Common
["shared"] = "keyword",
["external"] = "keyword",
["private"] = "keyword",
["protected"] = "keyword",
["const"] = "keyword",
["final"] = "keyword",
["abstract"] = "keyword",
["class"] = "keyword",
["typedef"] = "keyword",
["namespace"] = "keyword",
["interface"] = "keyword",
["import"] = "keyword",
["enum"] = "keyword",
["funcdef"] = "keyword",
["get"] = "keyword",
["set"] = "keyword",
["mixin"] = "keyword",
["void"] = "keyword2",
["int"] = "keyword2",
["int8"] = "keyword2",
["int16"] = "keyword2",
["int32"] = "keyword2",
["int64"] = "keyword2",
["uint"] = "keyword2",
["uint8"] = "keyword2",
["uint16"] = "keyword2",
["uint32"] = "keyword2",
["uint64"] = "keyword2",
["float"] = "keyword2",
["double"] = "keyword2",
["bool"] = "keyword2",
["auto"] = "keyword",
["override"] = "keyword",
["explicit"] = "keyword",
["property"] = "keyword",
["break"] = "keyword",
["continue"] = "keyword",
["return"] = "keyword",
["switch"] = "keyword",
["case"] = "keyword",
["default"] = "keyword",
["for"] = "keyword",
["while"] = "keyword",
["do"] = "keyword",
["if"] = "keyword",
["else"] = "keyword",
["try"] = "keyword",
["catch"] = "keyword",
["cast"] = "keyword",
["function"] = "keyword",
["true"] = "literal",
["false"] = "literal",
["null"] = "literal",
["is"] = "operator",
["and"] = "operator",
["or"] = "operator",
["xor"] = "operator",
},
}
+538
View File
@@ -0,0 +1,538 @@
-- mod-version:3
-- Support for RISC-V assembly
-- Note: kinda conflicts with x86 asm, must uninstall it or use force-syntax plugin
-- https://github.com/cheyao
local syntax = require "core.syntax"
syntax.add {
name = "RISC-V Assembly",
files = { "%.asm$", "%.[sS]$" },
comment = "#",
patterns = {
{ pattern = "#.*\n", type = "comment" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = "0[bB][0-1]+%W", type = "number" },
{ pattern = "0[xX]%x+", type = "number" },
{ pattern = "%%+[%a_][%w_]*", type = "function" },
{ pattern = "[%a%._][%w%._]*:%W", type = "function" },
{ pattern = "[^%p%a]%-?%d[%d%.]*", type = "number" },
{ pattern = "[%+%-=/%*%^%%<>!~|&%$]", type = "operator" },
{ pattern = "[%a_][%w_]*", type = "symbol" },
{ pattern = "%.%a+", type = "normal" }
},
symbols = {
-- Integer Registers
["x0"] = "literal",
["x1"] = "literal",
["x2"] = "literal",
["x3"] = "literal",
["x4"] = "literal",
["x5"] = "literal",
["x6"] = "literal",
["x7"] = "literal",
["x8"] = "literal",
["x9"] = "literal",
["x10"] = "literal",
["x11"] = "literal",
["x12"] = "literal",
["x13"] = "literal",
["x14"] = "literal",
["x15"] = "literal",
["x16"] = "literal",
["x17"] = "literal",
["x18"] = "literal",
["x19"] = "literal",
["x20"] = "literal",
["x21"] = "literal",
["x22"] = "literal",
["x23"] = "literal",
["x24"] = "literal",
["x25"] = "literal",
["x26"] = "literal",
["x27"] = "literal",
["x28"] = "literal",
["x29"] = "literal",
["x30"] = "literal",
["x31"] = "literal",
["zero"] = "literal",
["ra"] = "literal",
["sp"] = "literal",
["gp"] = "literal",
["tp"] = "literal",
["t0"] = "literal",
["t1"] = "literal",
["t2"] = "literal",
["fp"] = "literal",
["s0"] = "literal",
["s1"] = "literal",
["a0"] = "literal",
["a1"] = "literal",
["a2"] = "literal",
["a3"] = "literal",
["a4"] = "literal",
["a5"] = "literal",
["a6"] = "literal",
["a7"] = "literal",
["s2"] = "literal",
["s3"] = "literal",
["s4"] = "literal",
["s5"] = "literal",
["s6"] = "literal",
["s7"] = "literal",
["s8"] = "literal",
["s9"] = "literal",
["s10"] = "literal",
["s11"] = "literal",
["t3"] = "literal",
["t4"] = "literal",
["t5"] = "literal",
["t6"] = "literal",
["pc"] = "literal",
-- Floating-point Registers
["f0"] = "literal",
["f1"] = "literal",
["f2"] = "literal",
["f3"] = "literal",
["f4"] = "literal",
["f5"] = "literal",
["f6"] = "literal",
["f7"] = "literal",
["f8"] = "literal",
["f9"] = "literal",
["f10"] = "literal",
["f11"] = "literal",
["f12"] = "literal",
["f13"] = "literal",
["f14"] = "literal",
["f15"] = "literal",
["f16"] = "literal",
["f17"] = "literal",
["f18"] = "literal",
["f19"] = "literal",
["f20"] = "literal",
["f21"] = "literal",
["f22"] = "literal",
["f23"] = "literal",
["f24"] = "literal",
["f25"] = "literal",
["f26"] = "literal",
["f27"] = "literal",
["f28"] = "literal",
["f29"] = "literal",
["f30"] = "literal",
["f31"] = "literal",
["ft0"] = "literal",
["ft1"] = "literal",
["ft2"] = "literal",
["ft3"] = "literal",
["ft4"] = "literal",
["ft5"] = "literal",
["ft6"] = "literal",
["ft7"] = "literal",
["fs0"] = "literal",
["fs1"] = "literal",
["fa0"] = "literal",
["fa1"] = "literal",
["fa2"] = "literal",
["fa3"] = "literal",
["fa4"] = "literal",
["fa5"] = "literal",
["fa6"] = "literal",
["fa7"] = "literal",
["fa2"] = "literal",
["fa3"] = "literal",
["fa4"] = "literal",
["fa5"] = "literal",
["fa6"] = "literal",
["fa7"] = "literal",
["fa8"] = "literal",
["fa9"] = "literal",
["fa10"] = "literal",
["fa11"] = "literal",
["ft8"] = "literal",
["ft9"] = "literal",
["ft10"] = "literal",
["ft11"] = "literal",
-- Vector Registers
["v0"] = "literal",
["v1"] = "literal",
["v2"] = "literal",
["v3"] = "literal",
["v4"] = "literal",
["v5"] = "literal",
["v6"] = "literal",
["v7"] = "literal",
["v8"] = "literal",
["v9"] = "literal",
["v10"] = "literal",
["v11"] = "literal",
["v12"] = "literal",
["v13"] = "literal",
["v14"] = "literal",
["v15"] = "literal",
["v16"] = "literal",
["v17"] = "literal",
["v18"] = "literal",
["v19"] = "literal",
["v20"] = "literal",
["v21"] = "literal",
["v22"] = "literal",
["v23"] = "literal",
["v24"] = "literal",
["v25"] = "literal",
["v26"] = "literal",
["v27"] = "literal",
["v28"] = "literal",
["v29"] = "literal",
["v30"] = "literal",
["v31"] = "literal",
["vl"] = "literal",
["vtype"] = "literal",
["vzrm"] = "literal",
["vxsat"] = "literal",
-- RV32I instructions
["lui"] = "keyword",
["auipc"] = "keyword",
["jal"] = "keyword",
["jalr"] = "keyword",
["beq"] = "keyword",
["bne"] = "keyword",
["blt"] = "keyword",
["bge"] = "keyword",
["bltu"] = "keyword",
["bgeu"] = "keyword",
["lb"] = "keyword",
["lh"] = "keyword",
["lw"] = "keyword",
["lbu"] = "keyword",
["lhu"] = "keyword",
["sb"] = "keyword",
["sh"] = "keyword",
["sw"] = "keyword",
["addi"] = "keyword",
["slti"] = "keyword",
["sltiu"] = "keyword",
["xori"] = "keyword",
["ori"] = "keyword",
["andi"] = "keyword",
["slli"] = "keyword",
["srli"] = "keyword",
["srai"] = "keyword",
["add"] = "keyword",
["sub"] = "keyword",
["sll"] = "keyword",
["slt"] = "keyword",
["sltu"] = "keyword",
["xor"] = "keyword",
["srl"] = "keyword",
["sra"] = "keyword",
["or"] = "keyword",
["and"] = "keyword",
["fence"] = "keyword",
["fence.tso"] = "keyword",
["pause"] = "keyword",
["ecall"] = "keyword",
["ebreak"] = "keyword",
-- RV64I instructions
["lwu"] = "keyword",
["ld"] = "keyword",
["sd"] = "keyword",
["slli"] = "keyword",
["srli"] = "keyword",
["srai"] = "keyword",
["addiw"] = "keyword",
["slliw"] = "keyword",
["srliw"] = "keyword",
["sraiw"] = "keyword",
["addw"] = "keyword",
["subw"] = "keyword",
["sllw"] = "keyword",
["srlw"] = "keyword",
["sraw"] = "keyword",
-- Zifencei instructions
["fence.i"] = "keyword",
-- Zicsr instructions
["csrrw"] = "keyword",
["csrrs"] = "keyword",
["csrrc"] = "keyword",
["csrrwi"] = "keyword",
["csrrsi"] = "keyword",
["csrrci"] = "keyword",
-- RV32M instructions
["mul"] = "keyword",
["mulh"] = "keyword",
["mulhsu"] = "keyword",
["mulhu"] = "keyword",
["div"] = "keyword",
["divu"] = "keyword",
["rem"] = "keyword",
["remu"] = "keyword",
-- RV64M instructions
["mulw"] = "keyword",
["divw"] = "keyword",
["divuw"] = "keyword",
["remw"] = "keyword",
["remuw"] = "keyword",
-- RV32A instructions
["lr.w"] = "keyword",
["sc.w"] = "keyword",
["amoswap.w"] = "keyword",
["amoadd.w"] = "keyword",
["amoxor.w"] = "keyword",
["amoand.w"] = "keyword",
["amoor.w"] = "keyword",
["amomin.w"] = "keyword",
["amomax.w"] = "keyword",
["amominu.w"] = "keyword",
["amomaxu.w"] = "keyword",
-- RV64A instructions
["lr.d"] = "keyword",
["sc.d"] = "keyword",
["amoswap.d"] = "keyword",
["amoadd.d"] = "keyword",
["amoxor.d"] = "keyword",
["amoand.d"] = "keyword",
["amoor.d"] = "keyword",
["amomin.d"] = "keyword",
["amomax.d"] = "keyword",
["amominu.d"] = "keyword",
["amomaxu.d"] = "keyword",
-- RV32F instructions
["flw"] = "keyword",
["fsw"] = "keyword",
["fmadd.s"] = "keyword",
["fmsub.s"] = "keyword",
["fnmsub.s"] = "keyword",
["fnmadd.s"] = "keyword",
["fadd.s"] = "keyword",
["fsub.s"] = "keyword",
["fmul.s"] = "keyword",
["fdiv.s"] = "keyword",
["fsqrt.s"] = "keyword",
["fsgnj.s"] = "keyword",
["fsgnjn.s"] = "keyword",
["fsgnjx.s"] = "keyword",
["fmin.s"] = "keyword",
["fmax.s"] = "keyword",
["fcvt.w.s"] = "keyword",
["fcvt.wu.s"] = "keyword",
["fmv.x.w"] = "keyword",
["feq.s"] = "keyword",
["flt.s"] = "keyword",
["fle.s"] = "keyword",
["fclass.s"] = "keyword",
["fcvt.s.w"] = "keyword",
["fcvt.s.wu"] = "keyword",
["fmv.w.x"] = "keyword",
-- RV64F instructions
["fcvt.l.s"] = "keyword",
["fcvt.lu.s"] = "keyword",
["fcvt.s.l"] = "keyword",
["fcvt.s.lu"] = "keyword",
-- RV32D instructions
["fld"] = "keyword",
["fsd"] = "keyword",
["fmadd.d"] = "keyword",
["fmsub.d"] = "keyword",
["fnmsub.d"] = "keyword",
["fnmadd.d"] = "keyword",
["fadd.d"] = "keyword",
["fsub.d"] = "keyword",
["fmul.d"] = "keyword",
["fdiv.d"] = "keyword",
["fsqrt.d"] = "keyword",
["fsgnj.d"] = "keyword",
["fsgnjn.d"] = "keyword",
["fsgnjx.d"] = "keyword",
["fmin.d"] = "keyword",
["fmax.d"] = "keyword",
["fcvt.s.d"] = "keyword",
["fcvt.d.s"] = "keyword",
["feq.d"] = "keyword",
["flt.d"] = "keyword",
["fle.d"] = "keyword",
["fclass.d"] = "keyword",
["fcvt.w.d"] = "keyword",
["fcvt.wu.d"] = "keyword",
["fcvt.d.w"] = "keyword",
["fcvt.d.wu"] = "keyword",
-- RV64D instructions
["fcvt.l.d"] = "keyword",
["fcvt.lu.d"] = "keyword",
["fmv.x.d"] = "keyword",
["fcvt.d.l"] = "keyword",
["fcvt.d.lu"] = "keyword",
["fmv.d.x"] = "keyword",
-- RV32Q instructions
["flq"] = "keyword",
["fsq"] = "keyword",
["fmadd.q"] = "keyword",
["fmsub.q"] = "keyword",
["fnmsub.q"] = "keyword",
["fnmadd.q"] = "keyword",
["fadd.q"] = "keyword",
["fsub.q"] = "keyword",
["fmul.q"] = "keyword",
["fdiv.q"] = "keyword",
["fsqrt.q"] = "keyword",
["fsgnj.q"] = "keyword",
["fsgnjn.q"] = "keyword",
["fsgnjx.q"] = "keyword",
["fmin.q"] = "keyword",
["fmax.q"] = "keyword",
["fcvt.s.q"] = "keyword",
["fcvt.q.s"] = "keyword",
["fcvt.d.q"] = "keyword",
["fcvt.q.d"] = "keyword",
["feq.q"] = "keyword",
["flt.q"] = "keyword",
["fle.q"] = "keyword",
["fclass.q"] = "keyword",
["fcvt.w.q"] = "keyword",
["fcvt.wu.q"] = "keyword",
["fcvt.q.w"] = "keyword",
["fcvt.q.wu"] = "keyword",
-- RV64Q instructions
["fcvt.l.q"] = "keyword",
["fcvt.lu.q"] = "keyword",
["fcvt.q.l"] = "keyword",
["fcvt.q.lu"] = "keyword",
-- RV32Zfh instructions
["flh"] = "keyword",
["fsh"] = "keyword",
["fmadd.h"] = "keyword",
["fmsub.h"] = "keyword",
["fnmsub.h"] = "keyword",
["fnmadd.h"] = "keyword",
["fadd.h"] = "keyword",
["fsub.h"] = "keyword",
["fmul.h"] = "keyword",
["fdiv.h"] = "keyword",
["fsqrt.h"] = "keyword",
["fsgnj.h"] = "keyword",
["fsgnjn.h"] = "keyword",
["fsgnjx.h"] = "keyword",
["fmin.h"] = "keyword",
["fmax.h"] = "keyword",
["fcvt.s.h"] = "keyword",
["fcvt.h.s"] = "keyword",
["fcvt.d.h"] = "keyword",
["fcvt.h.d"] = "keyword",
["fcvt.q.h"] = "keyword",
["fcvt.h.q"] = "keyword",
["feq.h"] = "keyword",
["flt.h"] = "keyword",
["fle.h"] = "keyword",
["fclass.h"] = "keyword",
["fcvt.w.h"] = "keyword",
["fcvt.wu.h"] = "keyword",
["fmv.x.h"] = "keyword",
["fcvt.h.w"] = "keyword",
["fcvt.h.wu"] = "keyword",
["fmv.h.x"] = "keyword",
-- RV64Zfh instructions
["fcvt.l.h"] = "keyword",
["fcvt.lu.h"] = "keyword",
["fcvt.h.l"] = "keyword",
["fcvt.h.lu"] = "keyword",
-- Pesudo-instructions
["nop"] = "keyword",
["li"] = "keyword",
["mv"] = "keyword",
["not"] = "keyword",
["neg"] = "keyword",
["negw"] = "keyword",
["sext.w"] = "keyword",
["seqz"] = "keyword",
["snez"] = "keyword",
["sltz"] = "keyword",
["sgtz"] = "keyword",
["fmv.s"] = "keyword",
["fabs.s"] = "keyword",
["fneg.s"] = "keyword",
["fmv.d"] = "keyword",
["fabs.d"] = "keyword",
["fneg.d"] = "keyword",
["beqz"] = "keyword",
["bnez"] = "keyword",
["blez"] = "keyword",
["bgez"] = "keyword",
["bltz"] = "keyword",
["bgtz"] = "keyword",
["bgt"] = "keyword",
["ble"] = "keyword",
["bgtu"] = "keyword",
["bleu"] = "keyword",
["j"] = "keyword",
["jr"] = "keyword",
["ret"] = "keyword",
["call"] = "keyword",
["tail"] = "keyword",
-- Other
[".2byte"] = "keyword2",
[".4byte"] = "keyword2",
[".8byte"] = "keyword2",
[".half"] = "keyword2",
[".word"] = "keyword2",
[".dword"] = "keyword2",
[".byte"] = "keyword2",
[".dtpreldword"] = "keyword2",
[".dtprelword"] = "keyword2",
[".sleb128"] = "keyword2",
[".uleb128"] = "keyword2",
[".asciz"] = "keyword2",
[".string"] = "keyword2",
[".incbin"] = "keyword2",
[".zero"] = "keyword2",
[".align"] = "keyword2",
[".balign"] = "keyword2",
[".p2align"] = "keyword2",
[".globl"] = "keyword2",
[".local"] = "keyword2",
[".equ"] = "keyword2",
[".text"] = "keyword2",
[".data"] = "keyword2",
[".rodata"] = "keyword2",
[".bss"] = "keyword2",
[".comm"] = "keyword2",
[".common"] = "keyword2",
[".section"] = "keyword2",
[".option"] = "keyword2",
[".macro"] = "keyword2",
[".endm"] = "keyword2",
[".file"] = "keyword2",
[".ident"] = "keyword2",
[".size"] = "keyword2",
[".type"] = "keyword2",
},
}
File diff suppressed because it is too large Load Diff
+155
View File
@@ -0,0 +1,155 @@
-- mod-version:3
local syntax = require "core.syntax"
-- AHK has case insensitive grammer
local variables = {
"A_AhkPath", "A_AhkVersion", "A_AppData", "A_AppDataCommon", "A_AutoTrim",
"A_BatchLines", "A_CaretX", "A_CaretY", "A_Computername", "A_ControlDelay",
"A_Cursor", "A_DD", "A_DDD", "A_DDDD", "A_DefaultMouseSpeed",
"A_Desktop", "A_Desktopcommon", "A_Detecthiddentext", "A_Detecthiddenwindows", "A_Endchar",
"A_EventInfo", "A_ExitReason", "A_FileEncoding", "A_FormatFloat", "A_FormatInteger",
"A_Gui", "A_GuiControl", "A_GuiControlEvent", "A_GuiEvent", "A_GuiHeight",
"A_GuiWidth", "A_GuiX", "A_GuiY", "A_Hour", "A_IconFile",
"A_IconHidden", "A_IconNumber", "A_IconTip", "A_Index", "A_IpAddress1",
"A_IpAddress2", "A_IpAddress3", "A_IpAddress4", "A_Is64bitOS", "A_IsAdmin",
"A_IsCompiled", "A_IsCritical", "A_IsPaused", "A_IsSuspended", "A_IsUnicode",
"A_KeyDelay", "A_Language", "A_LastError", "A_LineFile", "A_LineNumber",
"A_LoopField", "A_LoopFileAttrib", "A_LoopFileDir", "A_LoopFileExt", "A_LoopFileFullPath",
"A_LoopFileLongPath", "A_LoopFileName", "A_LoopFileShortName", "A_LoopFileShortPath", "A_LoopFileSize",
"A_LoopFileSizeKB", "A_LoopFileSizeMB", "A_LoopFileTimeAccessed", "A_LoopFileTimeCreated", "A_LoopFileTimeModified",
"A_LoopReadLine", "A_LoopRegKey", "A_LoopRegName", "A_LoopRegSubKey", "A_LoopRegTimeModified",
"A_LoopRegType", "A_MDay", "A_Min", "A_MM", "A_MMM",
"A_MMMM", "A_Mon", "A_MouseDelay", "A_MSec", "A_MyDocuments",
"A_Now", "A_NowUTC", "A_NumBatchLines", "A_OSType", "A_OSVersion",
"A_PriorHotkey", "A_PriorKey", "A_ProgramFiles", "A_Programs", "A_ProgramsCommon",
"A_PtrSize", "A_RegView", "A_ScreenDpi", "A_ScreenHeight", "A_ScreenWidth",
"A_ScriptDir", "A_ScriptFullPath", "A_ScriptHwnd", "A_ScriptName", "A_Sec",
"A_Space", "A_StartMenu", "A_StartMenuCommon", "A_StartUp", "A_StartUpCommon",
"A_StringCaseSense", "A_Tab", "A_Temp", "A_ThisFunc", "A_ThisHotkey",
"A_ThisLabel", "A_ThisMenu", "A_ThisMenuItem", "A_ThisMenuItemPos", "A_TickCount",
"A_TimeIdle", "A_TimeIdlePhysical", "A_TimeSincePriorHotkey", "A_TimeSinceThisHotkey", "A_TitleMatchMode",
"A_TitleMatchModeSpeed", "A_UserName", "A_WDay", "A_WinDelay", "A_WinDir",
"A_WorkingDir", "A_YDay", "A_Year", "A_YWeek", "A_YYYY",
"CipboardAll", "Clipboard", "ComSpec", "ErrorLevel", "False",
"ProgramFiles", "True",
}
local keywords = {
"Break", "ByRef", "Case", "Catch", "Class",
"Continue", "Else", "Else", "Exit", "ExitApp",
"Finally", "For", "Global", "Gosub", "Goto",
"If", "Local", "Loop", "OnExit", "Pause",
"Return", "Sleep", "static", "suspend", "Switch",
"Throw", "Try", "Until", "While",
}
local functions = {
"_NewEnum", "Abs", "ACos", "Array", "Asc",
"ASin", "ATan", "Ceil", "Chr", "ComObjActive",
"ComObjArray", "ComObjConnect", "ComObjCreate", "ComObject", "ComObjError",
"ComObjFlags", "ComObjGet", "ComObjQuery", "ComObjType", "ComObjValue",
"Cos", "DllCall", "Exception", "Exp", "FileExist",
"FileOpen", "Floor", "Format", "Func", "GetKeyName",
"GetKeySC", "GetKeyState", "GetKeyVK", "IL_Add", "IL_Create",
"IL_Destroy", "InStr", "IsByRef", "IsFunc", "IsLabel",
"IsObject", "Ln", "Log", "LTrim", "LV_Add",
"LV_Delete", "LV_DeleteCol", "LV_GetCount", "LV_GetNext", "LV_GetText",
"LV_Insert", "LV_InsertCol", "LV_Modify", "LV_ModifyCol", "LV_SetImageList",
"Mod", "NumGet", "NumPut", "ObjAddRef", "ObjClone",
"Object", "ObjGetAddress", "ObjGetCapacity", "ObjHasKey", "ObjInsert",
"ObjMaxIndex", "ObjMinIndex", "ObjNewEnum", "ObjRelease", "ObjRemove",
"ObjSetCapacity", "OnMessage", "RegExMatch", "RegExReplace", "RegisterCallback",
"Round", "RTrim", "SB_SetIcon", "SB_SetParts", "SB_SetText",
"Sin", "Sqrt", "StrGet", "StrLen", "StrPut",
"StrReplace", "StrSplit", "SubStr", "Tan", "Trim",
"TV_Add", "TV_Delete", "TV_Get", "TV_GetChild", "TV_GetCount",
"TV_GetNext", "TV_GetParent", "TV_GetPrev", "TV_GetSelection", "TV_GetText",
"TV_Modify", "TV_SetImageList", "VarSetCapacity", "WinActive", "WinExist",
}
local commands = {
"AutoTrim", "BlockInput", "Click", "ClipWait", "Control",
"ControlClick", "ControlFocus", "ControlGet", "ControlGetFocus", "ControlGetPos",
"ControlGetText", "ControlMove", "ControlSend", "ControlSendRaw", "ControlSetText",
"CoordMode", "Critical", "DetectHiddenText", "DetectHiddenWindows", "Drive",
"DriveGet", "DriveSpaceFree", "Edit", "EnvAdd", "EnvGet",
"EnvSet", "EnvSub", "EnvUpdate", "FileAppend", "FileCopy",
"FileCopyDir", "FileCreateDir", "FileCreateShortcut", "FileDelete", "FileEncoding",
"FileGetAttrib", "FileGetShortcut", "FileGetSize", "FileGetTime", "FileGetVersion",
"FileInstall", "FileMove", "FileMoveDir", "FileRead", "FileReadLine",
"FileRecycle", "FileRecycleEmpty", "FileRemoveDir", "FileSelectFile", "FileSelectFolder",
"FileSetAttrib", "FileSetTime", "FormatTime", "GroupActivate", "GroupAdd",
"GroupClose", "GroupDeactivate", "Gui", "GuiControl", "GuiControlGet",
"Hotkey", "ImageSearch", "IniDelete", "IniRead", "IniWrite",
"Input", "InputBox", "KeyHistory", "KeyWait", "ListHotkeys",
"ListLines", "ListVars", "Menu", "MouseClick", "MouseClickDrag",
"MouseGetPos", "MouseMove", "MsgBox", "OutputDebug", "PixelGetColor",
"PixelSearch", "PostMessage", "Process", "Random", "RegDelete",
"RegRead", "RegWrite", "Reload", "Run", "RunAs",
"RunWait", "Send", "SendEvent", "SendInput", "SendLevel",
"SendMessage", "SendMode", "SendPlay", "SendRaw", "SetBatchLines",
"SetCapsLockState", "SetControlDelay", "SetDefaultMouseSpeed", "SetEnv", "SetKeyDelay",
"SetMouseDelay", "SetNumLockState", "SetRegView", "SetScrollLockState", "SetStoreCapsLockMode",
"SetTimer", "SetTitleMatchMode", "SetWinDelay", "SetWorkingDir", "Shutdown",
"Sort", "SoundBeep", "SoundGet", "SoundGetWaveVolume", "SoundPlay",
"SoundSet", "SoundSetWaveVolume", "Splitpath", "StatusBarGetText", "StatusBarWait",
"StringCaseSense", "StringLower", "StringUpper", "SysGet", "Thread",
"ToolTip", "Transform", "TrayTip", "UrlDownloadToFile", "WinActivate",
"WinActivateBottom", "WinClose", "WinGet", "WinGetActiveStats", "WinGetActiveTitle",
"WinGetClass", "WinGetPos", "WinGetText", "WinGetTitle", "WinHide",
"WinKill", "WinMaximize", "WinMenuSelectItem", "WinMinimize", "WinMinimizeAll",
"WinMinimizeAllUndo", "WinMove", "WinRestore", "WinSet", "WinSetTitle",
"WinShow", "WinWait", "WinWaitActive", "WinWaitClose", "WinWaitNotActive",
}
local symbols = {}
for _, elementVar in ipairs(variables) do
symbols[string.lower(elementVar)] = "operator" --a_year
symbols[string.upper(elementVar)] = "operator" --A_YEAR
symbols[string.format("%s%s", string.sub(elementVar, 1, 1), string.lower(string.sub(elementVar, 2)))] = "operator" --A_year
symbols[elementVar] = "operator" --A_Year
end
for _, elementKeyword in ipairs(keywords) do
symbols[string.lower(elementKeyword)] = "function" --byref
symbols[string.upper(elementKeyword)] = "function" --BYREF
symbols[string.format("%s%s", string.sub(elementKeyword, 1, 1), string.lower(string.sub(elementKeyword, 2)))] = "function" --Byref
symbols[elementKeyword] = "function" --ByRef
end
for _, elementFunction in ipairs(functions) do
symbols[string.lower(elementFunction)] = "keyword2" --lv_modifycol()
symbols[string.upper(elementFunction)] = "keyword2" --LV_MODIFYCOL()
symbols[string.format("%s%s", string.sub(elementFunction, 1, 1), string.lower(string.sub(elementFunction, 2)))] = "keyword2" --Lv_modifycol()
symbols[elementFunction] = "keyword2" --LV_ModifyCol()
end
for _, elementCommands in ipairs(commands) do
symbols[string.lower(elementCommands)] = "keyword" --fileencoding
symbols[string.upper(elementCommands)] = "keyword" --FILEENCODING
symbols[string.format("%s%s", string.sub(elementCommands, 1, 1), string.lower(string.sub(elementCommands, 2)))] = "keyword" --Fileencoding
symbols[elementCommands] = "keyword" --FileEncoding
end
syntax.add {
name = "AutoHotkey",
files = { "%.ahk$"},
comment = ";",
patterns = {
{ pattern = { ";", "\n" }, type = "comment" },
{ pattern = { "/%*", "*%/" }, type = "comment" },
{ pattern = { "[ruU]?%%", "[%% ]", '\\' }, type = "operator" },
{ pattern = { "[ruU]?%%", "[ ,]", '\\' }, type = "normal" },
{ pattern = { '[ruU]?"""', '"""'; '\\' }, type = "string" },
{ pattern = { '[ruU]?"', '"', '\\' }, type = "string" },
{ pattern = "0x[%da-fA-F]+", type = "number" },
{ pattern = "-?%d+[%d%.eE]*", type = "number" },
{ pattern = "-?%.?%d+", type = "number" },
{ pattern = "[%+%-=/%*%^<>!~|&]", type = "operator" },
{ pattern = ":=", type = "operator" },
{ pattern = ".=", type = "operator" },
{ pattern = "[%a_][%w_]*%f[(]", type = "function" },
{ pattern = "[%a_][%w_]*", type = "symbol" },
},
symbols = symbols,
}
+110
View File
@@ -0,0 +1,110 @@
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "Awk script",
files = "%.awk$",
headers = "^#!.*bin.*awk",
comment = "#",
patterns = {
-- $# is a awk special variable and the '#' shouldn't be interpreted
-- as a comment.
{ pattern = "%$[%a_@*#][%w_]*", type = "keyword2" },
-- Comments
{ pattern = "#.*", type = "comment" },
-- Strings
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = { '`', '`', '\\' }, type = "string" },
-- Ignore numbers that start with dots or slashes
{ pattern = "%f[%w_%.%/]%d[%d%.]*%f[^%w_%.]", type = "number" },
-- Operators
{ pattern = "[!<>|&%[%]:=*]", type = "operator" },
-- Match parameters
{ pattern = "%f[%S][%+%-][%w%-_:]+", type = "function" },
{ pattern = "%f[%S][%+%-][%w%-_]+%f[=]", type = "function" },
-- Prevent parameters with assignments from been matched as variables
{
pattern = "%s%-%a[%w_%-]*()%s+()%d[%d%.]+",
type = { "function", "normal", "number" }
},
{
pattern = "%s%-%a[%w_%-]*()%s+()%a[%a%-_:=]+",
type = { "function", "normal", "symbol" }
},
-- Match variable assignments
{ pattern = "[_%a][%w_]+%f[%+=]", type = "keyword2" },
-- Match variable expansions
{ pattern = "%${.-}", type = "keyword2" },
{ pattern = "%$[%d%$%a_@*][%w_]*", type = "keyword2" },
-- Functions
{ pattern = "[%a_%-][%w_%-]*()%s*%f[(]", type = { "function", "normal" } },
-- Everything else
{ pattern = "[%a_][%w_]*", type = "symbol" },
},
symbols = {
["break"] = "keyword",
["continue"] = "keyword",
["do"] = "keyword",
["delete"] = "keyword",
["else"] = "keyword",
["exit"] = "keyword",
["for"] = "keyword",
["function"] = "keyword",
["getline"] = "keyword",
["if"] = "keyword",
["next"] = "keyword",
["nextfile"] = "keyword",
["print"] = "keyword",
["printf"] = "keyword",
["return"] = "keyword",
["while"] = "keyword",
["gsub"] = "keyword",
["index"] = "keyword",
["length"] = "keyword",
["match"] = "keyword",
["split"] = "keyword",
["sprintf"] = "keyword",
["sub"] = "keyword",
["substr"] = "keyword",
["tolower"] = "keyword",
["toupper"] = "keyword",
["atan2"] = "keyword",
["cos"] = "keyword",
["exp"] = "keyword",
["int"] = "keyword",
["log"] = "keyword",
["rand"] = "keyword",
["sin"] = "keyword",
["sqrt"] = "keyword",
["srand"] = "keyword",
["BEGIN"] = "keyword",
["END"] = "keyword",
["ARGC"] = "keyword",
["ARGV"] = "keyword",
["FILENAME"] = "keyword",
["FNR"] = "keyword",
["FS"] = "keyword",
["NF"] = "keyword",
["NR"] = "keyword",
["OFMT"] = "keyword",
["OFS"] = "keyword",
["ORS"] = "keyword",
["RLENGTH"] = "keyword",
["RS"] = "keyword",
["RSTART"] = "keyword",
["SUBSEP"] = "keyword",
["ARGIND"] = "keyword",
["BINMODE"] = "keyword",
["CONVFMT"] = "keyword",
["ENVIRON"] = "keyword",
["ERRNO"] = "keyword",
["FIELDWIDTHS"] = "keyword",
["IGNORECASE"] = "keyword",
["LINT"] = "keyword",
["PROCINFO"] = "keyword",
["RT"] = "keyword",
["RLENGTH"] = "keyword",
["TEXTDOMAIN"] = "keyword"
}
}
+63
View File
@@ -0,0 +1,63 @@
-- mod-version:3
local syntax = require "core.syntax"
-- batch syntax for lite <liqube>
-- windows batch files use caseless matching for symbols
local symtable = {
["keyword"] = {
"if", "else", "not", "for", "do", "in",
"equ", "neq", "lss", "leq", "gtr", "geq", -- == != < <= > >=
"nul", "con", "prn", "prn", "lpt1", "com1", "com2", "com3", "com4",
"exist", "defined",
"errorlevel", "cmdextversion",
"goto", "call", "verify",
},
["function"] = {
"set", "setlocal", "endlocal", "enabledelayedexpansion",
"echo", "type",
"cd", "chdir",
"md", "mkdir",
"pause", "choice", "exit",
"del", "rd", "rmdir",
"copy", "xcopy",
"move", "ren",
"find", "findstr",
"sort", "shift", "attrib",
"cmd", "command",
"forfiles",
},
}
-- prepare a mixed symbol list
local function prepare_symbols(symtable)
local symbols = { }
for symtype, symlist in pairs(symtable) do
for _, symname in ipairs(symlist) do
symbols[symname:lower()] = symtype
symbols[symname:upper()] = symtype
end
end
return symbols
end
syntax.add {
name = "Batch",
files = { "%.bat$", "%.cmd$" },
comment = "rem",
patterns = {
{ pattern = "@echo off\n", type = "keyword" },
{ pattern = "@echo on\n", type = "keyword" },
{ pattern = "rem.-\n", type = "comment" }, -- rem comment line, rem, rem.
{ pattern = "REM.-\n", type = "comment" },
{ pattern = "%s*:[%w%-]+", type = "symbol" }, -- :labels
{ pattern = "%:%:.-\n", type = "comment" }, -- :: comment line
{ pattern = "%%%w+%%", type = "symbol" }, -- %variable%
{ pattern = "%%%%?~?[%w:]+", type = "symbol" }, -- %1, %~dpn1, %~1:2, %%i, %%~i
{ pattern = "[!=()%>&%^/\\@]", type = "operator" }, -- operators
{ pattern = "-?%.?%d+f?", type = "number" }, -- integer numbers
{ pattern = { '"', '"', '\\' }, type = "string" }, -- "strings"
{ pattern = "[%a_][%w_]*", type = "normal" },
{ pattern = ":eof", type = "keyword" }, -- not quite as intended, but ok for now
},
symbols = prepare_symbols(symtable),
}
+65
View File
@@ -0,0 +1,65 @@
-- Author: Rohan Vashisht https://github.com/RohanVashisht1234
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "Bend",
files = { "%.bend$" },
comment = "#",
patterns = {
{ pattern = "#.*", type = "comment" },
{ pattern = { '"', '"' }, type = "string" },
{ pattern = { "'", "'" }, type = "string" },
{ pattern = "[%a_][%w_]*%f[(]", type = "function" },
{ pattern = "[%a_][%w_]*", type = "symbol" },
{ pattern = "[%+%-=/%*%^%%<>!|&]", type = "operator" },
{ pattern = "def()%s+()[%a_][%w_]*", type = { "keyword", "normal", "literal" } }, -- tested ok
{ pattern = "data()%s+()[%a_][%w_]*", type = { "keyword", "normal", "literal" } }, -- tested ok
{ pattern = "let()%s+()[%a_][%w_]*", type = { "keyword", "normal", "literal" } }, -- tested ok
{ pattern = "Some()%s+()[%a_][%w_]*", type = { "keyword", "normal", "literal" } }, -- tested ok
{ pattern = "bend()%s+()[%a_][%w_]*", type = { "keyword", "normal", "literal" } }, -- tested ok
{ pattern = "object()%s+()[%a_][%w_]*", type = { "keyword", "normal", "literal" } }, -- tested ok
{ pattern = "fold()%s+()[%a_][%w_]*", type = { "keyword", "normal", "literal" } }, -- tested ok
{ pattern = "open()%s+()[%a_][%w_]*", type = { "keyword", "normal", "literal" } }, -- tested ok
{ pattern = "do()%s+()[%a_][%w_]*", type = { "keyword", "normal", "literal" } }, -- tested ok
{ pattern = "identity()%s+()[%a_][%w_]*", type = { "keyword", "normal", "literal" } }, -- tested ok
{ pattern = "lambda()%s+()[%a_][%w_]*", type = { "keyword", "normal", "literal" } }, -- tested ok
{ pattern = "0x[%da-fA-F]+", type = "number" },
{ pattern = "-?%d+[%d%.eE]*", type = "number" },
{ pattern = "-?%.?%d+", type = "number" },
},
symbols = {
["def"] = "keyword",
["switch"] = "keyword",
["case"] = "keyword",
["return"] = "keyword",
["if"] = "keyword",
["else"] = "keyword",
["when"] = "keyword",
["match"] = "keyword",
["λ"] = "keyword",
["Some"] = "keyword",
["data"] = "keyword",
["let"] = "keyword",
["use"] = "keyword",
["object"] = "keyword",
["fold"] = "keyword",
["open"] = "keyword",
["do"] = "keyword",
["bind"] = "keyword",
["Name"] = "keyword",
["identity"] = "keyword",
["Bool"] = "keyword",
["ask"] = "keyword",
["with"] = "keyword",
["bend"] = "keyword2",
["None"] = "keyword2",
["Nil"] = "keyword2",
["Result"] = "keyword2",
["type"] = "keyword2",
["true"] = "literal",
["false"] = "literal",
}
}
+23
View File
@@ -0,0 +1,23 @@
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "BibTeX",
files = { "%.bib$" },
comment = "%%",
patterns = {
{ pattern = {"%%", "\n"}, type = "comment" },
{ pattern = "@%a+", type = "keyword" },
{ pattern = "%a+%s=", type = "keyword2" },
},
symbols = {
["author"] = "keyword",
["doi"] = "keyword",
["issue"] = "keyword",
["journal"] = "keyword",
["month"] = "keyword",
["numpages"] = "keyword",
["pages"] = "keyword",
["publisher"] = "keyword",
}
}
+57
View File
@@ -0,0 +1,57 @@
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "Blade",
files = { "%.b$" },
comment = "#",
patterns = {
{ pattern = "#.*", type = "comment" },
{ pattern = { "/%*", "%*/" }, type = "comment" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = "%d+%.%d+", type = "number" },
{ pattern = "0x%x+", type = "number" },
{ pattern = "0c[0-8]+", type = "number" },
{ pattern = "0c[01]+", type = "number" },
{ pattern = "%d+", type = "number" },
{ pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" },
{ pattern = "[%a_][%w_]*%f[(]", type = "function" },
{ pattern = "%a[%w_]+", type = "symbol" },
},
-- https://bladelang.com/tutorial/reserved.html#reserved-words
symbols = {
["and"] = "keyword",
["continue"] = "keyword",
["else"] = "keyword",
["in"] = "keyword",
["self"] = "keyword2",
["when"] = "keyword",
["as"] = "keyword",
["def"] = "keyword",
["iter"] = "keyword",
["static"] = "keyword",
["while"] = "keyword",
["assert"] = "keyword",
["default"] = "keyword",
["finally"] = "keyword",
["break"] = "keyword",
["die"] = "keyword",
["for"] = "keyword",
["or"] = "keyword",
["try"] = "keyword",
["catch"] = "keyword",
["do"] = "keyword",
["if"] = "keyword",
["parent"] = "keyword",
["using"] = "keyword",
["class"] = "keyword",
["echo"] = "function",
["import"] = "keyword",
["return"] = "keyword",
["var"] = "keyword",
["true"] = "literal",
["false"] = "literal",
["nil"] = "literal",
},
}
+90
View File
@@ -0,0 +1,90 @@
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "Blueprint",
files = { "%.blp$", },
comment = "//",
block_comment = {"/*", "*/"},
patterns = {
-- Comments
{ pattern = "//.*", type = "comment" },
{ pattern = { "/%*", "%*/" }, type = "comment" },
-- Strings
{ pattern = { "'", "'", "\\"}, type = "string" },
{ pattern = { '"', '"', "\\" }, type = "string" },
-- Numbers
{ pattern = "%.?%d+", type = "number" },
-- Child type
{ pattern = "%[.*%]", type = "literal" },
-- Operators
{ pattern = "%$", type = "operator" },
{ pattern = "=>%s*%$().*()%(%)", type = { "operator", "function", "normal" } },
-- Properties
{ pattern = "[%w-_]+()%s*:", type = { "keyword", "normal" } },
-- Classes
{ pattern = "[%w_-%.]+%s*(){", type = { "keyword2", "normal"} },
{ pattern = "[%w_-%.]+%s*()[%w_-]+%s*{", type = { "keyword2", "normal"} },
-- Symbols
{ pattern = "[%w-_]+", type = "symbol" },
},
symbols = {
["true"] = "literal",
["false"] = "literal",
["null"] = "literal",
-- Import statements
["using"] = "keyword",
-- Keywords
["after"] = "keyword",
["bidirectional"] = "keyword",
["bind-property"] = "keyword",
["bind"] = "keyword",
["default"] = "keyword",
["destructive"] = "keyword",
["disabled"] = "keyword",
["inverted"] = "keyword",
["no-sync-create"] = "keyword",
["suggested"] = "keyword",
["swapped"] = "keyword",
["sync-create"] = "keyword",
["template"] = "keyword",
-- Menus
["menu"] = "keyword",
["submenu"] = "keyword",
["section"] = "keyword",
-- Nested blocks
["responses"] = "keyword2",
["items"] = "keyword2",
["mime-types"] = "keyword2",
["patterns"] = "keyword2",
["suffixes"] = "keyword2",
["marks"] = "keyword2",
["widgets"] = "keyword2",
["strings"] = "keyword2",
["styles"] = "keyword2",
["accessibility"] = "keyword2",
["setters"] = "keyword2",
["layout"] = "keyword2",
["item"] = "keyword2",
["condition"] = "keyword2",
["mark"] = "keyword2",
-- Translated strings
["_"] = "operator",
["C_"] = "operator",
}
}
+23
View File
@@ -0,0 +1,23 @@
-- Author: Rohan Vashisht: https://github.com/RohanVashisht1234/
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "Brainfuck", -- tested ok
files = {
"%.bf$", -- tested ok
},
patterns = {
{ pattern = '%[', type = 'operator' }, -- tested ok
{ pattern = '%]', type = 'operator' }, -- tested ok
{ pattern = '%-', type = 'keyword' }, -- tested ok
{ pattern = '<', type = 'keyword2' }, -- tested ok
{ pattern = '>', type = 'keyword2' }, -- tested ok
{ pattern = '+', type = 'string' }, -- tested ok
{ pattern = ',', type = 'literal' }, -- tested ok
{ pattern = '%.', type = 'string' }, -- tested ok
{ pattern = '[^%-%.<>%+,%[%]]+', type = 'comment' }, -- tested ok
},
symbols = {},
}
+76
View File
@@ -0,0 +1,76 @@
-- Author: Rohan Vashisht: https://github.com/rohanvashisht1234/
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "Buzz", -- tested ok
files = { "%.buzz$" }, -- tested ok
comment = "|", -- tested ok
patterns = {
{ pattern = { '"', '"', '\\' }, type = "string" }, -- tested ok
{ pattern = "|.*", type = "comment" }, -- tested ok
{ pattern = "[!%-/*?:=><]", type = "operator" }, -- tested ok
{ pattern = "[%a_][%w_]*%f[(]", type = "function" }, -- tested ok
{ pattern = "const()%s+()[%a_][%w_]*", type = { "keyword", "normal", "literal" } }, -- tested ok
{ pattern = "object()%s+()[%a_][%w_]*", type = { "keyword", "normal", "literal" } }, -- tested ok
{ pattern = "var()%s+()[%a_][%w_]*", type = { "keyword", "normal", "literal" } }, -- tested ok
{ pattern = "-?%d+[%d%.eE_]*", type = "number" }, -- tested ok
{ pattern = "-?%.?%d+", type = "number" }, -- tested ok
{ pattern = "[%a_][%w_]*", type = "normal" }, -- tested ok
},
symbols = {
["bool"] = "keyword", -- tested ok
["ud"] = "keyword", -- tested ok
["float"] = "keyword", -- tested ok
["zdef"] = "keyword", -- tested ok
["resolve"] = "keyword", -- tested ok
["yield"] = "keyword", -- tested ok
["resume"] = "keyword", -- tested ok
["export"] = "keyword", -- tested ok
["void"] = "keyword", -- tested ok
["protocol"] = "keyword", -- tested ok
["do"] = "keyword", -- tested ok
["enum"] = "keyword", -- tested ok
["test"] = "keyword", -- tested ok
["extern"] = "keyword", -- tested ok
["object"] = "keyword", -- tested ok
["foreach"] = "keyword", -- tested ok
["is"] = "keyword", -- tested ok
["return"] = "keyword", -- tested ok
["continue"] = "keyword", -- tested ok
["for"] = "keyword", -- tested ok
["lambda"] = "keyword", -- tested ok
["try"] = "keyword", -- tested ok
["fun"] = "keyword", -- tested ok
["type"] = "keyword", -- tested ok
["while"] = "keyword", -- tested ok
["and"] = "keyword", -- tested ok
["global"] = "keyword", -- tested ok
["not"] = "keyword2", -- tested ok
["any"] = "keyword", -- tested ok
["as"] = "keyword", -- tested ok
["if"] = "keyword", -- tested ok
["or"] = "keyword", -- tested ok
["else"] = "keyword", -- tested ok
["match"] = "keyword", -- tested ok
["pat"] = "keyword", -- tested ok
["import"] = "keyword", -- tested ok
["str"] = "keyword", -- tested ok
["var"] = "keyword", -- tested ok
["catch"] = "keyword", -- tested ok
["typeof"] = "keyword", -- tested ok
["int"] = "keyword", -- tested ok
["const"] = "keyword", -- tested ok
["namespace"] = "keyword", -- tested ok
["this"] = "keyword2", -- tested ok
["null"] = "literal", -- tested ok
["true"] = "literal", -- tested ok
["false"] = "literal", -- tested ok
["in"] = "literal", -- tested ok
["static"] = "keyword2", -- tested ok
["std"] = "keyword2", -- tested ok
["io"] = "keyword2", -- tested ok
}
}
+80
View File
@@ -0,0 +1,80 @@
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "cel7",
files = "%.c7$",
comment = ";",
patterns = {
{ pattern = ";.*", type = "comment" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = "0x4000", type = "literal" },
{ pattern = "0x4040", type = "literal" },
{ pattern = "0x52a0", type = "literal" },
{ pattern = "0x[%da-fA-F]+", type = "number" },
{ pattern = "-?%d+[%d%.]*", type = "number" },
{ pattern = "-?%.?%d+", type = "number" },
{ pattern = "'", type = "symbol" },
{ pattern = "=", type = "symbol" },
{ pattern = "<=?", type = "symbol" },
{ pattern = "[%+-%*/]", type = "symbol" },
{ pattern = "//", type = "keyword2" },
{ pattern = "%%", type = "keyword2" },
{ pattern = "%f[^(][^()'%s\"]+", type = "function" },
{ pattern = "[^()'%s\"]+", type = "symbol" },
},
symbols = {
["let"] = "keyword",
["="] = "operator",
["if"] = "keyword",
["fn"] = "keyword",
["mac"] = "keyword",
["while"] = "keyword",
["quote"] = "keyword",
["'"] = "keyword",
["and"] = "keyword",
["or"] = "keyword",
["do"] = "keyword",
["cons"] = "keyword",
["car"] = "keyword",
["cdr"] = "keyword",
["setcar"] = "keyword",
["setcdr"] = "keyword",
["list"] = "keyword",
["not"] = "keyword",
["is"] = "keyword",
["atom"] = "keyword",
["print"] = "keyword",
["<"] = "operator",
["<="] = "operator",
["="] = "operator",
["+"] = "operator",
["-"] = "operator",
["*"] = "operator",
["/"] = "operator",
["nil"] = "literal",
["t"] = "literal",
-- reserved variables (config)
["title"] = "keyword2",
["width"] = "keyword2",
["height"] = "keyword2",
["debug"] = "keyword2",
-- callbacks
["init"] = "keyword2",
["step"] = "keyword2",
["keydown"] = "keyword2",
["keyup"] = "keyword2",
-- built-in functions
["quit"] = "keyword2",
["rand"] = "keyword2",
["poke"] = "keyword2",
["peek"] = "keyword2",
["color"] = "keyword2",
["put"] = "keyword2",
["get"] = "keyword2",
["fill"] = "keyword2",
}
}
+104
View File
@@ -0,0 +1,104 @@
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
files = { PATHSEP .. "Caddyfile$" },
comment = "#",
patterns = {
{ pattern = "#.*", type = "comment" },
{ pattern = { '"', '"', '\\' }, type = "string" },
-- Matcher definition
{ pattern = "@[%w_]+", type = "operator" },
-- Snippet
{ pattern = "%(%g+%)", type = "operator" },
-- Properties
{ pattern = "^[%a_][%w_]*()%s+%f[%g]",
type = { "function", "normal" }
},
{ pattern = "^[%a_][%w_]*()%s+$",
type = { "function", "normal" }
},
{ pattern = "^%s*()[%a_][%w_]*()%s+$",
type = { "normal", "function", "normal" }
},
{ pattern = "^%s*()[%a_][%w_]*()%s+%f[%g]",
type = { "normal", "function", "normal" }
},
-- Environment variables
{ pattern = "{()%$[%w_]+():()[%w_]+()}",
type = { "operator", "keyword2", "operator", "keyword2", "operator" }
},
{ pattern = "{()%$[%w_]+()}",
type = { "operator", "keyword2", "operator" }
},
-- Place holder
{ pattern = "{%g-}", type = "keyword2" },
-- Operators
{ pattern = "[+%-,:]", type = "operator" },
-- IP Address
{ pattern = "%d+%.%d+%.%d+%.%d+", type = "literal" },
-- Path /path/subpath
{ pattern = "/[%w%./]+", type = "literal" },
-- Wildcard domain *.levels
{ pattern = "%*()[%w.]+",
type = { "operator", "literal" }
},
-- Match Operator
{ pattern = "%*+", type = "operator" },
-- Domain leve1.level2
{ pattern = "https?://[%w%./%*]+", type = "literal" },
-- Domain leve1.level2
{ pattern = "%w+%.[%w%.]+", type = "literal" },
-- Number
{ pattern = "%d+[mhskbi]*", type = "number" },
-- Everything else for symbols to work
{ pattern = "[%a_][%w_]*", type = "symbol" },
},
symbols = {
["true"] = "literal",
["false"] = "literal",
["localhost"] = "literal",
-- built-in directives
["abort"] = "keyword",
["acme_server"] = "keyword",
["basicauth"] = "keyword",
["bind"] = "keyword",
["encode"] = "keyword",
["error"] = "keyword",
["file_server"] = "keyword",
["forward_auth"] = "keyword",
["handle"] = "keyword",
["handle_errors"] = "keyword",
["handle_path"] = "keyword",
["header"] = "keyword",
["import"] = "keyword",
["log"] = "keyword",
["method"] = "keyword",
["map"] = "keyword",
["metrics"] = "keyword",
["php_fastcgi"] = "keyword",
["push"] = "keyword",
["redir"] = "keyword",
["request_body"] = "keyword",
["request_header"] = "keyword",
["respond"] = "keyword",
["reverse_proxy"] = "keyword",
["rewrite"] = "keyword",
["root"] = "keyword",
["route"] = "keyword",
["templates"] = "keyword",
["tls"] = "keyword",
["tracing"] = "keyword",
["try_files"] = "keyword",
["uri"] = "keyword",
["vars"] = "keyword",
-- Module directives
["cgi"] = "keyword",
["ssh"] = "keyword",
["exec"] = "keyword",
["supervisor"] = "keyword",
["layer4"] = "keyword",
},
}
+83
View File
@@ -0,0 +1,83 @@
-- Author: Rohan Vashisht: https://github.com/rohanvashisht1234/
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "Carbon", -- tested ok
files = {
"%.carbon$" -- tested ok
},
comment = "//", -- tested ok
patterns = {
{ pattern = { '"', '"', '\\' }, type = "string" }, -- tested ok
{ pattern = { '"""', '"""', '\\' }, type = "string" }, -- tested ok
{ pattern = { "'''", "'''", '\\' }, type = "string" }, -- tested ok
{ pattern = "//.*", type = "comment" }, -- tested ok
{ pattern = "[!%-/*?:=><+]", type = "operator" }, -- tested ok
{ pattern = "[%a_][%w_]*%f[(]", type = "function" }, -- tested ok
{ pattern = "packages()%s+()[%a_][%w_]*", type = { "keyword", "normal", "literal" } }, -- tested ok
{ pattern = "let()%s+()[%a_][%w_]*", type = { "keyword", "normal", "literal" } }, -- tested ok
{ pattern = "import()%s+()[%a_][%w_]*", type = { "keyword", "normal", "literal" } }, -- tested ok
{ pattern = "impl()%s+()[%a_][%w_]*", type = { "keyword", "normal", "literal" } }, -- tested ok
{ pattern = "class()%s+()[%a_][%w_]*", type = { "keyword", "normal", "literal" } }, -- tested ok
{ pattern = "var()%s+()[%a_][%w_]*", type = { "keyword", "normal", "literal" } }, -- tested ok
{ pattern = "package()%s+()[%a_][%w_]*", type = { "keyword", "normal", "literal" } }, -- tested ok
{ pattern = "-?%d+[%d%.eE_]*", type = "number" }, -- tested ok
{ pattern = "-?%.?%d+", type = "number" }, -- tested ok
{ pattern = "[%a_][%w_]*", type = "normal" }, -- tested ok
},
symbols = {
["package"] = "keyword", -- tested ok
["import"] = "keyword", -- tested ok
["fn"] = "keyword", -- tested ok
["var"] = "keyword", -- tested ok
["for"] = "keyword", -- tested ok
["return"] = "keyword", -- tested ok
["class"] = "keyword", -- tested ok
["api"] = "keyword", -- tested ok
["i8"] = "keyword", -- tested ok
["i16"] = "keyword", -- tested ok
["i32"] = "keyword", -- tested ok
["i64"] = "keyword", -- tested ok
["i128"] = "keyword", -- tested ok
["i256"] = "keyword", -- tested ok
["u8"] = "keyword", -- tested ok
["u16"] = "keyword", -- tested ok
["u32"] = "keyword", -- tested ok
["u64"] = "keyword", -- tested ok
["u128"] = "keyword", -- tested ok
["u256"] = "keyword", -- tested ok
["f8"] = "keyword", -- tested ok
["f16"] = "keyword", -- tested ok
["f32"] = "keyword", -- tested ok
["f64"] = "keyword", -- tested ok
["f128"] = "keyword", -- tested ok
["if"] = "keyword", -- tested ok
["else"] = "keyword", -- tested ok
["auto"] = "keyword", -- tested ok
["let"] = "keyword", -- tested ok
["File"] = "keyword", -- tested ok
["while"] = "keyword", -- tested ok
["match"] = "keyword", -- tested ok
["case"] = "keyword", -- tested ok
["default"] = "keyword", -- tested ok
["returned"] = "keyword", -- tested ok
["base"] = "keyword", -- tested ok
["bool"] = "keyword", -- tested ok
["virtual"] = "keyword", -- tested ok
["abstract"] = "keyword", -- tested ok
["String"] = "keyword", -- tested ok
["impl"] = "keyword2", -- tested ok
["extend"] = "keyword", -- tested ok
["partial"] = "keyword2", -- tested ok
["Self"] = "keyword", -- tested ok
["Int"] = "keyword", -- tested ok
["UInt"] = "keyword", -- tested ok
["Base"] = "keyword", -- tested ok
["template"] = "keyword2", -- tested ok
["true"] = "keyword2", -- tested ok
["false"] = "keyword2", -- tested ok
}
}
+56
View File
@@ -0,0 +1,56 @@
-- Author: Rohan Vashisht: https://github.com/RohanVashisht1234/
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "Clojure",
comment = ";;",
files = {
"%.clj$",
"%.cljs$",
"%.clc$",
"%.edn$",
},
patterns = {
{ pattern = ';;.*', type = 'comment' }, -- Single-line Comment
{ pattern = ';.*', type = 'comment' }, -- Single-line Comment
{ pattern = { '#"', '"', '\\' }, type = 'string' }, -- Multiline String
{ pattern = { '"', '"', '\\' }, type = 'string' }, -- Multiline String
{ pattern = { '"""', '"""', '\\' }, type = 'string' }, -- Multiline String
{ pattern = ':[%a_][%w_/%-]*', type = 'keyword2' }, -- word after ':' a.k.a (Var metadata)
{ pattern = '[%a_][%w_]*()%.()[%a_][%w_/%-]*', type = { 'keyword', 'operator', 'keyword2' } }, -- Things like something.something
{ pattern = "%(()def()%s+()[%a_][%w_%-]*", type = { "normal", "keyword", "literal", 'literal' } }, -- function definition
{ pattern = "%(()def[%a_][%w_]*()%s+()[%a_][%w_%-]*", type = { "normal", "keyword", "literal", 'literal' } }, -- function definition but with something along with def like: defn, defmacro etc.
{ pattern = '%(()require()%s+()[%a_][%w_]*', type = { 'normal', 'keyword', 'literal', 'literal' } }, -- highlight the word after require keyword
{ pattern = '%(()[%a_][%w_/]*', type = { 'normal', 'literal' } }, -- patterns that are like this: (my_function/subdir_1)
{ pattern = '-?0x%x+', type = 'number' }, -- Hexadecimal
{ pattern = '-?%d+[%d%.eE]*f?', type = 'number' }, -- Floating-point numbers
{ pattern = '-?%.?%d+f?', type = 'number' }, -- Floating-point numbers
{ pattern = '[!%#%$%%&*+./%<=>%?@\\%^|%-~:]', type = 'operator' }, -- Character classes
{ pattern = "[%a_'][%w_']*", type = 'normal' }, -- Normal
},
symbols = {
['def'] = 'keyword', -- tested ok
['defn'] = 'keyword', -- tested ok
['str'] = 'keyword', -- tested ok
['fn'] = 'keyword', -- tested ok
['println'] = 'keyword', -- tested ok
['if'] = 'keyword', -- tested ok
['cond'] = 'keyword', -- tested ok
['vector'] = 'keyword', -- tested ok
['apply'] = 'keyword', -- tested ok
['String'] = 'keyword', -- tested ok
['ns'] = 'keyword', -- tested ok
['try'] = 'keyword', -- tested ok
['let'] = 'keyword', -- tested ok
['get'] = 'keyword', -- tested ok
['catch'] = 'keyword', -- tested ok
['Retention'] = 'keyword', -- tested ok
['Deprecated'] = 'keyword', -- tested ok
['require'] = 'keyword2', -- tested ok
['true'] = 'keyword2', -- tested ok
['false'] = 'keyword2', -- tested ok
['nil'] = 'literal', -- tested ok
['int'] = 'literal', -- tested ok
},
}
+19
View File
@@ -0,0 +1,19 @@
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "CMake",
files = { "%.cmake$", PATHSEP .. "CMakeLists%.txt$" },
comment = "#",
block_comment = { "#[[", "]]" },
patterns = {
{ pattern = { '#%[=*%[', '%]=*%]' }, type = "comment" },
{ pattern = "#.*", type = "comment" },
{ pattern = { '%[=*%[', '%]=*%]' }, type = "string" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = "[%a_][%w_]*%f[(]", type = "function" },
{ pattern = "[%a_][%w_]*", type = "normal" },
{ pattern = "%${[%a_][%w_]*%}", type = "operator" },
},
symbols = {},
}
+122
View File
@@ -0,0 +1,122 @@
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "C#",
files = "%.cs$",
comment = "//",
patterns = {
{ pattern = "//.-\n", type = "comment" },
{ pattern = { "/%*", "%*/" }, type = "comment" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "[%$%@]?\"", '"', '\\' }, type = "string" }, -- string interpolation and verbatim
{ pattern = "'\\x%x?%x?%x?%x'", type = "string" }, -- character hexadecimal escape sequence
{ pattern = "'\\u%x%x%x%x'", type = "string" }, -- character unicode escape sequence
{ pattern = "'\\?.'", type = "string" }, -- character literal
{ pattern = "-?0x%x+", type = "number" },
{ pattern = "-?%d+[%d%.eE]*f?", type = "number" },
{ pattern = "-?%.?%d+f?", type = "number" },
{ pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" },
{ pattern = "%?%?", type = "operator" }, -- ?? null-coalescing
{ pattern = "%?%.", type = "operator" }, -- ?. null-conditional
{ pattern = "[%a_][%w_]*%f[(]", type = "function" },
{ pattern = "[%a_][%w_]*", type = "symbol" },
},
symbols = {
-- keywords and contextual keywords
["abstract"] = "keyword",
["as"] = "keyword",
["add"] = "keyword",
["await"] = "keyword",
["base"] = "keyword",
["break"] = "keyword",
["case"] = "keyword",
["catch"] = "keyword",
["checked"] = "keyword",
["class"] = "keyword",
["record"] = "keyword",
["const"] = "keyword",
["continue"] = "keyword",
["default"] = "keyword",
["delegate"] = "keyword",
["do"] = "keyword",
["else"] = "keyword",
["enum"] = "keyword",
["event"] = "keyword",
["explicit"] = "keyword",
["extern"] = "keyword",
["finally"] = "keyword",
["fixed"] = "keyword",
["for"] = "keyword",
["foreach"] = "keyword",
["get"] = "keyword",
["goto"] = "keyword",
["if"] = "keyword",
["implicit"] = "keyword",
["in"] = "keyword",
["interface"] = "keyword",
["internal"] = "keyword",
["is"] = "keyword",
["lock"] = "keyword",
["namespace"] = "keyword",
["new"] = "keyword",
["operator"] = "keyword",
["out"] = "keyword",
["override"] = "keyword",
["remove"] = "keyword",
["params"] = "keyword",
["partial"] = "keyword",
["private"] = "keyword",
["protected"] = "keyword",
["dynamic"] = "keyword",
["public"] = "keyword",
["readonly"] = "keyword",
["ref"] = "keyword",
["return"] = "keyword",
["sealed"] = "keyword",
["set"] = "keyword",
["sizeof"] = "keyword",
["stackalloc"] = "keyword",
["static"] = "keyword",
["struct"] = "keyword",
["switch"] = "keyword",
["this"] = "keyword",
["throw"] = "keyword",
["try"] = "keyword",
["typeof"] = "keyword",
["unchecked"] = "keyword",
["unsafe"] = "keyword",
["using"] = "keyword",
["var"] = "keyword",
["value"] = "keyword",
["global"] = "keyword",
["virtual"] = "keyword",
["void"] = "keyword",
["volatile"] = "keyword",
["where"] = "keyword",
["when"] = "keyword",
["while"] = "keyword",
["yield"] = "keyword",
-- types
["bool"] = "keyword2",
["byte"] = "keyword2",
["char"] = "keyword2",
["decimal"] = "keyword2",
["double"] = "keyword2",
["float"] = "keyword2",
["int"] = "keyword2",
["long"] = "keyword2",
["object"] = "keyword2",
["sbyte"] = "keyword2",
["short"] = "keyword2",
["string"] = "keyword2",
["uint"] = "keyword2",
["ulong"] = "keyword2",
["ushort"] = "keyword2",
-- literals
["true"] = "literal",
["false"] = "literal",
["null"] = "literal",
},
}
+41
View File
@@ -0,0 +1,41 @@
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "CUE",
files = "%.cue$",
comment = "//",
patterns = {
{ pattern = "//.*", type = "comment" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "`", "`", '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = "0[oO_][0-7]+i?", type = "number" },
{ pattern = "-?0x[%x_]+i?", type = "number" },
{ pattern = "-?%d+_%di?", type = "number" },
{ pattern = "-?%d+[%d%.eE]*f?i?", type = "number" },
{ pattern = "-?%.?%d+f?i?", type = "number" },
{ pattern = "[%a_][%w_]*%.", type = "literal" },
{ pattern = "[%a_][%w_]*", type = "symbol" },
{ pattern = "#[%a][%w_]*", type = "keyword2" },
-- operators
{ pattern = "[%+%-=/%*%^%%<>!~|&%?:%.]", type = "operator" },
},
symbols = {
["package"] = "keyword",
["import"] = "keyword",
["let"] = "keyword",
["for"] = "keyword",
["true"] = "literal",
["false"] = "literal",
["string"] = "keyword2",
["bool"] = "keyword2",
["number"] = "keyword2",
["uint32"] = "keyword2",
["int32"] = "keyword2",
["uint16"] = "keyword2",
["int16"] = "keyword2",
["uint8"] = "keyword2",
["float"] = "keyword2",
}
}
+135
View File
@@ -0,0 +1,135 @@
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "D",
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", "normal"} }, -- highlight templates
{ 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",
},
}
+64
View File
@@ -0,0 +1,64 @@
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "Dart",
files = { "%.dart$" },
comment = "//",
patterns = {
{ pattern = "//.-\n", type = "comment" },
{ pattern = "///.-\n", type = "comment" },
{ pattern = { "/%*", "%*/" }, type = "comment" },
{ 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 = "%?%?", type = "operator" },
{ pattern = "%?%.", type = "operator" },
{ pattern = { "[%$%@]?\"", '"', '\\' }, type = "string" },
{ pattern = "'\\x%x?%x?%x?%x'", type = "string" },
{ pattern = "[%a_][%w_]*%f[(]", type = "function" },
{ pattern = "[%a_][%w_]*", type = "symbol" },
},
symbols = {
["await"] = "keyword",
["bool"] = "keyword2",
["break"] = "keyword",
["case"] = "keyword",
["class"] = "keyword",
["const"] = "keyword",
["continue"] = "keyword",
["default"] = "keyword",
["do"] = "keyword",
["double"] = "keyword2",
["dynamic"] = "keyword2",
["else"] = "keyword",
["enum"] = "keyword",
["false"] = "literal",
["final"] = "keyword",
["finally"] = "keyword",
["for"] = "keyword",
["Function"] = "keyword2",
["if"] = "keyword",
["in"] = "keyword",
["int"] = "keyword2",
["List"] = "keyword2",
["Map"] = "keyword2",
["new"] = "keyword",
["null"] = "literal",
["part of"] = "keyword",
["print"] = "keyword",
["return"] = "keyword",
["static"] = "keyword",
["String"] = "keyword2",
["switch"] = "keyword",
["then"] = "keyword",
["this"] = "keyword2",
["true"] = "literal",
["void"] = "keyword",
["while"] = "keyword",
},
}
+70
View File
@@ -0,0 +1,70 @@
-- mod-version:3
local syntax = require "core.syntax"
local style = require "core.style"
local common = require "core.common"
-- we need these symbol types to have uniform colors
style.syntax["diff_add"] = { common.color "#72b886" }
style.syntax["diff_del"] = { common.color "#F36161" }
syntax.add {
name = "Diff",
files = { "%.diff$", "%.patch$", "%.rej$" },
headers = "^diff %-",
patterns = {
-- Method the patch was generated with and source/target files
{ regex = "^diff .+", type = "function" },
-- Seen for changing the file permissions
{ regex = "^new .+", type = "comment" },
-- Usually holds starting and ending commit
{ regex = "^index .+", type = "comment" },
-- Position to patch
{
pattern = "@@.-@@ ().+", --with heading
type = { "number", "string" }
},
{
regex = "^@@ [\\d,\\-\\+ ]+ @@\n", --wihtout heading
type = "number"
},
-- Other position to patch formats
{
regex = "^-{3} [\\d]+,[\\d]+ \\-{4}\n",
type = "number"
},
{
regex = "^\\*{3} [\\d]+,[\\d]+ \\*{4}\n",
type = "number"
},
-- Source and target file
{ regex = "^-{3} .+", type = "keyword" },
{ regex = "^\\+{3} .+", type = "keyword" },
-- Rarely used source file indicator
{ regex = "^\\*{3} .+", type = "keyword" },
-- git patches seem to add 3 dashes to separate message from changed files
{ regex = "^-{3}\n", type = "normal" },
-- Addition and deletion of lines
{ regex = "^-.*", type = "diff_del" },
{ regex = "^\\+.*", type = "diff_add" },
{ regex = "^<.*", type = "diff_del" },
{ regex = "^>.*", type = "diff_add" },
-- Change between two lines
{ regex = "^!.*", type = "number" },
-- Stuff usually found on a authored patch heading
{
pattern = "From ()[a-fA-F0-9]+ ().+",
type = { "keyword", "number", "string" }
},
{ regex = "^[a-zA-Z\\-]+: ", type = "keyword" },
-- Diff stats
{ regex = "^ [\\d]+ files? changed", type = "function" },
{ regex = "[\\d]+ insertions?\\(\\+\\)", type = "diff_add" },
{ regex = "[\\d]+ deletions?\\(\\-\\)", type = "diff_del" },
-- Match e-mail
{
pattern = ".*()<[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+%.[a-zA-Z0-9-.]+>",
type = {"string", "keyword2"}
},
},
symbols = {}
}
+645
View File
@@ -0,0 +1,645 @@
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "FreeFEM++",
files = {
"%.edp$", "%.ffp$"
},
comment = "//",
block_comment = { "/*", "*/" },
patterns = {
{ pattern = "//.*", type = "comment" },
{ pattern = { "/%*", "%*/" }, type = "comment" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = "0x%x+[%x']*", type = "number" },
{ pattern = "%d+[%d%.'eE]*f?", type = "number" },
{ pattern = "%.?%d+[%d']*f?", type = "number" },
{ pattern = "[%+%-=/%*%^%%<>!~|:&]", type = "operator" },
{ pattern = "##", type = "operator" },
{ pattern = "struct%s()[%a_][%w_]*", type = { "keyword", "keyword2" } },
{ pattern = "class%s()[%a_][%w_]*", type = { "keyword", "keyword2" } },
{ pattern = "union%s()[%a_][%w_]*", type = { "keyword", "keyword2" } },
{ pattern = "namespace%s()[%a_][%w_]*", type = { "keyword", "keyword2" } },
-- static declarations
{
pattern = "static()%s+()inline",
type = { "keyword", "normal", "keyword" }
},
{
pattern = "static()%s+()const",
type = { "keyword", "normal", "keyword" }
},
{
pattern = "static()%s+()[%a_][%w_]*",
type = { "keyword", "normal", "literal" }
},
-- match method type declarations
{
pattern = "[%a_][%w_]*()%s*()%**()%s*()[%a_][%w_]*()%s*()::",
type = {
"literal", "normal", "operator", "normal",
"literal", "normal", "operator"
}
},
-- match function type declarations
{
pattern = "[%a_][%w_]*()%*+()%s+()[%a_][%w_]*%f[%(]",
type = { "literal", "operator", "normal", "function" }
},
{
pattern = "[%a_][%w_]*()%s+()%*+()[%a_][%w_]*%f[%(]",
type = { "literal", "normal", "operator", "function" }
},
{
pattern = "[%a_][%w_]*()%s+()[%a_][%w_]*%f[%(]",
type = { "literal", "normal", "function" }
},
-- match variable type declarations
{
pattern = "[%a_][%w_]*()%*+()%s+()[%a_][%w_]*",
type = { "literal", "operator", "normal", "normal" }
},
{
pattern = "[%a_][%w_]*()%s+()%*+()[%a_][%w_]*",
type = { "literal", "normal", "operator", "normal" }
},
{
pattern = "[%a_][%w_]*()%s+()[%a_][%w_]*()%s*()[;,%[%)]",
type = { "literal", "normal", "normal", "normal", "normal" }
},
{
pattern = "[%a_][%w_]*()%s+()[%a_][%w_]*()%s*()=",
type = { "literal", "normal", "normal", "normal", "operator" }
},
{
pattern = "[%a_][%w_]*()&()%s+()[%a_][%w_]*",
type = { "literal", "operator", "normal", "normal" }
},
{
pattern = "[%a_][%w_]*()%s+()&()[%a_][%w_]*",
type = { "literal", "normal", "operator", "normal" }
},
-- Match scope operator element access
{
pattern = "[%a_][%w_]*()%s*()::",
type = { "literal", "normal", "operator" }
},
-- Uppercase constants of at least 2 chars in len
{
pattern = "_?%u[%u_][%u%d_]*%f[%s%+%*%-%.%)%]}%?%^%%=/<>~|&;:,!]",
type = "number"
},
-- Magic constants
{ pattern = "__[%u%l]+__", type = "number" },
-- all other functions
{ pattern = "[%a_][%w_]*%f[(]", type = "function" },
-- Macros
{
pattern = "^%s*#%s*define%s+()[%a_][%a%d_]*",
type = { "keyword", "symbol" }
},
{
pattern = "#%s*include%s+()<.->",
type = { "keyword", "string" }
},
{ pattern = "%f[#]#%s*[%a_][%w_]*", type = "keyword" },
-- Everything else to make the tokenizer work properly
{ pattern = "[%a_][%w_]*", type = "symbol" },
},
symbols = {
["alignof"] = "keyword",
["alignas"] = "keyword",
["and"] = "keyword",
["and_eq"] = "keyword",
["not"] = "keyword",
["not_eq"] = "keyword",
["or"] = "keyword",
["or_eq"] = "keyword",
["xor"] = "keyword",
["xor_eq"] = "keyword",
["private"] = "keyword",
["protected"] = "keyword",
["public"] = "keyword",
["register"] = "keyword",
["nullptr"] = "keyword",
["operator"] = "keyword",
["asm"] = "keyword",
["bitand"] = "keyword",
["bitor"] = "keyword",
["catch"] = "keyword",
["throw"] = "keyword",
["try"] = "keyword",
["class"] = "keyword",
["compl"] = "keyword",
["explicit"] = "keyword",
["export"] = "keyword",
["concept"] = "keyword",
["consteval"] = "keyword",
["constexpr"] = "keyword",
["constinit"] = "keyword",
["const_cast"] = "keyword",
["dynamic_cast"] = "keyword",
["reinterpret_cast"] = "keyword",
["static_cast"] = "keyword",
["static_assert"] = "keyword",
["template"] = "keyword",
["this"] = "keyword",
["thread_local"] = "keyword",
["requires"] = "keyword",
["co_wait"] = "keyword",
["co_return"] = "keyword",
["co_yield"] = "keyword",
["decltype"] = "keyword",
["delete"] = "keyword",
["friend"] = "keyword",
["typeid"] = "keyword",
["typename"] = "keyword",
["mutable"] = "keyword",
["override"] = "keyword",
["virtual"] = "keyword",
["using"] = "keyword",
["namespace"] = "keyword",
["new"] = "keyword",
["noexcept"] = "keyword",
["if"] = "keyword",
["then"] = "keyword",
["else"] = "keyword",
["elseif"] = "keyword",
["do"] = "keyword",
["while"] = "keyword",
["for"] = "keyword",
["break"] = "keyword",
["continue"] = "keyword",
["return"] = "keyword",
["goto"] = "keyword",
["struct"] = "keyword",
["union"] = "keyword",
["typedef"] = "keyword",
["enum"] = "keyword",
["extern"] = "keyword",
["static"] = "keyword",
["volatile"] = "keyword",
["const"] = "keyword",
["inline"] = "keyword",
["case"] = "keyword",
["default"] = "keyword",
["auto"] = "keyword",
["void"] = "keyword2",
["int"] = "keyword2",
["short"] = "keyword2",
["long"] = "keyword2",
["float"] = "keyword2",
["double"] = "keyword2",
["char"] = "keyword2",
["unsigned"] = "keyword2",
["bool"] = "keyword2",
["true"] = "literal",
["false"] = "literal",
["NULL"] = "literal",
["wchar_t"] = "keyword2",
["char8_t"] = "keyword2",
["char16_t"] = "keyword2",
["char32_t"] = "keyword2",
["#include"] = "keyword",
["#if"] = "keyword",
["#ifdef"] = "keyword",
["#ifndef"] = "keyword",
["#elif"] = "keyword",
["#else"] = "keyword",
["#elseif"] = "keyword",
["#endif"] = "keyword",
["#define"] = "keyword",
["#warning"] = "keyword",
["#error"] = "keyword",
["#pragma"] = "keyword",
["end"] = "keyword",
["element"] = "keyword",
["label"] = "keyword",
["measure"] = "keyword",
["mesure"] = "keyword",
["Element"] = "keyword",
["whoinElement"] = "keyword",
["region"] = "keyword",
["R3"] = "keyword",
["vertex"] = "keyword",
["im"] = "keyword",
["l1"] = "keyword",
["l2"] = "keyword",
["linfty"] = "keyword",
["max"] = "keyword",
["min"] = "keyword",
["re"] = "keyword",
["sum"] = "keyword",
["quantile"] = "keyword",
["sort"] = "keyword",
["x"] = "keyword",
["y"] = "keyword",
["z"] = "keyword",
["length"] = "keyword",
["area"] = "keyword",
["coef"] = "keyword",
["diag"] = "keyword",
["m"] = "keyword",
["n"] = "keyword",
["nbcoef"] = "keyword",
["nnz"] = "keyword",
["resize"] = "keyword",
["size"] = "keyword",
["imax"] = "keyword",
["imin"] = "keyword",
["N"] = "keyword",
["P"] = "keyword",
["nuTriangle"] = "keyword",
["ndof"] = "keyword",
["ndofK"] = "keyword",
["nt"] = "keyword",
["be"] = "keyword",
["hmax"] = "keyword",
["hmin"] = "keyword",
["nbe"] = "keyword",
["nv"] = "keyword",
["bordermesure"] = "keyword",
["eof"] = "keyword",
["good"] = "keyword",
["fixed"] = "keyword",
["flush"] = "keyword",
["noshowbase"] = "keyword",
["noshowpos"] = "keyword",
["precision"] = "keyword",
["scientific"] = "keyword",
["seekp"] = "keyword",
["showbase"] = "keyword",
["showpos"] = "keyword",
["tellp"] = "keyword",
["ARGV"] = "keyword",
["CG"] = "keyword",
["CPUTime"] = "keyword",
["Cholesky"] = "keyword",
["Cofactor"] = "keyword",
["Crout"] = "keyword",
["Edge03d"] = "keyword",
["GMRES"] = "keyword",
["HaveUMFPACK"] = "keyword",
["LU"] = "keyword",
["NaN"] = "keyword",
["P0"] = "keyword",
["P03d"] = "keyword",
["P0VF"] = "keyword",
["P0edge"] = "keyword",
["P1"] = "keyword",
["P13d"] = "keyword",
["P1b"] = "keyword",
["P1b3d"] = "keyword",
["P1dc"] = "keyword",
["P1nc"] = "keyword",
["P2"] = "keyword",
["P23d"] = "keyword",
["P2b"] = "keyword",
["P2dc"] = "keyword",
["P2h"] = "keyword",
["RT0"] = "keyword",
["RT03d"] = "keyword",
["RT0Ortho"] = "keyword",
["RTmodif"] = "keyword",
["UMFPACK"] = "keyword",
["append"] = "keyword",
["binary"] = "keyword",
["hTriangle"] = "keyword",
["havesparsesolver"] = "keyword",
["inside"] = "keyword",
["lenEdge"] = "keyword",
["nTonEdge"] = "keyword",
["nuEdge"] = "keyword",
["pi"] = "keyword",
["qf1pE"] = "keyword",
["qf1pElump"] = "keyword",
["qf1pT"] = "keyword",
["qf1pTlump"] = "keyword",
["qf2pE"] = "keyword",
["qf2pT"] = "keyword",
["qf2pT4P1"] = "keyword",
["qf3pE"] = "keyword",
["qf4pE"] = "keyword",
["qf5pE"] = "keyword",
["qf5pT"] = "keyword",
["qf7pT"] = "keyword",
["qf9pT"] = "keyword",
["qfV1"] = "keyword",
["qfV1lump"] = "keyword",
["qfV2"] = "keyword",
["qfV5"] = "keyword",
["searchMethod"] = "keyword",
["sparsesolver"] = "keyword",
["sparsesolverSym"] = "keyword",
["storagetotal"] = "keyword",
["storageused"] = "keyword",
["verbosity"] = "keyword",
["version"] = "keyword",
["volume"] = "keyword",
["volumelevelset"] = "keyword",
["wait"] = "keyword",
["ShowAlloc"] = "keyword",
["Newton"] = "keyword",
["NoGraphicWindow"] = "keyword",
["NoUseOfWait"] = "keyword",
["SameMesh"] = "keyword",
["Unique"] = "keyword",
["arealevelset"] = "keyword",
["average"] = "keyword",
["chtmpdir"] = "keyword",
["time"] = "keyword",
["fill"] = "keyword",
["value"] = "keyword",
["nbiso"] = "keyword",
["coeff"] = "keyword",
["dataname"] = "keyword",
["order"] = "keyword",
["mpirank"] = "keyword",
["mpiCommWorld"] = "keyword",
["mpiGroup"] = "keyword",
["mpiRequest"] = "keyword",
["sparams"] = "keyword",
["mpisize"] = "keyword",
["mpiUndefined"] = "keyword",
["mpiAnySource"] = "keyword",
["communicator"] = "keyword",
["worker"] = "keyword",
["dim"] = "keyword",
["cmm"] = "keyword",
["solver"] = "keyword",
["aniso"] = "keyword",
["nbvx"] = "keyword",
["abserror"] = "keyword",
["anisomax"] = "keyword",
["cutoff"] = "keyword",
["err"] = "keyword",
["errg"] = "keyword",
["inquire"] = "keyword",
["IsMetric"] = "keyword",
["iso"] = "keyword",
["keepbackvertices"] = "keyword",
["maxsubdiv"] = "keyword",
["metric"] = "keyword",
["nbjacoby"] = "keyword",
["nbsmooth"] = "keyword",
["nomeshgeneration"] = "keyword",
["omega"] = "keyword",
["periodic"] = "keyword",
["powerin"] = "keyword",
["ratio"] = "keyword",
["rescaling"] = "keyword",
["splitin2"] = "keyword",
["splitpbedge"] = "keyword",
["thetamax"] = "keyword",
["uniform"] = "keyword",
["fixedborder"] = "keyword",
["flags"] = "keyword",
["ivalue"] = "keyword",
["maxit"] = "keyword",
["mode"] = "keyword",
["ncv"] = "keyword",
["nev"] = "keyword",
["rawvector"] = "keyword",
["sigma"] = "keyword",
["sym"] = "keyword",
["tol"] = "keyword",
["vector"] = "keyword",
["which"] = "keyword",
["op"] = "keyword",
["t"] = "keyword",
["eps"] = "keyword",
["nbiter"] = "keyword",
["precon"] = "keyword",
["veps"] = "keyword",
["tgv"] = "keyword",
["tolpivot"] = "keyword",
["meditff"] = "keyword",
["save"] = "keyword",
["orientation"] = "keyword",
["ptmerge"] = "keyword",
["transfo"] = "keyword",
["optimize"] = "keyword",
["aspectratio"] = "keyword",
["bb"] = "keyword",
["boundary"] = "keyword",
["bw"] = "keyword",
["cut"] = "keyword",
["grey"] = "keyword",
["hsv"] = "keyword",
["nbarrow"] = "keyword",
["ps"] = "keyword",
["varrow"] = "keyword",
["viso"] = "keyword",
["init"] = "keyword",
["strategy"] = "keyword",
["tolpivotsym"] = "keyword",
["facetcl"] = "keyword",
["holelist"] = "keyword",
["nboffacetcl"] = "keyword",
["nbofregions"] = "keyword",
["regionlist"] = "keyword",
["switch"] = "keyword",
["refface"] = "keyword",
["split"] = "keyword",
["zbound"] = "keyword",
["labeldown"] = "keyword",
["labelmid"] = "keyword",
["labelup"] = "keyword",
["opt"] = "keyword",
["mpiMAX"] = "keyword",
["mpiMIN"] = "keyword",
["mpiSUM"] = "keyword",
["mpiPROD"] = "keyword",
["mpiLAND"] = "keyword",
["mpiLOR"] = "keyword",
["mpiLXOR"] = "keyword",
["mpiBAND"] = "keyword",
["mpiBXOR"] = "keyword",
["border"] = "keyword2",
["Cmapmatrix"] = "keyword2",
["Cmatrix"] = "keyword2",
["complex"] = "keyword2",
["fespace"] = "keyword2",
["func"] = "keyword2",
["ifstream"] = "keyword2",
["mapmatrix"] = "keyword2",
["matrix"] = "keyword2",
["mesh"] = "keyword2",
["mesh3"] = "keyword2",
["ofstream"] = "keyword2",
["problem"] = "keyword2",
["real"] = "keyword2",
["solve"] = "keyword2",
["string"] = "keyword2",
["varf"] = "keyword2",
["macro"] = "keyword2",
["dmatrix"] = "keyword2",
["adj"] = "function",
["find"] = "function",
["rfind"] = "function",
["seekg"] = "function",
["tellg"] = "function",
["AddLayers"] = "function",
["AffineCG"] = "function",
["AffineGMRES"] = "function",
["BFGS"] = "function",
["EigenValue"] = "function",
["LinearCG"] = "function",
["LinearGMRES"] = "function",
["NLCG"] = "function",
["abs"] = "function",
["acos"] = "function",
["acosh"] = "function",
["adaptmesh"] = "function",
["arg"] = "function",
["asin"] = "function",
["asinh"] = "function",
["assert"] = "function",
["atan"] = "function",
["atan2"] = "function",
["atanh"] = "function",
["atof"] = "function",
["atoi"] = "function",
["boundingbox"] = "function",
["buildmesh"] = "function",
["buildmeshborder"] = "function",
["ceil"] = "function",
["change"] = "function",
["checkmovemesh"] = "function",
["clock"] = "function",
["complexEigenValue"] = "function",
["conj"] = "function",
["convect"] = "function",
["cos"] = "function",
["cosh"] = "function",
["defaultoUMFPACK"] = "function",
["defaultsolver"] = "function",
["defaulttoCG"] = "function",
["defaulttoGMRES"] = "function",
["defaulttoUMFPACK"] = "function",
["det"] = "function",
["dumptable"] = "function",
["dx"] = "function",
["dxx"] = "function",
["dxy"] = "function",
["dxz"] = "function",
["dy"] = "function",
["dyx"] = "function",
["dyy"] = "function",
["dyz"] = "function",
["dz"] = "function",
["dzx"] = "function",
["dzy"] = "function",
["dzz"] = "function",
["emptymesh"] = "function",
["erf"] = "function",
["erfc"] = "function",
["exec"] = "function",
["exit"] = "function",
["exp"] = "function",
["floor"] = "function",
["getline"] = "function",
["hypot"] = "function",
["imag"] = "function",
["int1d"] = "function",
["int2d"] = "function",
["int3d"] = "function",
["intallVFedges"] = "function",
["intalledges"] = "function",
["intallfaces"] = "function",
["interplotematrix"] = "function",
["interpolate"] = "function",
["isInf"] = "function",
["isNaN"] = "function",
["isNormal"] = "function",
["j0"] = "function",
["j1"] = "function",
["jn"] = "function",
["jump"] = "function",
["lgamma"] = "function",
["log"] = "function",
["log10"] = "function",
["lrint"] = "function",
["lround"] = "function",
["ltime"] = "function",
["mean"] = "function",
["movemesh"] = "function",
["newconvect"] = "function",
["norm"] = "function",
["on"] = "function",
["otherside"] = "function",
["plot"] = "function",
["polar"] = "function",
["pow"] = "function",
["randinit"] = "function",
["randint31"] = "function",
["randint32"] = "function",
["randreal1"] = "function",
["randreal2"] = "function",
["randreal3"] = "function",
["randres53"] = "function",
["readmesh"] = "function",
["readmesh3"] = "function",
["renumbering"] = "function",
["restrict"] = "function",
["rint"] = "function",
["round"] = "function",
["savemesh"] = "function",
["savesurfacemesh"] = "function",
["set"] = "function",
["setw"] = "function",
["showCPU"] = "function",
["sin"] = "function",
["sinh"] = "function",
["splitmesh"] = "function",
["sqr"] = "function",
["sqrt"] = "function",
["square"] = "function",
["system"] = "function",
["tan"] = "function",
["tanh"] = "function",
["tgamma"] = "function",
["toCarray"] = "function",
["toRarray"] = "function",
["toZarray"] = "function",
["trace"] = "function",
["triangulate"] = "function",
["trunc"] = "function",
["y0"] = "function",
["y1"] = "function",
["yn"] = "function",
["savevtk"] = "function",
["mshmet"] = "function",
["savesol"] = "function",
["gmshload"] = "function",
["gmshload3"] = "function",
["mpiBarrier"] = "function",
["mpiSize"] = "function",
["Irecv"] = "function",
["Isend"] = "function",
["processor"] = "function",
["mpiWaitAny"] = "function",
["mpiWait"] = "function",
["mpiRank"] = "function",
["metis"] = "function",
["metisdual"] = "function",
["broadcast"] = "function",
["scotch"] = "function",
["parmetis"] = "function",
["mpiWtime"] = "function",
["buildlayers"] = "function",
["mmg3d"] = "function",
["processorblock"] = "function",
["mpiWaitAll"] = "function",
["mpiWtick"] = "function",
["Send"] = "function",
["Recv"] = "function",
["mpiAlltoall"] = "function",
["mpiGather"] = "function",
["mpiScatter"] = "function",
["mpiReduce"] = "function",
["mpiAllReduce"] = "function",
["mpiReduceScatter"] = "function",
},
}
+51
View File
@@ -0,0 +1,51 @@
-- mod-version:3
-- Embedded JavaScript templating
-- provides .ejs syntax support (fork of language_html.lua).
local syntax = require "core.syntax"
syntax.add {
name = "EJS",
files = { "%.ejs$" },
block_comment = { "<!--", "-->" },
patterns = {
{
pattern = {
"<%%",
"%%>"
},
syntax = '.js',
type = "function"
},
{
pattern = {
"<%s*[sS][cC][rR][iI][pP][tT]%f[%s>].->",
"<%s*/%s*[sS][cC][rR][iI][pP][tT]%s*>"
},
syntax = ".js",
type = "function"
},
{
pattern = {
"<%s*[sS][tT][yY][lL][eE]%f[%s>].->",
"<%s*/%s*[sS][tT][yY][lL][eE]%s*>"
},
syntax = ".css",
type = "function"
},
{ pattern = { "<!%-%-", "%-%->" }, type = "comment" },
{ pattern = { '%f[^>][^<]', '%f[<]' }, type = "normal" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = "0x[%da-fA-F]+", type = "number" },
{ pattern = "-?%d+[%d%.]*f?", type = "number" },
{ pattern = "-?%.?%d+f?", type = "number" },
{ pattern = "%f[^<]![%a_][%w_]*", type = "keyword2" },
{ pattern = "%f[^<][%a_][%w_]*", type = "function" },
{ pattern = "%f[^<]/[%a_][%w_]*", type = "function" },
{ pattern = "[%a_][%w_]*", type = "keyword" },
{ pattern = "[/<>=]", type = "operator" },
},
symbols = {},
}
+95
View File
@@ -0,0 +1,95 @@
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "Elixir",
files = { "%.ex$", "%.exs$"},
comment = "#",
patterns = {
{ pattern = "#.*\n", type = "comment" },
{ pattern = { ':"', '"', '\\' }, type = "number" },
{ pattern = { '"""', '"""', '\\' }, type = "string" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = { '~%a"""', '"""' }, type = "string" },
{ pattern = { '~%a[/"|\'%(%[%{<]', '[/"|\'%)%]%}>]', '\\' }, type = "string"},
{ pattern = "-?0x%x+", type = "number" },
{ pattern = "-?%d+[%d%.eE]*f?", type = "number" },
{ pattern = "-?%.?%d+f?", type = "number" },
{ pattern = ':"?[%a_][%w_]*"?', type = "number" },
{ pattern = "[%a][%w_!?]*%f[(]", type = "function" },
{ pattern = "%u%w+", type = "normal" },
{ pattern = "@[%a_][%w_]*", type = "keyword2" },
{ pattern = "_%a[%w_]*", type = "keyword2" },
{ pattern = "[%+%-=/%*<>!|&]", type = "operator" },
{ pattern = "[%a_][%w_]*", type = "symbol" },
},
symbols = {
["def"] = "keyword",
["defp"] = "keyword",
["defguard"] = "keyword",
["defguardp"] = "keyword",
["defmodule"] = "keyword",
["defprotocol"] = "keyword",
["defimpl"] = "keyword",
["defrecord"] = "keyword",
["defrecordp"] = "keyword",
["defmacro"] = "keyword",
["defmacrop"] = "keyword",
["defdelegate"] = "keyword",
["defoverridable"] = "keyword",
["defexception"] = "keyword",
["defcallback"] = "keyword",
["defstruct"] = "keyword",
["for"] = "keyword",
["case"] = "keyword",
["when"] = "keyword",
["with"] = "keyword",
["cond"] = "keyword",
["if"] = "keyword",
["unless"] = "keyword",
["try"] = "keyword",
["receive"] = "keyword",
["after"] = "keyword",
["raise"] = "keyword",
["rescue"] = "keyword",
["catch"] = "keyword",
["else"] = "keyword",
["quote"] = "keyword",
["unquote"] = "keyword",
["super"] = "keyword",
["unquote_splicing"] = "keyword",
["do"] = "keyword",
["end"] = "keyword",
["fn"] = "keyword",
["import"] = "keyword2",
["alias"] = "keyword2",
["use"] = "keyword2",
["require"] = "keyword2",
["and"] = "operator",
["or"] = "operator",
["true"] = "literal",
["false"] = "literal",
["nil"] = "literal",
},
}
syntax.add {
files = { "%.l?eex$", "%.h?eex$" },
patterns = {
{ pattern = { "<!%-%-", "%-%->" }, type = "comment" },
{ pattern = { '%f[^>][^<]', '%f[<]' }, type = "normal" },
{ pattern = { '<%%=?', '%%>' }, type = "normal" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = "0x[%da-fA-F]+", type = "number" },
{ pattern = "-?%d+[%d%.]*f?", type = "number" },
{ pattern = "-?%.?%d+f?", type = "number" },
{ pattern = "%f[^<]![%a_][%w_]*", type = "keyword2" },
{ pattern = "%f[^<][%a_][%w_]*", type = "function" },
{ pattern = "%f[^<]/[%a_][%w_]*", type = "function" },
{ pattern = "[%a_][%w_]*", type = "keyword" },
{ pattern = "[/<>=]", type = "operator" },
},
symbols = {},
}
+49
View File
@@ -0,0 +1,49 @@
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "Elm",
files = { "%.elm$" },
comment = "%-%-",
patterns = {
{ pattern = {"%-%-", "\n"}, 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 = "[=:|&<>%+%-%*\\/%^%%]", type = "operator" },
{ pattern = "[%a_'][%w_']*", type = "symbol" },
},
symbols = {
["as"] = "keyword",
["case"] = "keyword",
["of"] = "keyword",
["if"] = "keyword",
["then"] = "keyword",
["else"] = "keyword",
["import"] = "keyword",
["module"] = "keyword",
["exposing"] = "keyword",
["let"] = "keyword",
["in"] = "keyword",
["type"] = "keyword",
["alias"] = "keyword",
["port"] = "keyword",
["and"] = "keyword",
["or"] = "keyword",
["xor"] = "keyword",
["not"] = "keyword",
["number"] = "keyword2",
["Bool"] = "keyword2",
["Char"] = "keyword2",
["Float"] = "keyword2",
["Int"] = "keyword2",
["String"] = "keyword2",
["True"] = "literal",
["False"] = "literal",
},
}
+68
View File
@@ -0,0 +1,68 @@
-- mod-version:3
local syntax = require "core.syntax"
local key_pattern = '[a-zA-Z_]+[a-zA-Z0-9_]*'
local unicode_sequence = "'?\\u%x%x%x%x'?"
local escaped_literals = "\\[nrtfb\\\"']"
local null_pattern = '%s*[Nn][Uu][Ll][Ll]%s*'
local true_pattern = '%s*[Tt][Rr][Uu][Ee]%s*'
local false_pattern = '%s*[Ff][Aa][Ll][Ss][Ee]%s*'
local synt_key = {
symbols = {},
patterns = {
{ type = "keyword2", pattern = key_pattern },
},
}
local synt_dqs = {
symbols = {},
patterns = {
{ pattern = { "%${", "}" }, type = "keyword", syntax = synt_key },
{ pattern = "0[bB][%d]+", type = "number" },
{ pattern = "0[xX][%da-fA-F]+", type = "number" },
{ pattern = "[-+]?%.?%d+", type = "number" },
{ pattern = escaped_literals, type = "literal" }, -- escaped chars
{ pattern = unicode_sequence, type = "literal" }, -- unicode sequence
{ pattern = '[%w%p%s]', type = "string" },
},
}
syntax.add {
name = "language_env",
files = { "%.env$" },
comment = '#',
symbols = {},
patterns = {
{ pattern = "#.*$", type = "comment" },
{ pattern = "export", type = "function" },
{ pattern = null_pattern, type = "literal" },
{ pattern = true_pattern, type = "literal" },
{ pattern = false_pattern, type = "literal" },
{ pattern = escaped_literals, type = "literal" },
{ pattern = unicode_sequence, type = "literal" },
-- interpolation
{ pattern = { "%${", "}" }, type = "keyword", syntax = synt_key },
-- numbers
{ pattern = "0[bB][%d]+", type = "number" },
{ pattern = "0[xX][%da-fA-F]+", type = "number" },
{ pattern = "[-+]?%.?%d+", type = "number" },
-- keys
{ pattern = '[\'"].*[\'"]%s*=.*', type = "normal" },
-- {
-- pattern = '[\'"]?'..escaped_literals..'[\'"]?%s*=.*',
-- type = "normal"
-- },
-- {
-- pattern = '[\'"]?'..null_pattern..'[\'"]?%s*=.*',
-- type = "normal"
-- },
{ pattern = key_pattern..'%s*()=%s*', type = { "keyword2", "operator" }},
-- quoted strings
{ pattern = {'"', '"', '\\'}, type = "string", syntax = synt_dqs},
{ pattern = {"'", "'", '\\'}, type = "string" },
{ pattern = {'"""', '"""', '\\'}, type = "string" },
{ pattern = {"'''", "'''", '\\'}, type = "string" },
},
}
+55
View File
@@ -0,0 +1,55 @@
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "html-eruby",
files = { PATHSEP .. "%.html?%.erb$", "%.erb$" },
block_comment = { "<!--", "-->" },
patterns = {
{
pattern = {
"<%s*[sS][cC][rR][iI][pP][tT]%f[%s>].->",
"<%s*/%s*[sS][cC][rR][iI][pP][tT]%s*>"
},
syntax = ".js",
type = "function"
},
{
pattern = {
"<%s*[sS][tT][yY][lL][eE]%f[%s>].->",
"<%s*/%s*[sS][tT][yY][lL][eE]%s*>"
},
syntax = ".css",
type = "function"
},
{
pattern = {
"<%%",
"%%>"
},
syntax = ".rb",
type = "function"
},
{
pattern = {
"<%%=",
"%%>"
},
syntax = ".rb",
type = "function"
},
{ pattern = { "<!%-%-", "%-%->" }, type = "comment" },
{ pattern = { '%f[^>][^<]', '%f[<]' }, type = "normal" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = "0x[%da-fA-F]+", type = "number" },
{ pattern = "-?%d+[%d%.]*f?", type = "number" },
{ pattern = "-?%.?%d+f?", type = "number" },
{ pattern = "%f[^<]![%a_][%w_]*", type = "keyword2" },
{ pattern = "%f[^<][%a_][%w_]*", type = "function" },
{ pattern = "%f[^<]/[%a_][%w_]*", type = "function" },
{ pattern = "[%a_][%w_]*", type = "keyword" },
{ pattern = "[/<>=]", type = "operator" },
},
symbols = {},
}
+52
View File
@@ -0,0 +1,52 @@
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "fe",
files = "%.fe$",
comment = ";",
patterns = {
{ pattern = ";.*", type = "comment" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = "0x[%da-fA-F]+", type = "number" },
{ pattern = "-?%d+[%d%.]*", type = "number" },
{ pattern = "-?%.?%d+", type = "number" },
{ pattern = "'", type = "symbol" },
{ pattern = "=", type = "symbol" },
{ pattern = "<=?", type = "symbol" },
{ pattern = "[%+-%*/]", type = "symbol" },
{ pattern = "%f[^(][^()'%s\"]+", type = "function" },
{ pattern = "[^()'%s\"]+", type = "symbol" },
},
symbols = {
["let"] = "keyword",
["if"] = "keyword",
["fn"] = "keyword",
["mac"] = "keyword",
["while"] = "keyword",
["quote"] = "keyword",
["'"] = "keyword",
["and"] = "keyword",
["or"] = "keyword",
["do"] = "keyword",
["cons"] = "keyword",
["car"] = "keyword",
["cdr"] = "keyword",
["setcar"] = "keyword",
["setcdr"] = "keyword",
["list"] = "keyword",
["not"] = "keyword",
["is"] = "keyword",
["atom"] = "keyword",
["print"] = "keyword",
["<"] = "operator",
["<="] = "operator",
["="] = "operator",
["+"] = "operator",
["-"] = "operator",
["*"] = "operator",
["/"] = "operator",
["nil"] = "literal",
["t"] = "literal",
}
}
+268
View File
@@ -0,0 +1,268 @@
-- mod-version:3
-- Support for the Fennel programming language: https://fennel-lang.org
-- Covers all the keywords up to Fennel version 1.2.0
-- Currently only covers highlighting, not indentation, delimiter
-- matching, or evaluation.
local syntax = require("core.syntax")
syntax.add({
comment = ";",
files = "%.fnl$",
name = "Fennel",
patterns = {
{ pattern = ";.-\n", type = "comment" },
{ pattern = { '"', '"', "\\" }, type = "string" },
{ pattern = "0x[%da-fA-F]+", type = "number" },
{ pattern = "-?%d+[%d%.]*", type = "number" },
{ pattern = "-?%.?%d+", type = "number" },
{ pattern = "%f[^(][^()'%s\"]+", type = "function" },
{ pattern = "[^()'%s\"]+", type = "symbol" },
},
symbols = {
["#"] = "keyword",
["%"] = "keyword",
["*"] = "keyword",
["+"] = "keyword",
["-"] = "keyword",
["->"] = "keyword",
["->>"] = "keyword",
["-?>"] = "keyword",
["-?>>"] = "keyword",
["."] = "keyword",
[".."] = "keyword",
["/"] = "keyword",
["//"] = "keyword",
[":"] = "keyword",
["<"] = "keyword",
["<="] = "keyword",
["="] = "keyword",
[">"] = "keyword",
[">="] = "keyword",
["?."] = "keyword",
["^"] = "keyword",
_G = "keyword",
accumulate = "keyword2",
["and"] = "keyword2",
arg = "keyword2",
assert = "keyword2",
band = "keyword2",
bit32 = "keyword2",
["bit32.arshift"] = "keyword2",
["bit32.band"] = "keyword2",
["bit32.bnot"] = "keyword2",
["bit32.bor"] = "keyword2",
["bit32.btest"] = "keyword2",
["bit32.bxor"] = "keyword2",
["bit32.extract"] = "keyword2",
["bit32.lrotate"] = "keyword2",
["bit32.lshift"] = "keyword2",
["bit32.replace"] = "keyword2",
["bit32.rrotate"] = "keyword2",
["bit32.rshift"] = "keyword2",
bnot = "keyword2",
bor = "keyword2",
bxor = "keyword2",
collect = "keyword2",
collectgarbage = "keyword2",
comment = "keyword2",
coroutine = "keyword2",
["coroutine.create"] = "keyword2",
["coroutine.resume"] = "keyword2",
["coroutine.running"] = "keyword2",
["coroutine.status"] = "keyword2",
["coroutine.wrap"] = "keyword2",
["coroutine.yield"] = "keyword2",
debug = "keyword2",
["debug.debug"] = "keyword2",
["debug.gethook"] = "keyword2",
["debug.getinfo"] = "keyword2",
["debug.getlocal"] = "keyword2",
["debug.getmetatable"] = "keyword2",
["debug.getregistry"] = "keyword2",
["debug.getupvalue"] = "keyword2",
["debug.getuservalue"] = "keyword2",
["debug.sethook"] = "keyword2",
["debug.setlocal"] = "keyword2",
["debug.setmetatable"] = "keyword2",
["debug.setupvalue"] = "keyword2",
["debug.setuservalue"] = "keyword2",
["debug.traceback"] = "keyword2",
["debug.upvalueid"] = "keyword2",
["debug.upvaluejoin"] = "keyword2",
["do"] = "keyword2",
dofile = "keyword2",
doto = "keyword2",
each = "keyword2",
error = "keyword2",
["eval-compiler"] = "keyword2",
["false"] = "literal",
fcollect = "keyword2",
fn = "keyword2",
["for"] = "keyword2",
getmetatable = "keyword2",
global = "keyword2",
hashfn = "keyword2",
icollect = "keyword2",
["if"] = "keyword2",
["import-macros"] = "keyword2",
include = "keyword2",
io = "keyword2",
["io.close"] = "keyword2",
["io.flush"] = "keyword2",
["io.input"] = "keyword2",
["io.lines"] = "keyword2",
["io.open"] = "keyword2",
["io.output"] = "keyword2",
["io.popen"] = "keyword2",
["io.read"] = "keyword2",
["io.tmpfile"] = "keyword2",
["io.type"] = "keyword2",
["io.write"] = "keyword2",
ipairs = "keyword2",
lambda = "keyword2",
length = "keyword2",
let = "keyword2",
load = "keyword2",
loadfile = "keyword2",
loadstring = "keyword2",
["local"] = "keyword2",
lshift = "keyword2",
lua = "keyword2",
macro = "keyword2",
macrodebug = "keyword2",
macros = "keyword2",
match = "keyword2",
["match-try"] = "keyword2",
math = "keyword2",
["math.abs"] = "keyword2",
["math.acos"] = "keyword2",
["math.asin"] = "keyword2",
["math.atan"] = "keyword2",
["math.atan2"] = "keyword2",
["math.ceil"] = "keyword2",
["math.cos"] = "keyword2",
["math.cosh"] = "keyword2",
["math.deg"] = "keyword2",
["math.exp"] = "keyword2",
["math.floor"] = "keyword2",
["math.fmod"] = "keyword2",
["math.frexp"] = "keyword2",
["math.ldexp"] = "keyword2",
["math.log"] = "keyword2",
["math.log10"] = "keyword2",
["math.max"] = "keyword2",
["math.min"] = "keyword2",
["math.modf"] = "keyword2",
["math.pow"] = "keyword2",
["math.rad"] = "keyword2",
["math.random"] = "keyword2",
["math.randomseed"] = "keyword2",
["math.sin"] = "keyword2",
["math.sinh"] = "keyword2",
["math.sqrt"] = "keyword2",
["math.tan"] = "keyword2",
["math.tanh"] = "keyword2",
module = "keyword2",
next = "keyword2",
["nil"] = "literal",
["not"] = "keyword2",
["not="] = "keyword2",
["or"] = "keyword2",
os = "keyword2",
["os.clock"] = "keyword2",
["os.date"] = "keyword2",
["os.difftime"] = "keyword2",
["os.execute"] = "keyword2",
["os.exit"] = "keyword2",
["os.getenv"] = "keyword2",
["os.remove"] = "keyword2",
["os.rename"] = "keyword2",
["os.setlocale"] = "keyword2",
["os.time"] = "keyword2",
["os.tmpname"] = "keyword2",
package = "keyword2",
["package.loadlib"] = "keyword2",
["package.searchpath"] = "keyword2",
["package.seeall"] = "keyword2",
pairs = "keyword2",
partial = "keyword2",
pcall = "keyword2",
["pick-args"] = "keyword2",
["pick-values"] = "keyword2",
print = "keyword2",
quote = "keyword2",
rawequal = "keyword2",
rawget = "keyword2",
rawlen = "keyword2",
rawset = "keyword2",
require = "keyword2",
["require-macros"] = "keyword2",
rshift = "keyword2",
select = "keyword2",
set = "keyword2",
["set-forcibly!"] = "keyword2",
setmetatable = "keyword2",
string = "keyword2",
["string.byte"] = "keyword2",
["string.char"] = "keyword2",
["string.dump"] = "keyword2",
["string.find"] = "keyword2",
["string.format"] = "keyword2",
["string.gmatch"] = "keyword2",
["string.gsub"] = "keyword2",
["string.len"] = "keyword2",
["string.lower"] = "keyword2",
["string.match"] = "keyword2",
["string.rep"] = "keyword2",
["string.reverse"] = "keyword2",
["string.sub"] = "keyword2",
["string.upper"] = "keyword2",
table = "keyword2",
["table.concat"] = "keyword2",
["table.insert"] = "keyword2",
["table.maxn"] = "keyword2",
["table.pack"] = "keyword2",
["table.remove"] = "keyword2",
["table.sort"] = "keyword2",
["table.unpack"] = "keyword2",
tonumber = "keyword2",
tostring = "keyword2",
["true"] = "literal",
tset = "keyword2",
type = "keyword2",
unpack = "keyword2",
values = "keyword2",
var = "keyword2",
when = "keyword2",
["while"] = "keyword2",
["with-open"] = "keyword2",
xpcall = "keyword2",
["~="] = "keyword",
["λ"] = "keyword",
},
})
-- To regenerate the syntax from the compiler:
-- (macro s []
-- (let [{: syntax} (require :fennel)
-- symbols {:nil :literal
-- :true :literal
-- :false :literal}]
-- `(syntax.add {:name "Fennel"
-- :files "%.fnl$"
-- :comment ";"
-- :patterns [{:type :comment :pattern ";.-\n"}
-- {:type :string :pattern {1 "\"" 2 "\"" 3 "\\"}}
-- {:type :number :pattern "0x[%da-fA-F]+"}
-- {:type :number :pattern "-?%d+[%d%.]*"}
-- {:type :number :pattern "-?%.?%d+"}
-- {:type :function :pattern "%f[^(][^()'%s\"]+"}
-- {:type :symbol :pattern "[^()'%s\"]+"}]
-- :symbols ,(collect [name (pairs (syntax)) :into symbols]
-- (values name
-- (if (name:find "[a-z]")
-- :keyword2 :keyword)))}))) (s)
-- and reformat the output, of course
+85
View File
@@ -0,0 +1,85 @@
-- Author: Rohan Vashisht: https://github.com/rohanvashisht1234/
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "Fortran", -- tested ok
files = {
"%.f$", -- tested ok
"%.f90$", -- tested ok
"%.f95$" -- tested ok
},
comment = "!", -- tested ok
patterns = {
{ pattern = { "'", "'", '\\' }, type = "string" }, -- tested ok
{ pattern = { '"', '"', '\\' }, type = "string" }, -- tested ok
{ pattern = "!.*", type = "comment" }, -- tested ok
{ pattern = "%.[%a_][%w_]+%.", type = "normal" }, -- tested ok
{ pattern = "[!%-/*?:=><+]", type = "operator" }, -- tested ok
{ pattern = "[%a_][%w_]*%f[(]", type = "function" }, -- tested ok
{ pattern = "program()%s+()[%a_][%w_]*", type = { "keyword", "normal", "literal" } }, -- tested ok
{ pattern = "module()%s+()[%a_][%w_]*", type = { "keyword", "normal", "literal" } }, -- tested ok
{ pattern = "use()%s+()[%a_][%w_]*", type = { "keyword", "normal", "literal" } }, -- tested ok
{ pattern = "struct()%s+()[%a_][%w_]*", type = { "keyword", "normal", "literal" } }, -- tested ok
{ pattern = "-?%d+[%d%.eE_]*", type = "number" }, -- tested ok
{ pattern = "-?%.?%d+", type = "number" }, -- tested ok
{ pattern = "[%a_][%w_]*", type = "normal" }, -- tested ok
},
symbols = {
["end"] = "keyword", -- tested ok
["program"] = "keyword", -- tested ok
["write"] = "keyword", -- tested ok
["print"] = "keyword", -- tested ok
["implicit"] = "keyword", -- tested ok
["integer"] = "keyword", -- tested ok
["real"] = "keyword", -- tested ok
["complex"] = "keyword", -- tested ok
["character"] = "keyword", -- tested ok
["logical"] = "keyword", -- tested ok
["allocatable"] = "keyword", -- tested ok
["subroutine"] = "keyword", -- tested ok
["do"] = "keyword", -- tested ok
["call"] = "keyword", -- tested ok
["extends"] = "keyword", -- tested ok
["protected"] = "keyword", -- tested ok
["contains"] = "keyword", -- tested ok
["else"] = "keyword", -- tested ok
["then"] = "keyword", -- tested ok
["if"] = "keyword", -- tested ok
["cycle"] = "keyword", -- tested ok
["parameter"] = "keyword", -- tested ok
["concurrent"] = "keyword", -- tested ok
["function"] = "keyword", -- tested ok
["private"] = "keyword", -- tested ok
["public"] = "keyword", -- tested ok
["module"] = "keyword", -- tested ok
["use"] = "keyword", -- tested ok
["type"] = "keyword", -- tested ok
["sequence"] = "keyword", -- tested ok
["struct"] = "keyword", -- tested ok
["result"] = "keyword", -- tested ok
["stop"] = "keyword", -- tested ok
["only"] = "keyword", -- tested ok
["none"] = "keyword2", -- tested ok
["len"] = "keyword2", -- tested ok
[".false."] = "keyword2", -- tested ok
[".true."] = "keyword2", -- tested ok
[".eq."] = "keyword2", -- tested ok
[".ne."] = "keyword2", -- tested ok
[".gt."] = "keyword2", -- tested ok
[".lt."] = "keyword2", -- tested ok
[".ge"] = "keyword2", -- tested ok
[".not."] = "keyword2", -- tested ok
[".le."] = "keyword2", -- tested ok
[".or."] = "keyword2", -- tested ok
[".and."] = "keyword2", -- tested ok
[".eqv."] = "keyword2", -- tested ok
[".neqv."] = "keyword2", -- tested ok
}
}
+99
View File
@@ -0,0 +1,99 @@
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "fstab",
files = { PATHSEP .. "fstab$" },
comment = '#',
patterns = {
-- Only lines that start with a # are comments; you can have #'s in fuse
-- filesystem strings that aren't comments, so shouldn't be highlighted as such.
{ regex = "^#.*", type = "comment" },
{ pattern = "[=/:.,]+", type = "operator" },
{ pattern = "/.*/", type = "string" },
{ pattern = "#", type = "operator" },
-- {
-- pattern = "%g+%s+()%g+%s+()%g+%s+()%g+%s+()[01]%s+()[012]%s*",
-- type = {
-- -- filesystem
-- "keyword",
-- -- mount point
-- "keyword2",
-- -- fs type
-- "symbol",
-- -- options
-- "keyword2",
-- -- dump frequency
-- "keyword",
-- -- pass number
-- "keyword2",
-- }
-- },
-- UUID
{ pattern = "%w-%-%w-%-%w-%-%w-%-%w- ", type = "string" },
-- IPv4 Address
{ pattern = "%d+%.%d+%.%d+%.%d+", type = "string" },
{ pattern = " %d+ ", type = "number" },
{ pattern = "[%w_]+", type = "symbol" },
},
symbols = {
["none"] = "literal",
["LABEL"] = "keyword",
["UUID"] = "keyword",
-- filesystems
["aufs"] = "keyword2",
["autofs"] = "keyword2",
["bdev"] = "keyword2",
["binder"] = "keyword2",
["binfmt_misc"] = "keyword2",
["bpf"] = "keyword2",
["btrfs"] = "keyword2",
["cgroup"] = "keyword2",
["cgroup2"] = "keyword2",
["configfs"] = "keyword2",
["cpuset"] = "keyword2",
["debugfs"] = "keyword2",
["devpts"] = "keyword2",
["devtmpfs"] = "keyword2",
["ecryptfs"] = "keyword2",
["ext2"] = "keyword2",
["ext3"] = "keyword2",
["ext4"] = "keyword2",
["fuse"] = "keyword2",
["fuseblk"] = "keyword2",
["fusectl"] = "keyword2",
["hfs"] = "keyword2",
["hfsplus"] = "keyword2",
["hugetlbfs"] = "keyword2",
["jfs"] = "keyword2",
["minix"] = "keyword2",
["mqueue"] = "keyword2",
["msdos"] = "keyword2",
["nfs"] = "keyword2",
["nfs4"] = "keyword2",
["nfsd"] = "keyword2",
["ntfs"] = "keyword2",
["pipefs"] = "keyword2",
["proc"] = "keyword2",
["pstore"] = "keyword2",
["qnx4"] = "keyword2",
["ramfs"] = "keyword2",
["rpc_pipefs"] = "keyword2",
["securityfs"] = "keyword2",
["sockfs"] = "keyword2",
["squashfs"] = "keyword2",
["swap"] = "keyword2",
["sysfs"] = "keyword2",
["tmpfs"] = "keyword2",
["tracefs"] = "keyword2",
["ufs"] = "keyword2",
["vfat"] = "keyword2",
["xfs"] = "keyword2",
},
}
+19
View File
@@ -0,0 +1,19 @@
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "GABC",
files = { "%.gabc$" },
comment = "%%",
patterns = {
{ pattern = "%%.*", type = "comment" },
{ pattern = "^%w+:", type = "keyword2" },
{ pattern = "[%*{}]", type = "operator" },
{ pattern = "<[^>]*>", type = "function" },
{ pattern = "-?%.?%d+", type = "number" },
{ pattern = { "|", "%)" }, type = "keyword2" },
{ pattern = "%([^%)|]*%)?", type = "keyword" },
},
symbols = {}
}
+101
View File
@@ -0,0 +1,101 @@
-- mod-version:3
-- Support for the GDScript programming language: https://godotengine.org/
-- Covers the most used keywords up to Godot version 3.2.x
local syntax = require "core.syntax"
syntax.add {
name = "GDScript",
files = { "%.gd$" },
comment = "#",
patterns = {
{ pattern = "#.-\n", type = "comment" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = "-?0x%x*", type = "number" },
{ pattern = "-?%d+[%d%.e]*", type = "number" },
{ pattern = "-?%.?%d+", type = "number" },
{ pattern = "[%+%:%-=/%*%^%%<>!~|&]", type = "operator" },
{ pattern = "[%a_][%w_]*%f[(]", type = "function" },
{ pattern = "[%a_][%w_]*", type = "symbol" },
},
symbols = {
-- keywords
["if"] = "keyword",
["elif"] = "keyword",
["else"] = "keyword",
["for"] = "keyword",
["while"] = "keyword",
["match"] = "keyword",
["break"] = "keyword",
["continue"] = "keyword",
["pass"] = "keyword",
["return"] = "keyword",
["class"] = "keyword",
["class_name"] = "keyword",
["extends"] = "keyword",
["is"] = "keyword",
["in"] = "keyword",
["as"] = "keyword",
["and"] = "keyword",
["or"] = "keyword",
["not"] = "keyword",
["self"] = "keyword",
["tool"] = "keyword",
["signal"] = "keyword",
["func"] = "keyword",
["static"] = "keyword",
["const"] = "keyword",
["enum"] = "keyword",
["var"] = "keyword",
["onready"] = "keyword",
["export"] = "keyword",
["setget"] = "keyword",
["breakpoint"] = "keyword",
["preload"] = "keyword",
["yield"] = "keyword",
["assert"] = "keyword",
["remote"] = "keyword",
["master"] = "keyword",
["puppet"] = "keyword",
["remotesync"] = "keyword",
["mastersync"] = "keyword",
["puppetsync"] = "keyword",
-- types
["void"] = "keyword2",
["int"] = "keyword2",
["float"] = "keyword2",
["bool"] = "keyword2",
["String"] = "keyword2",
["Vector2"] = "keyword2",
["Rect2"] = "keyword2",
["Vector3"] = "keyword2",
["Transform2D"] = "keyword2",
["Plane"] = "keyword2",
["Quat"] = "keyword2",
["AABB"] = "keyword2",
["Basis"] = "keyword2",
["Transform"] = "keyword2",
["Color"] = "keyword2",
["NodePath"] = "keyword2",
["RID"] = "keyword2",
["Object"] = "keyword2",
["Array"] = "keyword2",
["PoolByteArray"] = "keyword2",
["PoolIntArray"] = "keyword2",
["PoolRealArray"] = "keyword2",
["PoolStringArray"] = "keyword2",
["PoolVector2Array"] = "keyword2",
["PoolVector3Array"] = "keyword2",
["PoolColorArray"] = "keyword2",
["Dictionary"] = "keyword2",
-- literals
["null"] = "literal",
["true"] = "literal",
["false"] = "literal",
["PI"] = "literal",
["TAU"] = "literal",
["INF"] = "literal",
["NAN"] = "literal",
},
}
+389
View File
@@ -0,0 +1,389 @@
-- mod-version:3
local style = require "core.style"
local common = require "core.common"
local syntax = require "core.syntax"
syntax.add {
name = "GLSL",
files = { "%.glsl$", "%.frag$", "%.vert$", },
comment = "//",
patterns = {
{ pattern = "//.-\n", type = "comment" },
{ pattern = { "/%*", "%*/" }, type = "comment" },
{ pattern = { "#", "[^\\]\n" }, type = "comment" },
{ 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 = "ivec[2-4]", type = "keyword2" },
{ pattern = "bvec[2-4]", type = "keyword2" },
{ pattern = "uvec[2-4]", type = "keyword2" },
{ pattern = "vec[2-4]", type = "keyword2" },
{ pattern = "dmat[2-4]x[2-4]", type = "keyword2" },
{ pattern = "dmat[2-4]", type = "keyword2" },
{ pattern = "mat[2-4]x[2-4]", type = "keyword2" },
{ pattern = "mat[2-4]", type = "keyword2" },
{ pattern = "[%a_][%w_]*%f[(]", type = "function" },
{ pattern = "[%a_][%w_]*", type = "symbol" },
},
symbols = {
--https://www.khronos.org/registry/OpenGL/specs/gl/GLSLangSpec.4.60.pdf
--The symbols are added here in the order they appear in the spec
["if"] = "keyword",
["else"] = "keyword",
["do"] = "keyword",
["while"] = "keyword",
["for"] = "keyword",
["break"] = "keyword",
["continue"] = "keyword",
["return"] = "keyword",
["const"] = "keyword",
["switch"] = "keyword",
["case"] = "keyword",
["default"] = "keyword",
["const"] = "keyword",
["void"] = "keyword",
["bool"] = "keyword2",
["int"] = "keyword2",
["uint"] = "keyword2",
["float"] = "keyword2",
["double"] = "keyword2",
["true"] = "literal",
["false"] = "literal",
["NULL"] = "literal",
["attribute"] = "keyword",
["varying"] = "keyword",
["uniform"] = "keyword",
["buffer"] = "keyword",
["shared"] = "keyword",
["layout"] = "keyword",
["centroid"] = "keyword",
["flat"] = "keyword",
["smooth"] = "keyword",
["noperspective"]= "keyword",
["patch"] = "keyword",
["sample"] = "keyword",
["in"] = "keyword",
["out"] = "keyword",
["inout"] = "keyword",
["invariant"] = "keyword",
["precise"] = "keyword",
["lowp"] = "keyword",
["mediump"] = "keyword",
["highp"] = "keyword",
["precision"] = "keyword",
["struct"] = "keyword",
["subroutine"] = "keyword",
["coherent"] = "keyword",
["volatile"] = "keyword",
["readonly"] = "keyword",
["writeonly"] = "keyword",
["sampler1D"] = "keyword2",
["sampler2D"] = "keyword2",
["sampler3D"] = "keyword2",
["samplerCube"] = "keyword2",
["sampler1DShadow"] = "keyword2",
["sampler2DShadow"] = "keyword2",
["samplerCubeShadow"] = "keyword2",
["sampler1DArray"] = "keyword2",
["sampler2DArray"] = "keyword2",
["samplerCubeArray"] = "keyword2",
["sampler1DArrayShadow"] = "keyword2",
["sampler2DArrayShadow"] = "keyword2",
["samplerCubeArrayShadow"]= "keyword2",
["isampler1D"] = "keyword2",
["isampler2D"] = "keyword2",
["isampler3D"] = "keyword2",
["isamplerCube"] = "keyword2",
["sampler2DMS"] = "keyword2",
["isampler2DMS"] = "keyword2",
["usampler2DMS"] = "keyword2",
["sampler2DMSArray"] = "keyword2",
["isampler2DMSArray"] = "keyword2",
["usampler2DMSArray"] = "keyword2",
["isampler1DArray"] = "keyword2",
["isampler2DArray"] = "keyword2",
["usampler1D"] = "keyword2",
["usampler2D"] = "keyword2",
["usampler3D"] = "keyword2",
["usamplerCube"] = "keyword2",
["usampler1DArray"] = "keyword2",
["usampler2DArray"] = "keyword2",
["sampler2DRect"] = "keyword2",
["sampler2DRectShadow"] = "keyword2",
["isampler2DRect"] = "keyword2",
["usampler2DRect"] = "keyword2",
["samplerBuffer"] = "keyword2",
["isamplerBuffer"] = "keyword2",
["usamplerBuffer"] = "keyword2",
["image1D"] = "keyword2",
["iimage1D"] = "keyword2",
["uimage1D"] = "keyword2",
["image1DArray"] = "keyword2",
["iimage1DArray"] = "keyword2",
["uimage1DArray"] = "keyword2",
["image2D"] = "keyword2",
["iimage2D"] = "keyword2",
["uimage2D"] = "keyword2",
["image2DArray"] = "keyword2",
["iimage2DArray"] = "keyword2",
["uimage2DArray"] = "keyword2",
["image2DRect"] = "keyword2",
["iimage2DRect"] = "keyword2",
["uimage2DRect"] = "keyword2",
["image2DMS"] = "keyword2",
["iimage2DMS"] = "keyword2",
["uimage2DMS"] = "keyword2",
["image2DMSArray"] = "keyword2",
["iimage2DMSArray"]= "keyword2",
["uimage2DMSArray"]= "keyword2",
["image3D"] = "keyword2",
["iimage3D"] = "keyword2",
["uimage3D"] = "keyword2",
["imageCube"] = "keyword2",
["iimageCube"] = "keyword2",
["uimageCube"] = "keyword2",
["imageCubeArray"] = "keyword2",
["iimageCubeArray"]= "keyword2",
["uimageCubeArray"]= "keyword2",
["imageBuffer"] = "keyword2",
["iimageBuffer"] = "keyword2",
["uimageBuffer"] = "keyword2",
["atomic_uint"] = "keyword2",
["radians"] = "keyword",
["degrees"] = "keyword",
["sin"] = "keyword",
["cos"] = "keyword",
["tan"] = "keyword",
["asin"] = "keyword",
["acos"] = "keyword",
["atan"] = "keyword",
["sinh"] = "keyword",
["cosh"] = "keyword",
["tanh"] = "keyword",
["asinh"] = "keyword",
["acosh"] = "keyword",
["pow"] = "keyword",
["exp"] = "keyword",
["exp2"] = "keyword",
["log2"] = "keyword",
["sqrt"] = "keyword",
["inversesqrt"] = "keyword",
["abs"] = "keyword",
["sign"] = "keyword",
["floor"] = "keyword",
["trunc"] = "keyword",
["round"] = "keyword",
["roundEven"] = "keyword",
["ceil"] = "keyword",
["fract"] = "keyword",
["mod"] = "keyword",
["modf"] = "keyword",
["min"] = "keyword",
["max"] = "keyword",
["clamp"] = "keyword",
["mix"] = "keyword",
["step"] = "keyword",
["smoothstep"] = "keyword",
["isnan"] = "keyword",
["isinf"] = "keyword",
["floatBitsToInt"] = "keyword",
["floatBitsToUint"] = "keyword",
["intBitsToFloat"] = "keyword",
["uintBitsToFloat"] = "keyword",
["fma"] = "keyword",
["frexp"] = "keyword",
["ldexp"] = "keyword",
["packUnorm2x16"] = "keyword",
["packSnorm2x16"] = "keyword",
["packUnorm4x8"] = "keyword",
["packSnorm4x8"] = "keyword",
["unpackUnorm2x16"] = "keyword",
["unpackSnorm2x16"] = "keyword",
["unpackUnorm4x8"] = "keyword",
["unpackSnorm4x8"] = "keyword",
["packHalf2x16"] = "keyword",
["unpackHalf2x16"] = "keyword",
["packDouble2x32"] = "keyword",
["unpackDouble2x32"] = "keyword",
["length"] = "keyword",
["distance"] = "keyword",
["dot"] = "keyword",
["cross"] = "keyword",
["normalize"] = "keyword",
["ftransform"] = "keyword",
["faceforward"] = "keyword",
["reflect"] = "keyword",
["refract"] = "keyword",
["matrixCompMult"] = "keyword",
["outerProduct"] = "keyword",
["transpose"] = "keyword",
["determinant"] = "keyword",
["inverse"] = "keyword",
["lessThan"] = "keyword",
["lessThanEqual"] = "keyword",
["greaterThan"] = "keyword",
["greaterThanEqual"] = "keyword",
["equal"] = "keyword",
["notEqual"] = "keyword",
["any"] = "keyword",
["all"] = "keyword",
["not"] = "keyword",
["uaddCarry"] = "keyword",
["usubBorrow"] = "keyword",
["umulExtended"] = "keyword",
["imulExtended"] = "keyword",
["bitfieldExtract"] = "keyword",
["bitfieldInsert"] = "keyword",
["bitfieldReverse"] = "keyword",
["bitCount"] = "keyword",
["findLSB"] = "keyword",
["findMSB"] = "keyword",
["textureSize"] = "keyword",
["textureQueryLod"] = "keyword",
["textureQueryLevels"] = "keyword",
["textureSamples"] = "keyword",
["texture"] = "keyword",
["textureProj"] = "keyword",
["textureLod"] = "keyword",
["textureOffset"] = "keyword",
["texelFetch"] = "keyword",
["texelFetchOffset"] = "keyword",
["textureProjOffset"] = "keyword",
["textureLodOffset"] = "keyword",
["textureProjLod"] = "keyword",
["textureProjLodOffset"] = "keyword",
["textureGrad"] = "keyword",
["textureGradOffset"] = "keyword",
["textureProjGrad"] = "keyword",
["textureProjGradOffset"]= "keyword",
["textureGather"] = "keyword",
["textureGatherOffset"] = "keyword",
["textureGatherOffsets"] = "keyword",
--Atomic Counter Functions
["atomicCounterIncrement"]= "keyword",
["atomicCounterDecrement"]= "keyword",
["atomicCounter"] = "keyword",
["atomicCounterAdd"] = "keyword",
["atomicCounterSubtract"] = "keyword",
["atomicCounterMin"] = "keyword",
["atomicCounterMax"] = "keyword",
["atomicCounterAnd"] = "keyword",
["atomicCounterOr"] = "keyword",
["atomicCounterXor"] = "keyword",
["atomicCounterExchange"] = "keyword",
["atomicCounterCompSwap"] = "keyword",
--Atomic Memory Functions
["atomicAdd"] = "keyword",
["atomicMin"] = "keyword",
["atomicMax"] = "keyword",
["atomicAnd"] = "keyword",
["atomicOr"] = "keyword",
["atomicXor"] = "keyword",
["atomicExchange"]= "keyword",
["atomicCompSwap"]= "keyword",
--Image Functions
["imageSize"] = "keyword",
["imageSamples"] = "keyword",
["imageLoad"] = "keyword",
["imageStore"] = "keyword",
["imageAtomicAdd"] = "keyword",
["imageAtomicMin"] = "keyword",
["imageAtomicMax"] = "keyword",
["imageAtomicAnd"] = "keyword",
["imageAtomicOr"] = "keyword",
["imageAtomicXor"] = "keyword",
["imageAtomicExchange"]= "keyword",
["imageAtomicCompSwap"]= "keyword",
--Geometry Shader Functions
["EmitStreamVertex"] = "keyword",
["EndStreamPrimitive"] = "keyword",
["EmitVertex"] = "keyword",
["EndPrimitive"] = "keyword",
--Fragment Processing Functions
["dFdx"] = "keyword",
["dFdy"] = "keyword",
["dFdxFine"] = "keyword",
["dFdyFine"] = "keyword",
["dFdxCoarse"] = "keyword",
["dFdyCoarse"] = "keyword",
["fwidth"] = "keyword",
["fwidthFine"] = "keyword",
["fwidthCoarse"] = "keyword",
["interpolateAtCentroid"]= "keyword",
["interpolateAtSample"] = "keyword",
["interpolateAtOffset"] = "keyword",
--Shader Invocation Control Functions
["barrier"] = "keyword",
--Shader Memory Control Functions
["memoryBarrier"] = "keyword",
["memoryBarrierAtomicCounter"]= "keyword",
["memoryBarrierBuffer"] = "keyword",
["memoryBarrierShared"] = "keyword",
["memoryBarrierImage"] = "keyword",
["groupMemoryBarrier"] = "keyword",
--Subpass-Input Functions
["subpassLoad"] = "keyword",
--Shader Invocation Group Functions
["anyInvocation"] = "keyword",
["allInvocations"] = "keyword",
["allInvocationsEqual"]= "keyword",
--"In addition, when targeting Vulkan, the following keywords also exist:"
["texture1D"] = "keyword",
["texture1DArray"] = "keyword",
["itexture1D"] = "keyword",
["itexture1DArray"] = "keyword",
["utexture1D"] = "keyword",
["utexture1DArray"] = "keyword",
["texture2D"] = "keyword",
["texture2DArray"] = "keyword",
["itexture2D"] = "keyword",
["itexture2DArray"] = "keyword",
["utexture2D"] = "keyword",
["utexture2DArray"] = "keyword",
["texture2DRect"] = "keyword",
["itexture2DRect"] = "keyword",
["utexture2DRect"] = "keyword",
["texture2DMS"] = "keyword",
["itexture2DMS"] = "keyword",
["utexture2DMS"] = "keyword",
["texture2DMSArray"] = "keyword",
["itexture2DMSArray"]= "keyword",
["utexture2DMSArray"]= "keyword",
["texture3D"] = "keyword",
["itexture3D"] = "keyword",
["utexture3D"] = "keyword",
["textureCube"] = "keyword",
["itextureCube"] = "keyword",
["utextureCube"] = "keyword",
["textureCubeArray"] = "keyword",
["itextureCubeArray"]= "keyword",
["utextureCubeArray"]= "keyword",
["textureBuffer"] = "keyword",
["itextureBuffer"] = "keyword",
["utextureBuffer"] = "keyword",
["sampler"] = "keyword2",
["samplerShadow"] = "keyword2",
["subpassInput"] = "keyword2",
["isubpassInput"] = "keyword2",
["usubpassInput"] = "keyword2",
["subpassInputMS"] = "keyword2",
["isubpassInputMS"] = "keyword2",
["usubpassInputMS"] = "keyword2",
},
}
+21
View File
@@ -0,0 +1,21 @@
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "Gemtext",
files = { "%.gmi$" },
patterns = {
{ pattern = { "```", "```" }, type = "string" },
{ pattern = "#.*", type = "keyword" },
{ pattern = "%*%s", type = "keyword2" },
{ pattern = "=>", type = "function" },
{ pattern = "https?://%S+", type = "literal" },
{ pattern = "gemini?://%S+", type = "literal" },
{ pattern = ">.*", type = "comment" },
{ pattern = ".*[>*#]", type = "normal" },
{ pattern = ".*=>", type = "normal" }
},
symbols = { },
}
+232
View File
@@ -0,0 +1,232 @@
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "Go",
files = { "%.go$" },
comment = "//",
block_comment = {"/*", "*/"},
patterns = {
{ pattern = "//.-\n", type = "comment" },
{ pattern = { "/%*", "%*/" }, type = "comment" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "`", "`", '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = "0[oO_][0-7]+i?", type = "number" },
{ pattern = "-?0x[%x_]+i?", type = "number" },
{ pattern = "-?%d+_%di?", type = "number" },
{ pattern = "-?%d+[%d%.eE]*f?i?", type = "number" },
{ pattern = "-?%.?%d+f?i?", type = "number" },
-- goto label
{ pattern = "^%s+()[%a_][%w%_]*()%s*:%s$", -- this is to fix `default:`
type = { "normal", "function", "normal" }
},
{ pattern = "^%s*[%a_][%w%_]*()%s*:%s$",
type = { "function", "normal" }
},
-- pointer, generic and reference type
{ pattern = "[%*~&]()[%a_][%w%_]*",
type = { "operator", "keyword2" }
},
-- slice type
{ pattern = "%[%]()[%a_][%w%_]*",
type = { "operator", "keyword2" }
},
-- type coerce
{
pattern = "%.%(()[%a_][%w_]*()%)",
type = { "normal", "keyword2", "normal" }
},
-- struct literal
{ pattern = "[%a_][%w%_]*()%s*{%s*",
type = { "keyword2", "normal" }
},
-- operators
{ pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" },
{ pattern = ":=", type = "operator" },
-- function calls
{ pattern = "func()%s*[%a_][%w_]*()%f[%[(]", -- function statement
type = {"keyword", "function", "normal"}
},
{ pattern = "[%a_][%w_]*%f[(]", type = "function" },
{ pattern = "%.()[%a_][%w_]*%f[(]",
type = { "normal", "function" }
},
-- type declaration
{ pattern = "type()%s+()[%a_][%w%_]*",
type = { "keyword", "normal", "keyword2" }
},
-- variable declaration
{ pattern = "var()%s+()[%a_][%w%_]*",
type = { "keyword", "normal", "symbol" }
},
-- goto
{ pattern = "goto()%s+()[%a_][%w%_]*",
type = { "keyword", "normal", "function" }
},
-- if fix
{ pattern = "if()%s+%f[%a_]",
type = { "keyword", "normal" }
},
-- for fix
{ pattern = "for()%s+%f[%a_]",
type = { "keyword", "normal" }
},
-- return fix
{ pattern = "return()%s+%f[%a_]",
type = { "keyword", "normal" }
},
-- range fix
{ pattern = "range()%s+%f[%a_]",
type = { "keyword", "normal" }
},
-- func fix
{ pattern = "func()%s+%f[%a_]",
type = { "keyword", "normal" }
},
-- switch fix
{ pattern = "switch()%s+%f[%a_]",
type = { "keyword", "normal" }
},
-- case fix
{ pattern = "case()%s+%f[%a_]",
type = { "keyword", "normal" }
},
-- break fix
{ pattern = "break()%s+%f[%a_]",
type = { "keyword", "normal" }
},
-- continue fix
{ pattern = "continue()%s+%f[%a_]",
type = { "keyword", "normal" }
},
-- package fix
{ pattern = "package()%s+%f[%a_]",
type = { "keyword", "normal" }
},
-- go fix
{ pattern = "go()%s+%f[%a_]",
type = { "keyword", "normal" }
},
-- chan fix
{ pattern = "chan()%s+%f[%a_]",
type = { "keyword", "normal" }
},
-- defer fix
{ pattern = "defer()%s+%f[%a_]",
type = { "keyword", "normal" }
},
-- field declaration
{ pattern = "[%a_][%w%_]*()%s*():%s*%f[%w%p]",
type = { "function", "normal", "operator" }
},
-- parameters or declarations
{ pattern = "[%a_][%w%_]*()%s+()[%*~&]?()[%a_][%w%_]*",
type = { "literal", "normal", "operator", "keyword2" }
},
{ pattern = "[%a_][%w_]*()%s+()%[%]()[%a_][%w%_]*",
type = { "literal", "normal", "normal", "keyword2" }
},
-- single return type
{
pattern = "%)%s+%(?()[%a_][%w%_]*()%)?%s+%{",
type = { "normal", "keyword2", "normal" }
},
-- sub fields
{ pattern = "%.()[%a_][%w_]*",
type = { "normal", "literal" }
},
-- every other symbol
{ pattern = "[%a_][%w_]*", type = "symbol" },
},
symbols = {
["if"] = "keyword",
["else"] = "keyword",
["elseif"] = "keyword",
["for"] = "keyword",
["continue"] = "keyword",
["return"] = "keyword",
["struct"] = "keyword",
["switch"] = "keyword",
["case"] = "keyword",
["default"] = "keyword",
["const"] = "keyword",
["package"] = "keyword",
["import"] = "keyword",
["func"] = "keyword",
["var"] = "keyword",
["type"] = "keyword",
["interface"] = "keyword",
["select"] = "keyword",
["break"] = "keyword",
["range"] = "keyword",
["chan"] = "keyword",
["defer"] = "keyword",
["go"] = "keyword",
["fallthrough"] = "keyword",
["goto"] = "keyword",
["iota"] = "keyword2",
["int"] = "keyword2",
["int64"] = "keyword2",
["int32"] = "keyword2",
["int16"] = "keyword2",
["int8"] = "keyword2",
["uint"] = "keyword2",
["uint64"] = "keyword2",
["uint32"] = "keyword2",
["uint16"] = "keyword2",
["uint8"] = "keyword2",
["uintptr"] = "keyword2",
["float64"] = "keyword2",
["float32"] = "keyword2",
["map"] = "keyword2",
["string"] = "keyword2",
["rune"] = "keyword2",
["bool"] = "keyword2",
["byte"] = "keyword2",
["error"] = "keyword2",
["complex64"] = "keyword2",
["complex128"] = "keyword2",
["true"] = "literal",
["false"] = "literal",
["nil"] = "literal",
},
}
syntax.add {
name = "Go",
files = { PATHSEP .. "go%.mod" },
comment = "//",
patterns = {
{ pattern = "//.-\n", type = "comment"},
{ pattern = "module() %S+()",
type = { "keyword", "string", "normal"}
},
{ pattern = "go() %S+()",
type = { "keyword", "string", "normal" }
},
{ pattern = "%S+() v%S+()",
type = { "string", "keyword", "normal" }
},
},
symbols = {
["require"] = "keyword",
["module"] = "keyword",
["go"] = "keyword",
}
}
syntax.add {
name = "Go",
files = { PATHSEP .. "go%.sum" },
patterns = {
{ pattern = "%S+() v[^/]-() h1:()%S+()=",
type = { "string", "keyword", "normal", "string", "normal" }
},
{ pattern = "%S+() v[^/]-()/%S+() h1:()%S+()=",
type = { "string", "keyword", "string", "normal", "string", "normal" }
},
},
symbols = {}
}
+42
View File
@@ -0,0 +1,42 @@
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "GraphQL",
files = { "%.graphql$", "%.gql$" },
comment = "#",
block_comment = { '"""', '"""' },
patterns = {
{ pattern = { '"""', '"""' }, type = "comment" },
{ pattern = "#.*", type = "comment" },
{ pattern = { '"', '"', "\\" }, type = "string" },
{ pattern = "-?%.?%d+", type = "number" },
{ pattern = "%s*[@]%s*[%a_][%w_]*", type = "function" },
{ pattern = "!", type = "operator" },
{ pattern = "%s*=%s*", type = "operator" },
{ pattern = "%s*%$[%a_][%w_]*:*", type = "literal" },
{ pattern = "query%s*()[%a_][%w_]*[(]", type = { "keyword", "function" } },
{ pattern = "mutation%s*()[%a_][%w_]*[(]", type = { "keyword", "function" } },
{ pattern = ":%s*%[*()[%a_,%s][%w_,%s]*()%]*()[!]*", type = { "symbol", "literal", "symbol", "operator" } },
},
symbols = {
["query"] = "keyword",
["mutation"] = "keyword",
["type"] = "keyword",
["interface"] = "keyword",
["input"] = "keyword",
["fragment"] = "keyword",
["directive"] = "keyword",
["extends"] = "keyword",
["implements"] = "keyword",
["on"] = "keyword",
["enum"] = "keyword",
["scalar"] = "keyword",
["union"] = "keyword",
["schema"] = "keyword",
["extend"] = "keyword2",
["true"] = "literal",
["false"] = "literal",
},
}
+98
View File
@@ -0,0 +1,98 @@
-- mod-version:3
local syntax = require 'core.syntax'
syntax.add {
name = "Gravity",
files = { "%.gravity$" },
comment = "//",
block_comment = {"/*", "*/"},
patterns = {
{ pattern = "#![^\n]+", type = "comment" },
{ pattern = "//[^\n]+", type = "comment" },
{ pattern = { "/%*", "%*/" }, type = "comment" },
{ pattern = { '"', '"', "\\" }, type = "string" },
{ pattern = "[~=!<>]=?", type = "operator" },
{ pattern = "[!=]==", type = "operator" },
{ pattern = "[%+%-%*/%%&|^]", type = "operator" },
{ pattern = "%.%.[%.<]", type = "operator" },
{ pattern = "0[bB][0-1]+%f[%D]", type = "number" },
{ pattern = "0[oO][0-7]+", type = "number" },
{ pattern = "0[xX]%x+", type = "number" },
{ pattern = "%.?%d+[eE]?%-?%d*", type = "number" },
{ pattern = "#%s*include%s*%f[\"]", type = "literal"},
{ pattern = "#%s*unittest%s*%f[{]", type = "literal"},
--{ pattern = "[%+%-%*/]%s*()%(", type = { "function", "normal" }},
{ pattern = "[%a_][%w_]+%s*%f[%(]", type = "function"},
{ pattern = "[%a_][%w_]*", type = "symbol" },
},
symbols = {
["true"] = "literal",
["false"] = "literal",
["null"] = "literal",
["self"] = "keyword2",
["Object"] = "literal",
["Int"] = "literal",
["Float"] = "literal",
["String"] = "literal",
["Bool"] = "literal",
["Null"] = "literal",
["Class"] = "literal",
["Function"] = "literal",
["Fiber"] = "literal",
["Instance"] = "literal",
["List"] = "literal",
["Map"] = "literal",
["Range"] = "literal",
["System"] = "literal",
["Math"] = "literal",
["File"] = "literal",
["ENV"] = "literal",
["if"] = "keyword",
["in"] = "keyword",
["or"] = "keyword",
["is"] = "operator",
["for"] = "keyword",
["var"] = "keyword",
["and"] = "keyword",
["not"] = "keyword",
["func"] = "keyword",
["else"] = "keyword",
["true"] = "keyword",
["enum"] = "keyword",
["case"] = "keyword",
["null"] = "keyword",
["file"] = "keyword",
["lazy"] = "keyword",
["super"] = "keyword",
["break"] = "keyword",
["while"] = "keyword",
["class"] = "keyword",
["const"] = "keyword",
["event"] = "keyword",
["_func"] = "keyword",
["_args"] = "keyword",
["struct"] = "keyword",
["repeat"] = "keyword",
["switch"] = "keyword",
["return"] = "keyword",
["public"] = "keyword",
["static"] = "keyword",
["extern"] = "keyword",
["import"] = "keyword",
["module"] = "keyword",
["default"] = "keyword",
["private"] = "keyword",
["continue"] = "keyword",
["internal"] = "keyword",
["undefined"] = "keyword",
}
}
+109
View File
@@ -0,0 +1,109 @@
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "Groovy",
files = { "%.groovy$", PATHSEP .. "Jenkinsfile$" },
comment = "//",
block_comment = { "/*", "*/" },
patterns = {
{ pattern = "//.*", type = "comment" }, -- Single-line comment
{ pattern = { "/%*", "%*/" }, type = "comment" }, -- Multi-line comment
{ pattern = { '"', '"', '\\' }, type = "string" }, -- String, double quotes
{ pattern = { "'", "'", '\\' }, type = "string" }, -- String, apices
{ pattern = { "%/", "%/", '\\' }, type = "string" }, -- Slashy string
{ pattern = { "%$%/", "%/%$", '\\' }, type = "string" }, -- Dollar slashy string
{ pattern = "'\\x%x?%x?%x?%x'", type = "string" }, -- character hexadecimal escape sequence
{ pattern = "'\\u%x%x%x%x'", type = "string" }, -- character unicode escape sequence
{ pattern = "'\\?.'", type = "string" }, -- character literal
{ pattern = "-?0x%x+", type = "number" }, -- ?
{ pattern = "-?%d+[%d%.eE]*[a-zA-Z]?", type = "number" }, -- ?
{ pattern = "-?%.?%d+", type = "number" }, -- ?
{ pattern = "-?[%d_+]+[a-zA-Z]?", type = "number" }, -- ?
{ pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" }, -- Operators
{ pattern = "[%a_][%w_]*%f[(]", type = "function" }, -- Function/Class/Method/...
{ pattern = "[%a_][%w_]*%f[%[]", type = "function" }, -- Custom Type
{ regex = "[A-Z]+_?[A-Z]+", type = "keyword2" }, -- Constants
{ pattern = "import()%s+()[%w_.]+", type = { "keyword", "normal", "normal" } },
{ pattern = "[%a_][%w_]*", type = "symbol" }, -- ?
{ pattern = "[a-zA-Z]+%.+", type = "function" }, -- Lib path
-- TODO: .class.
},
symbols = {
-- Reserved keywords
["abstract"] = "keyword",
["assert"] = "keyword",
["break"] = "keyword",
["case"] = "keyword",
["catch"] = "keyword",
["class"] = "keyword",
["const"] = "keyword",
["continue"] = "keyword",
["def"] = "keyword",
["default"] = "keyword",
["do"] = "keyword",
["else"] = "keyword",
["enum"] = "keyword",
["extends"] = "keyword",
["final"] = "keyword",
["finally"] = "keyword",
["for"] = "keyword",
["goto"] = "keyword",
["if"] = "keyword",
["implements"] = "keyword",
["import"] = "keyword",
["instanceof"] = "keyword",
["interface"] = "keyword",
["native"] = "keyword",
["new"] = "keyword",
["non-sealed"] = "keyword",
["package"] = "keyword",
["public"] = "keyword",
["protected"] = "keyword",
["private"] = "keyword",
["return"] = "keyword",
["static"] = "keyword",
["strictfp"] = "keyword",
["super"] = "keyword",
["switch"] = "keyword",
["synchronizedthis"] = "keyword",
["threadsafe"] = "keyword",
["throw"] = "keyword",
["throws"] = "keyword",
["transient"] = "keyword",
["try"] = "keyword",
["while"] = "keyword",
-- Contextual keywords
["as"] = "keyword",
["in"] = "keyword",
["permitsrecord"] = "keyword",
["sealed"] = "keyword",
["trait"] = "keyword",
["var"] = "keyword",
["yields"] = "keyword",
-- ?
["true"] = "literal",
["false"] = "literal",
["null"] = "literal",
["boolean"] = "literal",
-- Types
["char"] = "keyword",
["byte"] = "keyword",
["short"] = "keyword",
["int"] = "keyword",
["long"] = "keyword",
["float"] = "keyword",
["double"] = "keyword",
["Integer"] = "keyword",
["BigInteger"] = "keyword",
["Long"] = "keyword",
["Float"] = "keyword",
["BigDecimal"] = "keyword",
["Double"] = "keyword",
["String"] = "keyword",
},
}
+91
View File
@@ -0,0 +1,91 @@
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "Hare",
files = { "%.ha$" },
comment = "//",
patterns = {
{ pattern = "//.*", type = "comment" },
-- { pattern = { "/%*", "%*/" }, type = "comment" },
{ 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_]*%f[(]", type = "function" },
{ pattern = "[%a_][%w_]*", type = "symbol" },
{ pattern = "^@", type = "keyword" },
},
symbols = {
["export"] = "keyword",
["fn"] = "keyword",
["use"] = "keyword",
["const"] = "keyword",
["let"] = "keyword",
["defer"] = "keyword",
["static"] = "keyword",
["yield"] = "keyword",
["case"] = "keyword",
["match"] = "keyword",
["return"] = "keyword",
["switch"] = "keyword",
["for"] = "keyword",
["if"] = "keyword",
["type"] = "keyword",
["abort"] = "keyword",
["align"] = "keyword",
["alloc"] = "keyword",
["break"] = "keyword",
["continue"] = "keyword",
["def"] = "keyword",
["delete"] = "keyword",
["else"] = "keyword",
["free"] = "keyword",
["insert"] = "keyword",
["is"] = "keyword",
["len"] = "keyword",
["offset"] = "keyword",
["vaarg"] = "keyword",
["vaend"] = "keyword",
["vastart"] = "keyword",
["fini"] = "keyword",
["init"] = "keyword",
["test"] = "keyword",
["nullable"] = "keyword2",
["str"] = "keyword2",
["void"] = "keyword2",
["int"] = "keyword2",
["uint"] = "keyword2",
["struct"] = "keyword2",
["union"] = "keyword2",
["enum"] = "keyword2",
["u8"] = "keyword2",
["u16"] = "keyword2",
["u32"] = "keyword2",
["u64"] = "keyword2",
["i8"] = "keyword2",
["i16"] = "keyword2",
["i32"] = "keyword2",
["i64"] = "keyword2",
["f32"] = "keyword2",
["f64"] = "keyword2",
["size"] = "keyword2",
["rune"] = "keyword2",
["bool"] = "keyword2",
["valist"] = "keyword2",
["uintptr"] = "keyword2",
["rconst"] = "keyword2",
["fconst"] = "keyword2",
["iconst"] = "keyword2",
["fmt"] = "literal",
["true"] = "literal",
["false"] = "literal",
["signed"] = "literal",
["unsigned"] = "literal",
["null"] = "literal",
},
}
+113
View File
@@ -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",
},
}
+277
View File
@@ -0,0 +1,277 @@
-- mod-version:3
local style = require "core.style"
local common = require "core.common"
local syntax = require "core.syntax"
syntax.add {
name = "HLSL",
files = { "%.hlsl$", },
comment = "//",
patterns = {
{ pattern = "//.-\n", type = "comment" },
{ pattern = { "/%*", "%*/" }, type = "comment" },
{ pattern = { "#", "[^\\]\n" }, type = "comment" },
{ 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 = "int[1-9]x[1-9]", type = "keyword2" },
{ pattern = "int1[0-6]x[1-9]", type = "keyword2" },
{ pattern = "int[1-9]x1[0-6]", type = "keyword2" },
{ pattern = "int1[0-6]x1[0-6]", type = "keyword2" },
{ pattern = "int[1-4]", type = "keyword2" },
{ pattern = "uint[1-9]x[1-9]", type = "keyword2" },
{ pattern = "uint1[0-6]x[1-9]", type = "keyword2" },
{ pattern = "uint[1-9]x1[0-6]", type = "keyword2" },
{ pattern = "uint1[0-6]x1[0-6]", type = "keyword2" },
{ pattern = "uint[1-4]", type = "keyword2" },
{ pattern = "dword[1-9]x[1-9]", type = "keyword2" },
{ pattern = "dword1[0-6]x[1-9]", type = "keyword2" },
{ pattern = "dword[1-9]x1[0-6]", type = "keyword2" },
{ pattern = "dword1[0-6]x1[0-6]", type = "keyword2" },
{ pattern = "dword[1-4]", type = "keyword2" },
{ pattern = "half[1-9]x[1-9]", type = "keyword2" },
{ pattern = "half1[0-6]x[1-9]", type = "keyword2" },
{ pattern = "half[1-9]x1[0-6]", type = "keyword2" },
{ pattern = "half1[0-6]x1[0-6]", type = "keyword2" },
{ pattern = "half[1-4]", type = "keyword2" },
{ pattern = "float[1-9]x[1-9]", type = "keyword2" },
{ pattern = "float1[0-6]x[1-9]", type = "keyword2" },
{ pattern = "float[1-9]x1[0-6]", type = "keyword2" },
{ pattern = "float1[0-6]x1[0-6]", type = "keyword2" },
{ pattern = "float[1-4]", type = "keyword2" },
{ pattern = "double[1-9]x[1-9]", type = "keyword2" },
{ pattern = "double1[0-6]x[1-9]", type = "keyword2" },
{ pattern = "double[1-9]x1[0-6]", type = "keyword2" },
{ pattern = "double1[0-6]x1[0-6]", type = "keyword2" },
{ pattern = "double[1-4]", type = "keyword2" },
{ pattern = "[%a_][%w_]*%f[(]", type = "function" },
{ pattern = "[%a_][%w_]*", type = "symbol" },
},
symbols = {
--https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-appendix-keywords
--The symbols are added in the order they appear on this webpage, which is alphabetically
["AppendStructuredBuffer"]= "keyword",
["asm"] = "keyword",
["asm_fragment"] = "keyword",
["BlendState"] = "keyword2",
["bool"] = "keyword2",
["break"] = "keyword",
["Buffer"] = "keyword2",
["ByteAddressBuffer"]= "keyword2",
["case"] = "keyword",
["cbuffer"] = "keyword2",
["centroid"] = "keyword2",
["class"] = "keyword",
["column_major"] = "keyword",
["compile"] = "keyword",
["compile_fragment"] = "keyword",
["CompileShader"] = "keyword",
["const"] = "keyword",
["continue"] = "keyword",
["ComputeShader"] = "keyword",
["ConsumeStructuredBuffer"]= "keyword",
["default"] = "keyword",
["DepthStencilState"]= "keyword",
["DepthStencilView"] = "keyword",
["discard"] = "keyword",
["do"] = "keyword",
["double"] = "keyword2",
["DomainShader"] = "keyword2",
["dword"] = "keyword2",
["else"] = "keyword",
["export"] = "keyword",
["extern"] = "keyword",
["false"] = "literal",
["float"] = "keyword2",
["for"] = "keyword",
["fxgroup"] = "keyword2",
["GeometryShader"] = "keyword2",
["groupshared"] = "keyword",
["half"] = "keyword2",
["HullShader"] = "keyword2",
["if"] = "keyword",
["in"] = "keyword",
["inline"] = "keyword",
["inout"] = "keyword",
["InputPatch"] = "keyword2",
["int"] = "keyword2",
["interface"] = "keyword",
["line"] = "keyword2",
["lineadj"] = "keyword2",
["linear"] = "keyword",
["LineStream"] = "keyword2",
["matrix"] = "keyword2",
["min16float"] = "keyword2",
["min10float"] = "keyword2",
["min16int"] = "keyword2",
["min12int"] = "keyword2",
["min16uint"] = "keyword2",
["namespace"] = "keyword",
["nointerpolation"] = "keyword",
["noperspective"] = "keyword",
["NULL"] = "literal",
["out"] = "keyword",
["OutputPatch"] = "keyword2",
["packoffset"] = "keyword",
["pass"] = "keyword",
["pixelfragment"] = "keyword",
["PixelShader"] = "keyword2",
["point"] = "keyword2",
["PointStream"] = "keyword2",
["precise"] = "keyword",
["RasterizerState"] = "keyword2",
["RenderTargetView"] = "keyword2",
["return"] = "keyword",
["register"] = "keyword",
["row_major"] = "keyword",
["RWBuffer"] = "keyword2",
["RWByteAddressBuffer"]= "keyword2",
["RWStructuredBuffer"]= "keyword2",
["RWTexture1D"] = "keyword2",
["RWTexture1DArray"] = "keyword2",
["RWTexture2D"] = "keyword2",
["RWTexture2DArray"] = "keyword2",
["RWTexture3D"] = "keyword2",
["sample"] = "keyword",
["sampler"] = "keyword2",
["SamplerState"] = "keyword2",
["SamplerComparisonState"]= "keyword2",
["shared"] = "keyword",
["snorm"] = "keyword",
["stateblock"] = "keyword",
["stateblock_state"] = "keyword",
["static"] = "keyword",
["string"] = "keyword2",
["struct"] = "keyword",
["switch"] = "keyword",
["StructuredBuffer"] = "keyword2",
["tbuffer"] = "keyword2",
["technique"] = "keyword2",
["technique10"] = "keyword2",
["technique11"] = "keyword2",
["texture"] = "keyword2",
["Texture1D"] = "keyword2",
["Texture1DArray"] = "keyword2",
["Texture2D"] = "keyword2",
["Texture2DArray"] = "keyword2",
["Texture2DMS"] = "keyword2",
["Texture2DMSArray"] = "keyword2",
["Texture3D"] = "keyword2",
["TextureCube"] = "keyword2",
["TextureCubeArray"] = "keyword2",
["true"] = "literal",
["typedef"] = "keyword",
["triangle"] = "keyword2",
["triangleadj"] = "keyword2",
["TriangleStream"] = "keyword2",
["uint"] = "keyword2",
["uniform"] = "keyword",
["unorm"] = "keyword",
["unsigned"] = "keyword",
["vector"] = "keyword2",
["vertexfragment"] = "keyword2",
["VertexShader"] = "keyword2",
["void"] = "keyword",
["volatile"] = "keyword",
["while"] = "keyword",
--https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-intrinsic-functions
--The symbols are added in the order they appear on this webpage, which is alphabetically
["abort"] = "keyword",
["abs"] = "keyword",
["acos"] = "keyword",
["all"] = "keyword",
["any"] = "keyword",
["asdouble"] = "keyword",
["asfloat"] = "keyword",
["asin"] = "keyword",
["asint"] = "keyword",
["asuint"] = "keyword",
["atan"] = "keyword",
["atan2"] = "keyword",
["ceil"] = "keyword",
["clamp"] = "keyword",
["clip"] = "keyword",
["cos"] = "keyword",
["cosh"] = "keyword",
["countbits"] = "keyword",
["cross"] = "keyword",
["ddx"] = "keyword",
["ddx_coarse"] = "keyword",
["ddx_fine"] = "keyword",
["ddy"] = "keyword",
["ddy_coarse"] = "keyword",
["ddy_fine"] = "keyword",
["degrees"] = "keyword",
["determinant"] = "keyword",
["distance"] = "keyword",
["dot"] = "keyword",
["dst"] = "keyword",
["errorf"] = "keyword",
["exp"] = "keyword",
["exp2"] = "keyword",
["f16tof32"] = "keyword",
["f32tof16"] = "keyword",
["faceforward"] = "keyword",
["firstbithigh"]= "keyword",
["firstbitlow"] = "keyword",
["floor"] = "keyword",
["fma"] = "keyword",
["fmod"] = "keyword",
["frac"] = "keyword",
["frexp"] = "keyword",
["fwidth"] = "keyword",
["isfinite"] = "keyword",
["isinf"] = "keyword",
["isnan"] = "keyword",
["ldexp"] = "keyword",
["length"] = "keyword",
["lerp"] = "keyword",
["lit"] = "keyword",
["log"] = "keyword",
["log10"] = "keyword",
["log2"] = "keyword",
["mad"] = "keyword",
["max"] = "keyword",
["min"] = "keyword",
["modf"] = "keyword",
["msad4"] = "keyword",
["mul"] = "keyword",
["noise"] = "keyword",
["normalize"] = "keyword",
["pow"] = "keyword",
["printf"] = "keyword",
["radians"] = "keyword",
["rcp"] = "keyword",
["reflect"] = "keyword",
["refract"] = "keyword",
["reversebits"] = "keyword",
["round"] = "keyword",
["rsqrt"] = "keyword",
["saturate"] = "keyword",
["sign"] = "keyword",
["sin"] = "keyword",
["sincos"] = "keyword",
["sinh"] = "keyword",
["smoothstep"] = "keyword",
["sqrt"] = "keyword",
["step"] = "keyword",
["tan"] = "keyword",
["tanh"] = "keyword",
["transpose"] = "keyword",
["trunc"] = "keyword",
},
}
+48
View File
@@ -0,0 +1,48 @@
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "Haskell",
files = { "%.hs$" },
comment = "--",
block_comment = {"{-", "-}"},
patterns = {
{ pattern = "%-%-.*", type = "comment" },
{ pattern = { "{%-", "%-}" }, type = "comment" },
{ 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 = "symbol" },
},
symbols = {
["as"] = "keyword",
["case"] = "keyword",
["of"] = "keyword",
["class"] = "keyword",
["data"] = "keyword",
["default"] = "keyword",
["deriving"] = "keyword",
["do"] = "keyword",
["forall"] = "keyword",
["foreign"] = "keyword",
["hiding"] = "keyword",
["if"] = "keyword",
["then"] = "keyword",
["else"] = "keyword",
["import"] = "keyword",
["infix"] = "keyword",
["infixl"] = "keyword",
["infixr"] = "keyword",
["let"] = "keyword",
["in"] = "keyword",
["mdo"] = "keyword",
["module"] = "keyword",
["newtype"] = "keyword",
["qualified"] = "keyword",
["type"] = "keyword",
["where"] = "keyword",
},
}
+212
View File
@@ -0,0 +1,212 @@
-- mod-version:3
local syntax = require "core.syntax"
local keywords = {
"AcceptFilter", "AcceptMutex", "AcceptPathInfo", "AccessFileName", "Action", "AddAlt",
"AddAltByEncoding", "AddAltByType", "AddCharset", "AddDefaultCharset", "AddDescription",
"AddEncoding", "AddHandler", "AddIcon", "AddIconByType", "AddIconByEncoding", "AddIconByEncoding",
"AddIconByType", "AddInputFilter", "AddLanguage", "AddModuleInfo", "AddOutputFilterByType",
"AddOutputFilter", "AddOutputFilterByType", "AddType", "Alias", "ScriptAlias", "ServerAlias",
"AliasMatch", "Allow", "AllowOverride", "AllowEncodedSlashes", "_ROUTING__allow_GET",
"_ROUTING__allow_HEAD", "_ROUTING__allow_POST", "Allow", "AllowOverride", "AllowEncodedSlashes",
"AllowCONNECT", "AllowEncodedSlashes", "AllowMethods", "AllowOverride", "AllowOverrideList",
"Anonymous", "Anonymous_LogEmail", "Anonymous_NoUserID", "Anonymous_Authoritative",
"Anonymous_LogEmail", "Anonymous_MustGiveEmail", "Anonymous_NoUserId", "Anonymous_VerifyEmail",
"AssignUserID", "AsyncRequestWorkerFactor", "AuthAuthoritative", "AuthBasicAuthoritative",
"AuthBasicFake", "AuthBasicProvider", "AuthBasicUseDigestAlgorithm", "AuthDBDUserPWQuery",
"AuthDBDUserRealmQuery", "AuthDBMAuthoritative", "AuthDBMGroupFile", "AuthDBMType",
"AuthDBMUserFile", "AuthDefaultAuthoritative", "AuthDigestAlgorithm", "AuthDigestDomain",
"AuthDigestFile", "AuthDigestGroupFile", "AuthDigestNcCheck", "AuthDigestNonceFormat",
"AuthDigestNonceLifetime", "AuthDigestProvider", "AuthDigestQop", "AuthDigestShmemSize",
"AuthFormAuthoritative", "AuthFormBody", "AuthFormDisableNoStore", "AuthFormFakeBasicAuth",
"AuthFormLocation", "AuthFormLoginRequiredLocation", "AuthFormLoginSuccessLocation",
"AuthFormLogoutLocation", "AuthFormMethod", "AuthFormMimetype", "AuthFormPassword",
"AuthFormProvider", "AuthFormSitePassphrase", "AuthFormSize", "AuthFormUsername", "AuthGroupFile",
"AuthLDAPAuthoritative", "AuthLDAPAuthorizePrefix", "AuthLDAPAuthzEnabled",
"AuthLDAPBindAuthoritative", "AuthLDAPBindDN", "AuthLDAPBindPassword", "AuthLDAPCharsetConfig",
"AuthLDAPCompareAsUser", "AuthLDAPCompareDNOnServer", "AuthLDAPDereferenceAliases",
"AuthLDAPEnabled", "AuthLDAPFrontPageHack", "AuthLDAPGroupAttribute", "AuthLDAPGroupAttributeIsDN",
"AuthLDAPGroupAttributeIsDN", "AuthLDAPInitialBindAsUser", "AuthLDAPInitialBindPattern",
"AuthLDAPMaxSubGroupDepth", "AuthLDAPRemoteUserAttribute", "AuthLDAPRemoteUserIsDN",
"AuthLDAPSearchAsUser", "AuthLDAPSubGroupAttribute", "AuthLDAPSubGroupClass", "AuthLDAPURL",
"AuthMerging", "AuthName", "AuthnCacheContext", "AuthnCacheEnable", "AuthnCacheProvideFor",
"AuthnCacheProvider", "AuthnCacheSOCache", "AuthnCacheTimeout", "AuthnzFcgiCheckAuthnProvider",
"AuthnzFcgiDefineProvider", "AuthType", "AuthUserFile", "AuthzDBDLoginToReferer", "AuthzDBDQuery",
"AuthzDBDRedirectQuery", "AuthzDBMAuthoritative", "AuthzDBMType", "AuthzDefaultAuthoritative",
"AuthzGroupFileAuthoritative", "AuthzLDAPAuthoritative", "AuthzOwnerAuthoritative",
"AuthzSendForbiddenOnFailure", "AuthzUserAuthoritative", "BalancerGrowth", "BalancerInherit",
"BalancerMember", "BalancerNonce", "BalancerPersist", "BrowserMatch", "BrowserMatchNoCase",
"BrowserMatchNoCase", "BS2000Account", "BufferedLogs", "DeflateBufferSize", "BufferSize",
"CacheDefaultExpire", "CacheDetailHeader", "CacheDirLength", "CacheDirLevels", "CacheDisable",
"CacheEnable", "CacheExpiryCheck", "cachefile", "CacheForceCompletion", "CacheGcClean",
"CacheGcDaily", "CacheGcInterval", "CacheGcMemUsage", "CacheGcUnused", "CacheHeader",
"CacheIgnoreCacheControl", "CacheIgnoreHeaders", "CacheIgnoreNoLastMod", "CacheIgnoreQueryString",
"CacheIgnoreURLSessionIdentifiers", "CacheKeyBaseURL", "CacheLastModifiedFactor", "CacheLock",
"CacheLockMaxAge", "CacheLockPath", "CacheMaxExpire", "CacheMaxFileSize", "CacheMinExpire",
"CacheMinFileSize", "CacheNegotiatedDocs", "CacheQuickHandler", "CacheReadSize", "CacheReadTime",
"CacheRoot", "MCacheSize", "CacheSocache", "CacheSocacheMaxSize", "CacheSocacheMaxTime",
"CacheSocacheMinTime", "CacheSocacheReadSize", "CacheSocacheReadTime", "CacheStaleOnError",
"CacheStoreExpired", "CacheStoreNoStore", "CacheStorePrivate", "CacheTimeMargin", "CaseFilter",
"CaseFilterIn", "CGIDScriptTimeout", "CGIMapExtension", "CGIPassAuth", "CGIVar", "CharsetDefault",
"CharsetOptions", "CharsetSourceEnc", "CheckCaseOnly", "CheckSpelling", "ChildperUserID", "ChrootDir",
"ClientRecheckTime", "ContentDigest", "CookieDomain", "CookieExpires", "CookieLog", "CookieName",
"CookieStyle", "CookieTracking", "CoreDumpDirectory", "CustomLog", "DAV", "DAVDepthInfinity",
"DAVGenericLockDB", "DAVLockDB", "DAVMinTimeout", "DBDExptime", "DBDInitSQL", "DBDKeep", "DBDMax",
"DBDMin", "DBDParams", "DBDPersist", "DBDPrepareSQL", "DBDriver", "DefaultIcon", "DefaultLanguage",
"DefaultRuntimeDir", "DefaultType", "Define", "DeflateBufferSize", "DeflateCompressionLevel",
"DeflateFilterNote", "DeflateInflateLimitRequestBody", "DeflateInflateRatioBurst",
"DeflateInflateRatioLimit", "DeflateMemLevel", "DeflateWindowSize", "Deny", "Deny", "DirectoryIndex",
"DirectorySlash", "DirectoryCheckHandler", "DirectoryIndex", "DirectoryIndexRedirect", "DirectoryMatch",
"DirectorySlash", "VirtualDocumentRoot", "DocumentRoot", "DTracePrivileges", "DumpIOInput",
"DumpIOLogLevel", "DumpIOOutput", "EnableExceptionHook", "EnableMMAP", "EnableSendfile", "ErrorDocument",
"ErrorLog", "ErrorLogFormat", "ExpiresActive", "ExpiresByType", "ExpiresDefault", "ExtendedStatus",
"ExtFilterDefine", "ExtFilterOptions", "FallbackResource", "FancyIndexing", "FileETag", "Files",
"FilesMatch", "FilterChain", "FilterDeclare", "FilterProtocol", "FilterProvider", "FilterTrace",
"ForceLanguagePriority", "ForceType", "ForensicLog", "GlobalLog", "GprofDir", "AuthGroupFile", "Group",
"AuthDBMGroupFile", "AuthLDAPGroupAttribute", "AuthLDAPGroupAttributeIsDN", "AuthzGroupFileAuthoritative",
"H2AltSvc", "H2AltSvcMaxAge", "H2Direct", "H2MaxSessionStreams", "H2MaxWorkerIdleSeconds", "H2MaxWorkers",
"H2MinWorkers", "H2ModernTLSOnly", "H2Push", "H2PushDiarySize", "H2PushPriority", "H2SerializeHeaders",
"H2SessionExtraFiles", "H2StreamMaxMemSize", "H2TLSCoolDownSecs", "H2TLSWarmUpSize", "H2Upgrade",
"H2WindowSize", "Header", "RequestHeader", "HeaderName", "HeaderName", "HeartbeatAddress",
"HeartbeatListen", "HeartbeatMaxServers", "HeartbeatStorage", "HostnameLookups", "IdentityCheck",
"IdentityCheckTimeout", "IfDefine", "IfModule", "IfVersion", "ImapBase", "ImapDefault", "ImapMenu",
"Include", "IncludeOptional", "IndexHeadInsert", "IndexIgnore", "IndexIgnoreReset", "IndexOptions",
"IndexOrderDefault", "IndexStyleSheet", "InputSed", "ISAPIAppendLogToErrors", "ISAPIAppendLogToQuery",
"ISAPICacheFile", "ISAPIFakeAsync", "ISAPILogNotSupported", "ISAPIReadAheadBuffer", "KeepAlive",
"KeepAliveTimeout", "MaxKeepAliveRequests", "KeepAliveTimeout", "KeptBodySize", "LanguagePriority",
"ForceLanguagePriority", "LDAPCacheEntries", "LDAPCacheTTL", "LDAPConnectionPoolTTL",
"LDAPConnectionTimeout", "LDAPLibraryDebug", "LDAPOpCacheEntries", "LDAPOpCacheTTL", "LDAPReferralHopLimit",
"LDAPReferrals", "LDAPRetries", "LDAPRetryDelay", "LDAPSharedCacheFile", "LDAPSharedCacheSize",
"LDAPTimeout", "LDAPTrustedCA", "LDAPTrustedCAType", "LDAPTrustedClientCert", "LDAPTrustedGlobalCert",
"LDAPTrustedMode", "LDAPVerifyServerCert", "LimitRequestBody", "RLimitMEM", "LimitRequestFields",
"LimitRequestFieldSize", "LimitRequestLine", "LimitExcept", "LimitInternalRecursion", "LimitRequestBody",
"LimitRequestFields", "LimitRequestFieldsize", "LimitRequestLine", "LimitXMLRequestBody", "LoadFile",
"LoadModule", "Location", "LocationMatch", "LockFile", "LogFormat", "LogIOTrackTTFB", "RewriteLogLevel",
"LogLevel", "LogMessage", "LuaAuthzProvider", "Lua_____ByteCodeHack", "LuaCodeCache", "LuaHookAccessChecker",
"LuaHookAuthChecker", "LuaHookCheckUserID", "LuaHookFixups", "LuaHookInsertFilter", "LuaHookLog",
"LuaHookMapToStorage", "LuaHookTranslateName", "LuaHookTypeChecker", "LuaInherit", "LuaInputFilter",
"LuaMapHandler", "LuaOutputFilter", "LuaPackageCPath", "LuaPackagePath", "LuaQuickHandler", "LuaRoot",
"LuaScope", "MaxClientConnections", "MaxClients", "MaxConnectionsPerChild", "MaxKeepAliveRequests",
"MaxMemFree", "MaxRangeOverlaps", "MaxRangeReversals", "MaxRanges", "MaxRequestsPerChild",
"MaxRequestsPerThread", "MaxRequestWorkers", "MaxSpareServers", "MaxSpareThreads", "MaxThreads",
"MaxThreadsPerChild", "MCacheMaxObjectCount", "MCacheMaxObjectSize", "MCacheMaxStreamingBuffer",
"MCacheMinObjectSize", "MCacheRemovalAlgorithm", "MCacheSize", "MemcacheConnTTL", "MergeTrailers",
"MetaDir", "MetaFiles", "MetaSuffix", "MimeMagicFile", "MinSpareServers", "MinSpareThreads", "mmapfile",
"ModemStandard", "ModMimeUsePathInfo", "MultiviewsMatch", "Mutex", "NameVirtualHost", "NoProxy",
"NumServers", "NWSSLTrustedCerts", "NWSSLUpgradeable", "Options", "RewriteOptions", "IndexOptions",
"Order", "IndexOrderDefault", "Order", "IndexOrderDefault", "OutputSed", "PassEnv", "php_admin_flag",
"php_admin_value", "php_flag", "php_value", "PidFile", "Port", "PrivilegesMode", "FilterProtocol",
"Protocol", "ProtocolEcho", "Protocols", "ProtocolsHonorOrder", "ProxyPass", "ProxyPassMatch",
"ProxyPassReverse", "ProxyRequests", "ProxyAddHeaders", "ProxyBadHeader", "ProxyBlock", "ProxyDomain",
"ProxyErrorOverride", "ProxyExpressDBMFile", "ProxyExpressDBMType", "ProxyExpressEnable",
"ProxyFtpDirCharset", "ProxyFtpEscapeWildcards", "ProxyFtpListOnWildcard", "ProxyHCExpr", "ProxyHCTemplate",
"ProxyHCTPsize", "ProxyHTMLBufSize", "ProxyHTMLCharsetOut", "ProxyHTMLDoctype", "ProxyHTMLEnable",
"ProxyHTMLEvents", "ProxyHTMLExtended", "ProxyHTMLFixups", "ProxyHTMLInterp", "ProxyHTMLLinks",
"ProxyHTMLMeta", "ProxyHTMLStripComments", "ProxyHTMLURLMap", "ProxyIOBufferSize", "ProxyMatch",
"ProxyMaxForwards", "ProxyPass", "ProxyPassMatch", "ProxyPassReverse", "ProxyPassInherit",
"ProxyPassInterpolateEnv", "ProxyPassMatch", "ProxyPassReverse", "ProxyPassReverseCookieDomain",
"ProxyPassReverseCookiePath", "ProxyPreserveHost", "ProxyReceiveBufferSize", "ProxyRemote",
"ProxyRemoteMatch", "ProxyRequests", "ProxySCGIInternalRedirect", "ProxySCGISendfile", "ProxySet",
"ProxySourceAddress", "ProxyStatus", "ProxyTimeout", "ProxyVia", "QualifyRedirectURL", "ReadmeName",
"Redirect", "RedirectMatch", "RedirectTemp", "RedirectPermanent", "RedirectMatch", "RedirectPermanent",
"RedirectTemp", "ReflectorHeader", "RemoteIPHeader", "RemoteIPInternalProxy", "RemoteIPInternalProxyList",
"RemoteIPProxiesHeader", "RemoteIPTrustedProxy", "RemoteIPTrustedProxyList", "RemoveCharset",
"RemoveEncoding", "RemoveHandler", "RemoveInputFilter", "RemoveLanguage", "RemoveOutputFilter", "RemoveType",
"RequestHeader", "RequestReadTimeout", "RequestTimeout", "Require", "RewriteBase", "RewriteCond",
"RewriteEngine", "RewriteLock", "RewriteLog", "RewriteLogLevel", "RewriteLogLevel", "RewriteMap",
"RewriteOptions", "RewriteRule", "RLimitCPU", "RLimitMEM", "RLimitNPROC", "Satisfy", "ScoreboardFile",
"ScoreBoardFile", "Script", "ScriptAlias", "ScriptAlias", "ScriptAliasMatch", "ScriptInterpreterSource",
"ScriptLog", "ScriptLogBuffer", "ScriptLogLength", "Scriptsock", "ScriptSock", "SecureListen",
"SeeRequestTail", "SerfCluster", "SerfPass", "ServerAdmin", "ServerAlias", "ServerLimit", "ServerName",
"ServerPath", "ServerRoot", "ServerSignature", "ServerTokens", "Session", "SessionCookieName",
"SessionCookieName2", "SessionCookieRemove", "SessionCryptoCipher", "SessionCryptoDriver",
"SessionCryptoPassphrase", "SessionCryptoPassphraseFile", "SessionDBDCookieName", "SessionDBDCookieName2",
"SessionDBDCookieRemove", "SessionDBDDeleteLabel", "SessionDBDInsertLabel", "SessionDBDPerUser",
"SessionDBDSelectLabel", "SessionDBDUpdateLabel", "SessionEnv", "SessionExclude", "SessionHeader",
"SessionInclude", "SessionMaxAge", "SetEnvIfNoCase", "SetEnv", "SetEnvIf", "SetEnvIfNoCase", "SetEnvIf",
"SetEnvIfExpr", "SetEnvIfNoCase", "SetHandler", "SetInputFilter", "SetOutputFilter", "SimpleProcCount",
"SimpleThreadCount", "SSIAccessEnable", "SSIEndTag", "SSIErrorMsg", "SSIEtag", "SSILastModified",
"SSILegacyExprParser", "SSIStartTag", "SSITimeFormat", "SSIUndefinedEcho", "SSLLog", "SSLLogLevel",
"StartServers", "StartThreads", "Substitute", "SubstituteInheritBefore", "SubstituteMaxLineLength",
"Suexec", "SuexecUserGroup", "ThreadLimit", "ThreadsPerChild", "ThreadStackSize", "KeepAliveTimeout",
"AuthnCacheTimeout", "TraceEnable", "TransferLog", "TrustedProxy", "TypesConfig", "UnDefine", "UnsetEnv",
"UseCanonicalName", "UseCanonicalPhysicalPort", "User", "AuthUserFile", "UserDir", "AuthDBMUserFile",
"Anonymous_NoUserID", "UserDir", "VHostCGIMode", "VHostCGIPrivs", "VHostGroup", "VHostPrivs", "VHostSecure",
"VHostUser", "VirtualDocumentRoot", "VirtualDocumentRootIP", "VirtualHost", "VirtualScriptAlias",
"VirtualScriptAliasIP", "Win32DisableAcceptEx", "XBitHack", "xml2EncAlias", "xml2EncDefault",
"xml2StartParse", "SecFilterEngine", "from", "SSLOptions", "SSLRequireSSL", "SSLRequire"
}
local literals = {
"on", "off", "deny", "denied", "all", "allow", "basic", "valid-user", "append", "unset", "set", "eq",
"any", "email"
}
local symbols = {}
for _,lt in ipairs(literals) do
symbols[lt] = "literal"
symbols[lt:gsub("%f[%w]%l", string.upper)] = "literal"
end
for _,kw in ipairs(keywords) do
symbols[kw] = "keyword"
end
local url_syntax = {
patterns = {
{ pattern = "[%%$]%d+", type = "keyword2" },
{ pattern = "[%%$]%{[%w_:%-]+%}", type = "keyword2" },
{ pattern = "[^%%$%s]", type = "string" }
},
symbols = {}
}
local xml_syntax = {
patterns = {{ pattern = { '"', '"', '\\' }, type = "string" }},
symbols = {}
}
syntax.add {
name = ".htaccess File",
files = { PATHSEP .. "^%.htaccess$" },
comment = "#",
patterns = {
-- Comments
{ pattern = "#.*\n", type = "comment" },
-- Strings
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = { '`', '`', '\\' }, type = "string" },
-- URLs
{ pattern = { "%w-://", "%f[%s]" }, type = "string", syntax = url_syntax },
{ pattern = { "%f[%S]/", "%f[%s]" }, type = "string", syntax = url_syntax },
-- Mime types
{ pattern = "%f[%w]application/[%w%._+-]+", type = "keyword2" },
{ pattern = "%f[%w]font/[%w%._+-]+", type = "keyword2" },
{ pattern = "%f[%w]image/[%w%._+-]+", type = "keyword2" },
{ pattern = "%f[%w]text/[%w%._+-]+", type = "keyword2" },
{ pattern = "%f[%w]audio/[%w%._+-]+", type = "keyword2" },
{ pattern = "%f[%w]video/[%w%._+-]+", type = "keyword2" },
-- IPs
{ pattern = "%d+%.%d+%.%d+%.%d+", type = "keyword2" },
{ pattern = "%d+%.%d+%.%d+%.%d+/%d+", type = "keyword2" },
{ regex = "([a-f0-9:]+:+)+[a-f0-9]+", type = "keyword2" },
-- Emails
{ pattern = "%w+@%w+%.%w+", type = "keyword2" },
-- Rewrite option sections
{ pattern = "%f[%S]%b[]", type = "number" },
-- XML tags
{ pattern = { "</?%w+", ">" }, type = "literal", syntax = xml_syntax },
-- Variables
{ pattern = "[%%$]%d+", type = "keyword2" },
{ pattern = "[%%$]%{[%w_:%-]+%}", type = "keyword2" },
-- Numbers
{ pattern = "A?%d+", type = "number" },
-- Operators
{ pattern = "%f[%S][!=+%-]+", type = "operator" },
-- Regex (TODO: improve this, it's pretty naive and only works on some regex)
{ pattern = "%f[^%s!]%^%S*", type = "literal" },
{ pattern = "%f[^%s!]%S*%$", type = "literal" },
{ pattern = "%f[^%s!]%b()", type = "literal" },
-- Everything else
{ pattern = "[%a_][%w_-]*", type = "symbol" },
},
symbols = symbols
}
+20
View File
@@ -0,0 +1,20 @@
-- mod-version:3
local syntax = require "core.syntax"
local style = require "core.style"
local common = require "core.common"
style.syntax["ignore"] = { common.color "#72B886" }
style.syntax["exclude"] = { common.color "#F36161" }
syntax.add {
name = ".ignore file",
files = { PATHSEP .. "%..*ignore$" },
comment = "#",
patterns = {
{ regex = "^ *#.*$", type = "comment" },
{ regex = { "(?=^ *!.)", "$" }, type = "ignore" },
{ regex = { "(?=.)", "$" }, type = "exclude" },
},
symbols = {}
}
+27
View File
@@ -0,0 +1,27 @@
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "INI",
files = { "%.ini$", "%.inf$", "%.cfg$", PATHSEP .. "%.editorconfig$", "%.theme$", "%.dockitem$", "%.desktop$" },
comment = ';',
patterns = {
{ pattern = ";.*", type = "comment" },
{ pattern = "#.*", type = "comment" },
{ pattern = { "%[", "%]" }, type = "keyword" },
{ pattern = { '"""', '"""', '\\' }, type = "string" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'''", "'''" }, type = "string" },
{ pattern = { "'", "'" }, type = "string" },
{ pattern = "[A-Za-z0-9_%.%-]+%s*%f[=]", type = "function" },
{ pattern = "[%-+]?[0-9_]+%.[0-9_]+", type = "number" },
{ pattern = "[%-+]?[0-9_]+", type = "number" },
{ pattern = "[a-z]+", type = "symbol" },
},
symbols = {
["true"] = "literal",
["false"] = "literal",
},
}
+87
View File
@@ -0,0 +1,87 @@
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "Java",
files = { "%.java$" },
comment = "//",
patterns = {
{ pattern = "//.*", type = "comment" },
{ pattern = { "/%*", "%*/" }, type = "comment" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = "'\\x%x?%x?%x?%x'", type = "string" }, -- character hexadecimal escape sequence
{ pattern = "'\\u%x%x%x%x'", type = "string" }, -- character unicode escape sequence
{ pattern = "'\\?.'", type = "string" }, -- character literal
{ pattern = "-?0x%x+", type = "number" },
{ pattern = "-?%d+[%d%.eE]*f?", type = "number" },
{ pattern = "-?%.?%d+f?", type = "number" },
{ pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" },
{ pattern = "[%a_][%w_]*%f[(]", type = "function" },
{ regex = "(?>\\w+\\.?)+(?=\\s+\\w++\\s*\\=\\s*)", type = "function" }, -- Class name when creating an object
{ regex = "[A-Z][A-Z_]+", type = "keyword2" }, -- Constants
{ pattern = "[%a_][%w_]*", type = "symbol" },
},
symbols = {
["abstract"] = "keyword",
["assert"] = "keyword",
["break"] = "keyword",
["case"] = "keyword",
["catch"] = "keyword",
["class"] = "keyword",
["const"] = "keyword",
["continue"] = "keyword",
["default"] = "keyword",
["do"] = "keyword",
["else"] = "keyword",
["enum"] = "keyword",
["extends"] = "keyword",
["final"] = "keyword",
["finally"] = "keyword",
["for"] = "keyword",
["if"] = "keyword",
["goto"] = "keyword",
["implements"] = "keyword",
["import"] = "keyword",
["instanceof"] = "keyword",
["interface"] = "keyword",
["native"] = "keyword",
["new"] = "keyword",
["package"] = "keyword",
["permits"] = "keyword",
["private"] = "keyword",
["protected"] = "keyword",
["public"] = "keyword",
["record"] = "keyword",
["return"] = "keyword",
["sealed"] = "keyword",
["static"] = "keyword",
["strictfp"] = "keyword",
["super"] = "keyword",
["switch"] = "keyword",
["synchronized"] = "keyword",
["this"] = "keyword",
["throw"] = "keyword",
["throws"] = "keyword",
["transient"] = "keyword",
["try"] = "keyword",
["var"] = "keyword",
["void"] = "keyword",
["volatile"] = "keyword",
["while"] = "keyword",
["yield"] = "keyword",
["boolean"] = "keyword2",
["byte"] = "keyword2",
["char"] = "keyword2",
["double"] = "keyword2",
["float"] = "keyword2",
["int"] = "keyword2",
["long"] = "keyword2",
["short"] = "keyword2",
["true"] = "literal",
["false"] = "literal",
["null"] = "literal"
}
}
+93
View File
@@ -0,0 +1,93 @@
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "Jiyu",
files = { "%.jiyu$", "%.jyu$" },
comment = "//",
patterns = {
{ pattern = "//.-\n", type = "comment" },
{ pattern = { "/%*", "%*/" }, type = "comment" },
{ pattern = { "\"\"\"", "\"\"\"" }, type = "string" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = "0b[0-1]+", type = "number" },
{ pattern = "0x[%da-fA-F]+", type = "number" },
{ pattern = "-?%d+[%d%.]*", type = "number" },
{ pattern = "-?%.?%d+?", type = "number" },
{ pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" },
{ pattern = "[<>~=+-*/]=", type = "operator" },
{ pattern = "[..]", type = "operator" },
{ pattern = "[%a_][%w_]*%f[(]", type = "function" },
{ pattern = "[#@]?[%a_][%w_]*", type = "symbol" },
},
symbols = {
-- Keywords
["func"] = "keyword",
["if"] = "keyword",
["else"] = "keyword",
["for"] = "keyword",
["while"] = "keyword",
["defer"] = "keyword",
["return"] = "keyword",
["switch"] = "keyword",
["case"] = "keyword",
["break"] = "keyword",
["continue"] = "keyword",
["fallthrough"] = "keyword",
["struct"] = "keyword",
["union"] = "keyword",
["enum"] = "keyword",
["using"] = "keyword",
["var"] = "keyword",
["let"] = "keyword",
["typealias"] = "keyword",
["library"] = "keyword",
["framework"] = "keyword",
["temporary_c_vararg"] = "keyword2";
-- Builtin procedures and directives
["cast"] = "keyword2",
["sizeof"] = "keyword2",
["alignof"] = "keyword2",
["strideof"] = "keyword2",
["offsetof"] = "keyword2",
["type_of"] = "keyword2",
["type_info"] = "keyword2",
["#if"] = "keyword2",
["#load"] = "keyword2",
["#import"] = "keyword2",
["#clang_import"] = "keyword2",
["#file"] = "keyword2",
["#filepath"] = "keyword2",
["#line"] = "keyword2",
["@c_function"] = "keyword2",
["@export"] = "keyword2",
["@flags"] = "keyword2",
["@metaprogram"] = "keyword2",
-- Types
["string"] = "keyword2",
["int"] = "keyword2",
["uint"] = "keyword2",
["uint8"] = "keyword2",
["uint16"] = "keyword2",
["uint32"] = "keyword2",
["uint64"] = "keyword2",
["uint128"] = "keyword2",
["int8"] = "keyword2",
["int16"] = "keyword2",
["int32"] = "keyword2",
["int64"] = "keyword2",
["int128"] = "keyword2",
["float"] = "keyword2",
["double"] = "keyword2",
["void"] = "keyword2",
["bool"] = "keyword2",
["Type"] = "keyword2",
-- Literals
["true"] = "literal",
["false"] = "literal",
["null"] = "literal",
}
}
+34
View File
@@ -0,0 +1,34 @@
-- mod-version:3 priority:110
local syntax = require "core.syntax"
syntax.add {
name = "JSON",
files = {
"%.json$",
"%.cjson$",
"%.jsonc$",
"%.ipynb$",
},
comment = "//",
block_comment = {"/*", "*/"},
patterns = {
-- cjson support
{ pattern = "//.*", type = "comment" },
{ pattern = { "/%*", "%*/" }, type = "comment" },
{ regex = [["(?:[^"\\]|\\.)*"()\s*:]], type = { "keyword", "normal" } }, -- key
{ regex = [["(?:[^"\\]|\\.)*"]], type = "string" }, -- value
{ pattern = "0x[%da-fA-F]+", type = "number" },
{ pattern = "-?%d+[%d%.eE]*", type = "number" },
{ pattern = "-?%.?%d+", type = "number" },
{ pattern = "null", type = "literal" },
{ pattern = "true", type = "literal" },
{ pattern = "false", type = "literal" }
},
symbols = { }
}
+73
View File
@@ -0,0 +1,73 @@
-- mod-version:3
-- Almost identical to JS, with the exception that / shouldn't denote a regex. Current JS syntax highlighter will highlight half the document due to closing tags.
local syntax = require "core.syntax"
syntax.add {
name = "JSX",
files = { "%.jsx$", "%.astro$" },
comment = "//",
block_comment = { "/*", "*/" },
patterns = {
{ pattern = "//.*", type = "comment" },
{ pattern = { "/%*", "%*/" }, type = "comment" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = { "`", "`", '\\' }, type = "string" },
{ pattern = "0x[%da-fA-F]+", type = "number" },
{ pattern = "-?%d+[%d%.eE]*", type = "number" },
{ pattern = "-?%.?%d+", type = "number" },
{ pattern = "%f[^<]/?[%a_][%w_]*", type = "function" },
{ pattern = "[%a_][%w_]*%f[(]", type = "function" },
{ pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" },
{ pattern = "[%a_][%w_]*", type = "symbol" },
},
symbols = {
["async"] = "keyword",
["await"] = "keyword",
["break"] = "keyword",
["case"] = "keyword",
["catch"] = "keyword",
["class"] = "keyword",
["const"] = "keyword",
["continue"] = "keyword",
["debugger"] = "keyword",
["default"] = "keyword",
["delete"] = "keyword",
["do"] = "keyword",
["else"] = "keyword",
["export"] = "keyword",
["extends"] = "keyword",
["finally"] = "keyword",
["for"] = "keyword",
["from"] = "keyword",
["function"] = "keyword",
["get"] = "keyword",
["if"] = "keyword",
["import"] = "keyword",
["in"] = "keyword",
["instanceof"] = "keyword",
["let"] = "keyword",
["new"] = "keyword",
["return"] = "keyword",
["set"] = "keyword",
["static"] = "keyword",
["super"] = "keyword",
["switch"] = "keyword",
["throw"] = "keyword",
["try"] = "keyword",
["typeof"] = "keyword",
["var"] = "keyword",
["void"] = "keyword",
["while"] = "keyword",
["with"] = "keyword",
["yield"] = "keyword",
["true"] = "literal",
["false"] = "literal",
["null"] = "literal",
["undefined"] = "literal",
["arguments"] = "keyword2",
["Infinity"] = "keyword2",
["NaN"] = "keyword2",
["this"] = "keyword2",
},
}
+112
View File
@@ -0,0 +1,112 @@
-- mod-version:3
-- 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 = "#.*$", 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 = "[^%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
["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",
["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",
["abstract"] = "keyword2",
["primitive"] = "keyword2",
["mutable"] = "keyword2",
["Char"] = "keyword2",
["Bool"] = "keyword2",
["Int"] = "keyword2",
["Integer"] = "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",
["Ref"] = "keyword2",
["String"] = "keyword2",
["Function"] = "keyword2",
["Number"] = "keyword2",
-- literals
["missing"] = "literal",
["true"] = "literal",
["false"] = "literal",
["nothing"] = "literal",
["Inf"] = "literal",
["NaN"] = "literal",
}
}
+84
View File
@@ -0,0 +1,84 @@
-- mod-version:3
local syntax = require "core.syntax"
local identifier = "\"?[^%d%s\\/%(%){}<>;%[%]=,\"][^%s\\/%(%){}<>;%[%]=,\"]*\"?"
syntax.add {
name = "KDL",
files = { "%.kdl" },
space_handling = false,
comment = "//",
block_comment = {"/*", "*/"},
patterns = {
{
pattern = "^%s*".. identifier .."%s*",
type = "keyword"
},--
{ pattern = "%s+", type = "normal" },
{
pattern = "[{;]%s*()" .. identifier .. "%s*",
type = {"normal", "keyword"}
},--
{ pattern = { "r#+\"", "\"#+" }, type = "string" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = "[%-+]?0x[%x_]+", type = "number" },
{ pattern = "[%-+]?0b[01_]+", type = "number" },
{ pattern = "[%-+]?0o[0-7_]+", type = "number" },
{
pattern = "[%-+]?[%d_]+%.[%d_]+e[%-+]?[%d_]+",
type = "number"
},
{ pattern = "[%-+]?[%d_]+%.[%d_]+", type = "number" },
{ pattern = "[%-+]?[%d_]+e[%-+]?[%d_]+", type = "number" },
{ pattern = "[%-+]?[%d_]+", type = "number" },
{ pattern = "/[%-/].-\n", type = "comment" },
{ pattern = {"/%*", "%*/"}, type = "comment" },
{ pattern = identifier, type = "keyword2" },
{
pattern = "%(()" .. identifier .. "()%)",
type = {"normal", "function", "normal"}
},
},
symbols = {
["null"] = "literal",
["true"] = "literal",
["false"] = "literal",
["i8"] = "function",
["i32"] = "function",
["i16"] = "function",
["i64"] = "function",
["u8"] = "function",
["u32"] = "function",
["u16"] = "function",
["u64"] = "function",
["isize"] = "function",
["usize"] = "function",
["f32"] = "function",
["f64"] = "function",
["decimal64"] = "function",
["decimal128"] = "function",
["date-time"] = "function",
["time"] = "function",
["date"] = "function",
["duration"] = "function",
["decimal"] = "function",
["currency"] = "function",
["country-2"] = "function",
["country-3"] = "function",
["country-subdivision"] = "function",
["email"] = "function",
["idn-email"] = "function",
["hostname"] = "function",
["idn-hostname"] = "function",
["ipv4"] = "function",
["ipv6"] = "function",
["url"] = "function",
["url-reference"] = "function",
["irl"] = "function",
["irl-reference"] = "function",
["url-template"] = "function",
["uuid"] = "function",
["regex"] = "function",
["base64"] = "function",
},
}
+124
View File
@@ -0,0 +1,124 @@
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "Kotlin",
files = { "%.kt$" },
comment = "//",
block_comment = { "/*", "*/" },
patterns = {
{ pattern = "//.*", type = "comment" }, -- Comment, single-line
{ pattern = { "/%*", "%*/" }, type = "comment" }, -- Comment, multi-line
{ pattern = { '"', '"', '\\' }, type = "string" }, -- String, quotation marks
{ pattern = { "'", "'", '\\' }, type = "string" }, -- String, apices
{ pattern = "'\\x%x?%x?%x?%x'", type = "string" }, -- Character hexadecimal escape sequence
{ pattern = "'\\u%x%x%x%x'", type = "string" }, -- Character unicode escape sequence
{ pattern = "'\\?.'", type = "string" }, -- Character literal
{ pattern = "-?0x%x+", type = "number" }, -- ?
{ pattern = "-?%d+[%deE]*f?", type = "number" }, -- ?
{ pattern = "-?%.?%d+f?", type = "number" }, -- ?
{ regex = [[\-\>(?=\s)]], type = "operator" }, -- Lambda
{ regex = [[\.{2}\<?\s?(?=[\\-]?[a-z0-9])]], type = "operator" }, -- Range operators
{ pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" }, -- Operators
{ regex = [[\?(?=\.)]], type = "operator" }, -- ?. operator
{ pattern = "[%a_][%w_]*%f[(]", type = "function" }, -- Function/Method/Class
{ regex = "`[\\w_\\s]+`(?=\\s*\\()", type = "function" }, -- Test Method
{ regex = [[let(?=\s\{)]], type = "function" }, -- ? operator
{ regex = [[\?\:(?=\s?)]], type = "operator" }, -- elvis operator
{ regex = [[this(?=\.?\@?)]], type = "keyword" }, -- this keyword
{ regex = "\\@\\w+", type = "keyword2" }, -- Annotations
{ regex = [[[a-zA-Z]+\@(?=\s?[a-zA-Z])]], type = "keyword2" }, -- Annotations (this pattern is lower priority than the `this keyword` pattern)
{ regex = "[A-Z][A-Z_]+", type = "keyword2" }, -- Constants, FULL UPPERCASE
{ pattern = "import()%s+()[%w_.]+", type = { "keyword", "normal", "normal" } },
{ pattern = "[%a_][%w_]*", type = "symbol" }, -- ?
},
symbols = {
-- Hard keywords
["as"] = "keyword",
["break"] = "keyword",
["class"] = "keyword",
["continue"] = "keyword",
["do"] = "keyword",
["else"] = "keyword",
["for"] = "keyword",
["fun"] = "keyword",
["if"] = "keyword",
["in"] = "keyword",
["!in"] = "keyword",
["interface"] = "keyword",
["is"] = "keyword",
["!is"] = "keyword",
["object"] = "keyword",
["package"] = "keyword",
["return"] = "keyword",
["super"] = "keyword",
["this"] = "keyword",
["throw"] = "keyword",
["try"] = "keyword",
["typealias"] = "keyword",
["typeof"] = "keyword",
["val"] = "keyword",
["var"] = "keyword",
["when"] = "keyword",
["while"] = "keyword",
-- Soft keywords
["by"] = "keyword",
["catch"] = "keyword",
["constructor"] = "keyword",
["delegate"] = "keyword",
["dynamic"] = "keyword",
["field"] = "keyword",
["file"] = "keyword",
["finally"] = "keyword",
["get"] = "keyword",
["import"] = "keyword",
["init"] = "keyword",
["param"] = "keyword",
["property"] = "keyword",
["receiver"] = "keyword",
["set"] = "keyword",
["setparam"] = "keyword",
["value"] = "keyword",
["where"] = "keyword",
-- Modifier keywords
["abstract"] = "keyword",
["actual"] = "keyword",
["annotation"] = "keyword",
["companion"] = "keyword",
["const"] = "keyword",
["crossinline"] = "keyword",
["data"] = "keyword",
["enum"] = "keyword",
["expect"] = "keyword",
["external"] = "keyword",
["final"] = "keyword",
["inline"] = "keyword",
["inner"] = "keyword",
["infix"] = "keyword",
["internal"] = "keyword",
["lateinit"] = "keyword",
["noinline"] = "keyword",
["open"] = "keyword",
["operator"] = "keyword",
["out"] = "keyword",
["override"] = "keyword",
["private"] = "keyword",
["protected"] = "keyword",
["public"] = "keyword",
["reified"] = "keyword",
["sealed"] = "keyword",
["suspend"] = "keyword",
["tailrec"] = "keyword",
["vararg"] = "keyword",
-- Special identifiers
["it"] = "keyword",
-- Boolean
["true"] = "literal",
["false"] = "literal",
["null"] = "literal",
},
}
+22
View File
@@ -0,0 +1,22 @@
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "LilyPond",
files = { "%.i?ly$" },
comment = "%%",
block_comment = { "%%{", "%%}" },
patterns = {
{ pattern = "#%(()[%a_]%S*", type = { "operator", "function" } },
{ pattern = {"%%{", "%%}"}, type = "comment" },
{ pattern = "%%.*", type = "comment" },
{ pattern = "#[%w_-]*", type = "keyword2" },
{ pattern = "\\%a%w+", type = "keyword" },
{ pattern = "\\\\", type = "operator" },
{ pattern = "[%(%){}%[%]<>=/~%-%_']", type = "operator" },
{ pattern = {'"', '"', "\\"}, type = "string" },
{ pattern = "-?%.?%d+", type = "number" },
},
symbols = {}
}
+145
View File
@@ -0,0 +1,145 @@
-- mod-version:3
local syntax = require "core.syntax"
local liquid_syntax = {
patterns = {
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = "-?%d+[%d%.]*f?", type = "number" },
{ pattern = "-?%.?%d+f?", type = "number" },
{ pattern = "%w+", type = "symbol" },
},
symbols = {
["abs"] = "keyword2",
["and"] = "operator",
["append"] = "keyword2",
["assign"] = "keyword",
["at_least"] = "keyword2",
["at_most"] = "keyword2",
["break"] = "keyword",
["camelcase"] = "keyword2",
["capitalize"] = "keyword2",
["capture"] = "keyword",
["endcapture"] = "keyword",
["case"] = "keyword",
["ceil"] = "keyword2",
["comment"] = "keyword",
["endcomment"] = "keyword",
["concat"] = "keyword2",
["contains"] = "operator",
["cycle"] = "keyword",
["date"] = "keyword2",
["decrement"] = "keyword",
["default"] = "keyword2",
["divided_by"] = "keyword2",
["downcase"] = "keyword2",
["else"] = "keyword",
["elsif"] = "keyword",
["false"] = "literal",
["first"] = "keyword2",
["floor"] = "keyword2",
["for"] = "keyword",
["endfor"] = "keyword",
["forloop"] = "literal",
["handleize"] = "keyword2",
["handle"] = "keyword2",
["if"] = "keyword",
["endif"] = "keyword",
["increment"] = "keyword",
["index0"] = "literal",
["index"] = "literal",
["in"] = "operator",
["join"] = "keyword2",
["last"] = "keyword2",
["length"] = "literal",
["limit"] = "keyword",
["lstrip"] = "keyword",
["map"] = "keyword2",
["minus"] = "keyword2",
["modulo"] = "keyword2",
["nil"] = "literal",
["null"] = "literal",
["offset"] = "keyword2",
["or"] = "operator",
["pluralize"] = "keyword2",
["plus"] = "keyword2",
["prepend"] = "keyword2",
["raw"] = "keyword",
["endraw"] = "keyword",
["removefirst"] = "keyword2",
["remove"] = "keyword2",
["replacefirst"] = "keyword2",
["replace"] = "keyword2",
["reversed"] = "operator",
["reverse"] = "keyword2",
["rindex0"] = "literal",
["rindex"] = "literal",
["round"] = "keyword2",
["rstrip"] = "keyword2",
["size"] = "keyword2",
["slice"] = "keyword2",
["sort"] = "keyword2",
["split"] = "keyword2",
["strip"] = "keyword2",
["strip_newlines"] = "keyword2",
["times"] = "keyword2",
["true"] = "literal",
["truncate"] = "keyword2",
["truncatewords"] = "keyword2",
["uniq"] = "keyword2",
["unless"] = "keyword",
["endunless"] = "keyword",
["upcase"] = "keyword2",
["when"] = "keyword",
["where"] = "keyword2"
},
}
syntax.add {
name = "Liquid",
files = { "%.liquid?$" },
patterns = {
{ pattern = { "{%%", "%%}" }, syntax = liquid_syntax, type = "function" },
{ pattern = { "{{", "}}" }, syntax = liquid_syntax, type = "function" },
{
pattern = {
"<%s*[sS][cC][rR][iI][pP][tT]%s+[tT][yY][pP][eE]%s*=%s*" ..
"['\"]%a+/[jJ][aA][vV][aA][sS][cC][rR][iI][pP][tT]['\"]%s*>",
"<%s*/[sS][cC][rR][iI][pP][tT]>"
},
syntax = ".js",
type = "function"
},
{
pattern = {
"<%s*[sS][cC][rR][iI][pP][tT]%s*>",
"<%s*/%s*[sS][cC][rR][iI][pP][tT]>"
},
syntax = ".js",
type = "function"
},
{
pattern = {
"<%s*[sS][tT][yY][lL][eE][^>]*>",
"<%s*/%s*[sS][tT][yY][lL][eE]%s*>"
},
syntax = ".css",
type = "function"
},
{ pattern = { "<!%-%-", "%-%->" }, type = "comment" },
{ pattern = { '%f[^>][^<]', '%f[<{]' }, type = "normal" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = "0x[%da-fA-F]+", type = "number" },
{ pattern = "-?%d+[%d%.]*f?", type = "number" },
{ pattern = "-?%.?%d+f?", type = "number" },
{ pattern = "%f[^<]![%a_][%w_]*", type = "keyword2" },
{ pattern = "%f[^<][%a_][%w_]*", type = "function" },
{ pattern = "%f[^<]/[%a_][%w_]*", type = "function" },
{ pattern = "[%a_][%w_]*", type = "keyword" },
{ pattern = "[/<>=]", type = "operator" }
},
symbols = {},
}
+79
View File
@@ -0,0 +1,79 @@
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "Lobster",
files = "%.lobster$",
comment = "//",
patterns = {
{ pattern = "//.-\n", type = "comment" },
{ pattern = { "/%*", "%*/" }, type = "comment" },
{ pattern = "struct%s()[%a_][%w_]*", type = { "keyword", "keyword2" } },
{ pattern = "class%s()[%a_][%w_]*", type = { "keyword", "keyword2" } },
{ pattern = "[%w_]+%s*%f[{]", type = "keyword2" },
{ 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_]*%f[(]", type = "function" },
{ pattern = "[%a_][%w_]*", type = "symbol" },
},
symbols = {
["import"] = "keyword",
["from"] = "keyword",
["def"] = "keyword",
["fn"] = "keyword",
["return"] = "keyword",
["program"] = "keyword",
["private"] = "keyword",
["resource"] = "keyword",
-- not really keywords but provides control-flow constructs
["if"] = "keyword",
["guard"] = "keyword",
["for"] = "keyword",
["while"] = "keyword",
["else"] = "keyword",
["enum"] = "keyword",
["enum_flags"] = "keyword",
["int"] = "keyword2",
["float"] = "keyword2",
["string"] = "keyword2",
["any"] = "keyword2",
["void"] = "keyword2",
["is"] = "keyword",
["typeof"] = "keyword",
["var"] = "keyword",
["let"] = "keyword",
["pakfile"] = "keyword",
["switch"] = "keyword",
["case"] = "keyword",
["default"] = "keyword",
["namespace"] = "keyword",
["constructor"] = "keyword",
["operator"] = "keyword",
["super"] = "keyword",
["abstract"] = "keyword",
["attribute"] = "keyword",
["member"] = "keyword",
["member_frame"] = "keyword",
["static"] = "keyword",
["static_frame"] = "keyword",
["not"] = "keyword",
["and"] = "keyword",
["or"] = "keyword",
["struct"] = "keyword",
["class"] = "keyword",
["nil"] = "literal",
},
}
+34
View File
@@ -0,0 +1,34 @@
-- mod-version:3
local syntax = require 'core.syntax'
syntax.add {
name = "Lox",
files = { "%.lox$" },
comment = "//",
patterns = {
{ pattern = "//.-\n", type = "comment" },
{ pattern = { '"', '"' }, type = "string" },
{ pattern = "%a[%w_]*()%s*%f[(]", type = {"function", "normal"} },
{ pattern = "[%a_][%w_]*%s*%f[(]", type = "function" },
{ pattern = "%d+%.?%d*", type = "number" },
{ pattern = "%a%w*", type = "symbol" },
},
symbols = {
["and"] = "keyword",
["class"] = "keyword",
["else"] = "keyword",
["false"] = "literal",
["for"] = "keyword",
["fun"] = "keyword",
["if"] = "keyword",
["nil"] = "literal",
["or"] = "keyword",
["print"] = "keyword",
["return"] = "keyword",
["super"] = "keyword2",
["this"] = "keyword2",
["true"] = "keyword",
["var"] = "keyword",
["while"] = "keyword",
},
}
+19
View File
@@ -0,0 +1,19 @@
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "Makefile",
files = { PATHSEP .. "[Mm]akefile$", "%.mk$" },
comment = "#",
patterns = {
{ pattern = "#.*", type = "comment" },
{ pattern = [[\.]], type = "normal" },
{ pattern = "$[@^<%%?+|*]", type = "keyword2" },
{ pattern = "$%(.-%)", type = "symbol" },
{ pattern = "%f[%w_][%d%.]+%f[^%w_]", type = "number" },
{ pattern = "%..*:", type = "keyword2" },
{ pattern = ".*:", type = "function" },
},
symbols = {
},
}
+42
View File
@@ -0,0 +1,42 @@
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "MARTe",
files = { "%.mrt$", "%.marte$" },
comment = "//",
block_comment = { "/*", "*/" },
patterns = {
{ pattern = "//.*", type = "comment" },
{ pattern = { "/%*", "%*/" }, type = "comment" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = "%-?%.inf", type = "number" },
{ pattern = "%.NaN", type = "number" },
{
pattern = "Class%s+()=()%s+[%a_][%w_:]*",
type = { "keyword", "operator", "keyword2"}
},
{
pattern = "Type%s+()=()%s+[%a_][%w_]*",
type = { "keyword", "operator", "keyword2"}
},
{
pattern = "[%+%$][%a_][%w_]+%s()=",
type = {"function", "operator"}
},
{ pattern = "=%s+()[%a_][%w_]+", type = "string" },
{
pattern = "[%a_][%w_]+%s()=",
type = {"keyword", "operator"}
},
{ pattern = "0x%x+", type = "number" },
{ pattern = "%d+[%d%.'eE]*f?", type = "number" },
{ pattern = "%.?%d+f?", type = "number" },
{ pattern = "%a[%w_]+", type = "literal" },
},
symbols = {
["true"] = "number",
["false"] = "number",
},
}
+36
View File
@@ -0,0 +1,36 @@
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "Meson",
files = { PATHSEP .. "meson%.build$", PATHSEP .. "meson_options%.txt$" },
comment = "#",
patterns = {
{ pattern = "#.*", type = "comment" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = { "'''", "'''" }, type = "string" },
{ pattern = "0x[%da-fA-F]+", type = "number" },
{ pattern = "-?%d+%d*", type = "number" },
{ pattern = "[%+%-=/%%%*!]", type = "operator" },
{ pattern = "[%a_][%w_]*%f[(]", type = "function" },
{ pattern = "[%a_][%w_]*", type = "symbol" },
},
symbols = {
["if"] = "keyword",
["then"] = "keyword",
["else"] = "keyword",
["elif"] = "keyword",
["endif"] = "keyword",
["foreach"] = "keyword",
["endforeach"] = "keyword",
["break"] = "keyword",
["continue"] = "keyword",
["and"] = "keyword",
["not"] = "keyword",
["or"] = "keyword",
["in"] = "keyword",
["true"] = "literal",
["false"] = "literal",
},
}
+102
View File
@@ -0,0 +1,102 @@
-- mod-version:3
local syntax = require 'core.syntax'
syntax.add {
name = "MiniScript",
files = { "%.ms$" },
comment = "//",
patterns = {
{ pattern = "//.*", type = "comment" },
{ pattern = { '"', '"' }, type = "string" },
{ pattern = "[<>!=]=", type = "operator" },
{ pattern = "[%+%-%*%/%^@<>:]", type = "operator" },
{ pattern = "%d%.%d*[eE][-+]?%d+", type = "number" },
{ pattern = "%d%.%d*", type = "number" },
{ pattern = "%.?%d*[eE][-+]?%d+", type = "number" },
{ pattern = "%.?%d+", type = "number" },
{ pattern = "[%a_][%w_]*", type = "symbol" },
},
symbols = {
["if"] = "keyword",
["not"] = "keyword",
["and"] = "keyword",
["or"] = "keyword",
["else"] = "keyword",
["then"] = "keyword",
["for"] = "keyword",
["in"] = "keyword",
["while"] = "keyword",
["break"] = "keyword",
["continue"] = "keyword",
["function"] = "keyword",
["end"] = "keyword",
["return"] = "keyword",
["new"] = "keyword",
["isa"] = "keyword",
["self"] = "keyword2",
["true"] = "literal",
["false"] = "literal",
["null"] = "literal",
["globals"] = "literal",
["locals"] = "literal",
["outer"] = "literal",
-- Built-in types's classes
["number"] = "literal",
["string"] = "literal",
["list"] = "literal",
["map"] = "literal",
["funcRef"] = "literal",
-- Intrinsic functions
["abs"] = "function",
["acos"] = "function",
["asin"] = "function",
["atan"] = "function",
["bitAnd"] = "function",
["bitOr"] = "function",
["bitXor"] = "function",
["ceil"] = "function",
["char"] = "function",
["code"] = "function",
["cos"] = "function",
["floor"] = "function",
["hash"] = "function",
["hasIndex"] = "function",
["indexes"] = "function",
["indexOf"] = "function",
["insert"] = "function",
["join"] = "function",
["len"] = "function",
["log"] = "function",
["lower"] = "function",
["pi"] = "function",
["pop"] = "function",
["print"] = "function",
["pull"] = "function",
["push"] = "function",
["range"] = "function",
["remove"] = "function",
["replace"] = "function",
["rnd"] = "function",
["round"] = "function",
["shuffle"] = "function",
["sign"] = "function",
["sin"] = "function",
["slice"] = "function",
["sort"] = "function",
["split"] = "function",
["sqrt"] = "function",
["str"] = "function",
["sum"] = "function",
["tan"] = "function",
["time"] = "function",
["upper"] = "function",
["val"] = "function",
["values"] = "function",
["version"] = "function",
["wait"] = "function",
["yield"] = "function",
},
}
+64
View File
@@ -0,0 +1,64 @@
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "MoonScript",
files = "%.moon$",
headers = "^#!.*[ /]moon",
comment = "--",
patterns = {
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = { "%[%[", "%]%]" }, type = "string" },
{ pattern = "%-%-.-\n", type = "comment" },
{ pattern = "-?0x%x+", type = "number" },
{ pattern = "-?%d+[%d%.eE]*", type = "number" },
{ pattern = "-?%.?%d+", type = "number" },
{ pattern = "%.%.%.?", type = "keyword2" },
{ pattern = "[<>~=]=", type = "keyword2" },
{ pattern = "[%+%-=/%*%^%%#<>]", type = "keyword2" },
{ pattern = "[%a_][%w_]*%s*%f[(\"{]", type = "function" },
{ pattern = "[%a_][%w_]*", type = "symbol" },
{ pattern = {"\\", "[%a_][%w_]*"}, type = "function" },
{ pattern = {"%.", "[%a_][%w_]*"}, type = "function" },
{ pattern = "@[%a_][%w_]*", type = "keyword2" },
{ pattern = "@", type = "keyword2" },
{ pattern = "!", type = "keyword2" },
{ pattern = "[%p]", type = "keyword" },
},
symbols = {
["if"] = "keyword",
["then"] = "keyword",
["else"] = "keyword",
["when"] = "keyword",
["elseif"] = "keyword",
["do"] = "keyword",
["->"] = "keyword",
["while"] = "keyword",
["for"] = "keyword",
["break"] = "keyword",
["continue"] = "keyword",
["export"] = "keyword",
["unless"] = "keyword",
["return"] = "keyword",
["in"] = "keyword",
["not"] = "keyword",
["and"] = "keyword",
["or"] = "keyword",
["import"] = "keyword",
["as"] = "keyword",
["from"] = "keyword",
["class"] = "keyword",
["extends"] = "keyword",
["switch"] = "keyword",
["with"] = "keyword",
["using"] = "keyword",
["super"] = "keyword2",
["self"] = "keyword2",
["#"] = "keyword2",
["true"] = "literal",
["false"] = "literal",
["nil"] = "literal",
},
}
+119
View File
@@ -0,0 +1,119 @@
-- mod-version:3
-- to better understand these comments, see this section from rxi's article
-- https://rxi.github.io/lite_an_implementation_overview.html#syntax_highlighting
-- first, we need to require the syntax module
local syntax = require "core.syntax"
--[[
then, we'll add a new syntax to the syntax module, lite-xl matches Lua patterns
against the source code in order to highlight the code.
]]
syntax.add {
-- the extension of source code
files = "%.nelua$",
-- this add support for shebang, is not rare to add #!/usr/local/bin/lua to make
-- lua scripts executable, here we add support for it for nelua
headers = "^#!.*[ /]nelua",
-- tells to lite how to toggle comments
comment = "--",
-- finally the patterns, is a table of tables,
-- each entry is a table with some fields, especially with "pattern" and "type" fields.
patterns = {
--[[
["pattern"] field:
Describes a syntax pattern, this is done with Lua Patterns
you can learn it works here: https://www.lua.org/manual/5.4/manual.html#6.4.1
The pattern can be a string or a table, when is a string, then is just a
pattern that match everything, when is a table, then it follows this
logic:
{ range_start_pattern, range_end_pattern [, escape_character] }
The matched range_start_pattern and range_end_pattern text will be highlighted, but the
text between them will not.
["syntax"] field:
Optional field, when set, the text between matched ranges will use syntax from another language,
a good common known example of this is using javascript syntax inside a `script` element:
https://github.com/lite-xl/lite-xl/blob/df667ad28e9995f8cb79dab64e6039f095c202f4/data/plugins/language_html.lua#L17-L23
["type"] field:
Set the style that should be used, this is defined on the "style" file from
the lite-xl's source, at "data/core/style.lua".
]]
{
pattern = {"##%[=*%[", "%]=*%]"},
syntax = ".lua",
type = "function",
},
{
pattern = {"#|", "|#"},
syntax = ".lua",
type = "function",
},
{
pattern = {"##", "\n"},
syntax = ".lua",
type = "function",
},
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = { "%[%[", "%]%]" }, type = "string" },
{ pattern = { "%-%-%[=*%[", "%]=*%]"}, type = "comment" },
{ pattern = "%-%-.-\n", type = "comment" },
{ pattern = "0x%x+%.%x*[pP][-+]?%d+", type = "number" },
{ pattern = "0x%x+%.%x*", type = "number" },
{ pattern = "0x%.%x+[pP][-+]?%d+", type = "number" },
{ pattern = "0x%.%x+", type = "number" },
{ pattern = "0x%x+[pP][-+]?%d+", type = "number" },
{ pattern = "0x%x+", type = "number" },
{ pattern = "%d%.%d*[eE][-+]?%d+", type = "number" },
{ pattern = "%d%.%d*", type = "number" },
{ pattern = "%.?%d*[eE][-+]?%d+", type = "number" },
{ pattern = "<%S[%w+%._,%s*'\"()<>]-%S>", type = "keyword2" },
{ pattern = "%.?%d+", type = "number" },
{ pattern = "%.%.%.?", type = "operator" },
{ pattern = "[<>~=]=", type = "operator" },
{ pattern = "[%+%-=/%*%^%%#<>]", type = "operator" },
{ pattern = "[%a_][%w_]*()%s*%f[(\"'{]", type = {"function", "normal"} },
{ pattern = "[%a_][%w_]*", type = "symbol" },
{ pattern = "::[%a_][%w_]*::", type = "function" },
},
-- special symbols, like keywords
symbols = {
-- lua symbols
["if"] = "keyword",
["then"] = "keyword",
["else"] = "keyword",
["elseif"] = "keyword",
["end"] = "keyword",
["do"] = "keyword",
["function"] = "keyword",
["repeat"] = "keyword",
["until"] = "keyword",
["while"] = "keyword",
["for"] = "keyword",
["break"] = "keyword",
["return"] = "keyword",
["local"] = "keyword",
["in"] = "keyword",
["not"] = "keyword",
["and"] = "keyword",
["or"] = "keyword",
["goto"] = "keyword",
["self"] = "keyword2",
["true"] = "literal",
["false"] = "literal",
["nil"] = "literal",
-- nelua symbols
["global"] = "keyword",
["switch"] = "keyword",
["case"] = "keyword",
["defer"] = "keyword",
["continue"] = "keyword",
["nilptr"] = "keyword",
},
}
+394
View File
@@ -0,0 +1,394 @@
-- mod-version:3
local syntax = require "core.syntax"
-- Copied from https://github.com/shanoor/vscode-nginx/blob/master/syntaxes/nginx.tmLanguage
syntax.add {
name = "Nginx",
files = { "%.conf$" },
comment = "#",
patterns = {
{ pattern = "#.*", type = "comment" },
{ pattern = { '"', '"', }, type = "string" },
{ pattern = { "'", "'", }, type = "string" },
{ pattern = "[0-9]", type = "number" },
{ pattern = "[%a_][%w_]*", type = "symbol" },
{ pattern = "%$%w+", type = "keyword2" }
},
symbols = {
-- constant.language.module.events
["events"] = "keyword",
-- constant.language.module.http
["http"] = "keyword",
-- constant.language.directive.module.main
["daemon"] = "keyword",
["env"] = "keyword",
["debug_points"] = "keyword",
["error_log"] = "keyword",
["log_not_found"] = "keyword",
["include"] = "keyword",
["lock_file"] = "keyword",
["master_process"] = "keyword",
["pid"] = "keyword",
["ssl_engine"] = "keyword",
["timer_resolution"] = "keyword",
["types_hash_max_size"] = "keyword",
["user"] = "keyword",
["worker_cpu_affinity"] = "keyword",
["worker_priority"] = "keyword",
["worker_processes"] = "keyword",
["worker_rlimit_core"] = "keyword",
["worker_rlimit_nofile"] = "keyword",
["worker_rlimit_sigpending"] = "keyword",
["working_directory"] = "keyword",
["try_files"] = "keyword",
-- constant.language.directive.module.events
["accept_mutex"] = "keyword",
["accept_mutex_delay"] = "keyword",
["debug_connection"] = "keyword",
["devpoll_changes"] = "keyword",
["devpoll_events"] = "keyword",
["epoll_events"] = "keyword",
["kqueue_changes"] = "keyword",
["kqueue_events"] = "keyword",
["multi_accept"] = "keyword",
["rtsig_signo"] = "keyword",
["rtsig_overflow_events"] = "keyword",
["rtsig_overflow_test"] = "keyword",
["rtsig_overflow_threshold"] = "keyword",
["use"] = "keyword",
["worker_connections"] = "keyword",
-- constant.language.directive.module.http
["alias"] = "keyword",
["chunked_transfer_encoding"] = "keyword",
["client_body_in_file_only"] = "keyword",
["client_body_buffer_size"] = "keyword",
["client_body_temp_path"] = "keyword",
["client_body_timeout"] = "keyword",
["client_header_buffer_size"] = "keyword",
["client_header_timeout"] = "keyword",
["client_max_body_size"] = "keyword",
["default_type"] = "keyword",
["error_page"] = "keyword",
["index"] = "keyword",
["internal"] = "keyword",
["keepalive_timeout"] = "keyword",
["keepalive_requests"] = "keyword",
["large_client_header_buffers"] = "keyword",
["limit_except"] = "keyword",
["limit_rate"] = "keyword",
["listen"] = "keyword",
["location"] = "keyword",
["msie_padding"] = "keyword",
["msie_refresh"] = "keyword",
["optimize_server_names"] = "keyword",
["port_in_redirect"] = "keyword",
["recursive_error_pages"] = "keyword",
["reset_timedout_connection"] = "keyword",
["resolver"] = "keyword",
["resolver_timeout"] = "keyword",
["root"] = "keyword",
["satisfy_any"] = "keyword",
["send_timeout"] = "keyword",
["sendfile"] = "keyword",
["server"] = "keyword",
["server_name"] = "keyword",
["server_names_hash_max_size"] = "keyword",
["server_names_hash_bucket_size"] = "keyword",
["tcp_nodelay"] = "keyword",
["tcp_nopush"] = "keyword",
["types"] = "keyword",
["try_files"] = "keyword",
-- constant.language.module.http.addition
["add_before_body"] = "keyword",
["add_after_body"] = "keyword",
["addition_types"] = "keyword",
-- constant.language.module.http.access
["allow"] = "keyword",
["deny"] = "keyword",
-- constant.language.module.http.auth_basic
["auth_basic"] = "keyword",
["auth_basic_user_file"] = "keyword",
-- constant.language.module.http.auth_jwt
["auth_jwt"] = "keyword",
["auth_jwt_header_set"] = "keyword",
["auth_jwt_claim_set"] = "keyword",
["auth_jwt_key_file"] = "keyword",
-- constant.language.module.http.autoindex
["autoindex"] = "keyword",
["autoindex_exact_size"] = "keyword",
["autoindex_format"] = "keyword",
["autoindex_localtime"] = "keyword",
-- constant.language.module.http.browser
["ancient_browser"] = "keyword",
["ancient_browser_value"] = "keyword",
["modern_browser"] = "keyword",
["modern_browser_value"] = "keyword",
-- constant.language.module.http.charset
["charset"] = "keyword",
["charset_map"] = "keyword",
["override_charset"] = "keyword",
["source_charset"] = "keyword",
-- constant.language.module.http.empty_gif
["empty_gif"] = "keyword",
-- constant.language.module.http.fastcgi
["fastcgi_index"] = "keyword",
["fastcgi_hide_header"] = "keyword",
["fastcgi_ignore_client_abort"] = "keyword",
["fastcgi_intercept_errors"] = "keyword",
["fastcgi_param"] = "keyword",
["fastcgi_pass"] = "keyword",
["fastcgi_pass_header"] = "keyword",
["fastcgi_read_timeout"] = "keyword",
["fastcgi_redirect_errors"] = "keyword",
["fa"] = "keyword",
["stcgi_storefastcgi_store_access"] = "keyword",
["fastcgi_buffers"] = "keyword",
["fastcgi_buffers_size"] = "keyword",
["fastcgi_temp_path"] = "keyword",
["fastcgi_buffer_size"] = "keyword",
["fastcgi_connect_timeout"] = "keyword",
["fastcgi_send_timeout"] = "keyword",
["fastcgi_split_path_info"] = "keyword",
-- constant.language.module.http.geo
["geo"] = "keyword",
-- constant.language.module.http.gzip
["gzip"] = "keyword",
["gzip_buffers"] = "keyword",
["gzip_comp_level"] = "keyword",
["gzip_disable"] = "keyword",
["gzip_http.version"] = "keyword",
["gzip_min_length"] = "keyword",
["gzip_proxied"] = "keyword",
["gzip_types"] = "keyword",
["gzip_vary"] = "keyword",
["gzip_static"] = "keyword",
-- constant.language.module.http.headers
["add_header"] = "keyword",
["expires"] = "keyword",
["server_tokens"] = "keyword",
-- constant.language.module.http.referer
["valid_referers"] = "keyword",
-- constant.language.module.http.limit_zone
["limit_zone"] = "keyword",
["limit_conn"] = "keyword",
-- constant.language.module.http.limit_req
["limit_req"] = "keyword",
["limit_req_log_level"] = "keyword",
["limit_req_status"] = "keyword",
["limit_req_zone"] = "keyword",
-- constant.language.module.http.log
["access_log"] = "keyword",
["log_format"] = "keyword",
-- constant.language.module.http.map
["map"] = "keyword",
["map_hash_max_size"] = "keyword",
["map_hash_bucket_size"] = "keyword",
-- constant.language.module.http.memcached
["memcached_pass"] = "keyword",
["memcached_connect_timeout"] = "keyword",
["memcached_send_timeout"] = "keyword",
["memcached_read_timeout"] = "keyword",
["memcached_buffer_size"] = "keyword",
["memcached_next_upstream"] = "keyword",
-- constant.language.module.http.proxy
["proxy_buffer_size"] = "keyword2",
["proxy_buffering"] = "keyword2",
["proxy_buffers"] = "keyword2",
["proxy_busy_buffers_size"] = "keyword2",
["proxy_cache"] = "keyword2",
["proxy_cache_background_update"] = "keyword2",
["proxy_cache_bypass"] = "keyword2",
["proxy_cache_convert_head"] = "keyword2",
["proxy_cache_key"] = "keyword2",
["proxy_cache_lock"] = "keyword2",
["proxy_cache_lock_age"] = "keyword2",
["proxy_cache_lock_timeout"] = "keyword2",
["proxy_cache_max_range_offset"] = "keyword2",
["proxy_cache_methods"] = "keyword2",
["proxy_cache_min_uses"] = "keyword2",
["proxy_cache_path"] = "keyword2",
["proxy_cache_purge"] = "keyword2",
["proxy_cache_revalidate"] = "keyword2",
["proxy_cache_use_stale"] = "keyword2",
["proxy_cache_valid"] = "keyword2",
["proxy_connect_timeout"] = "keyword2",
["proxy_headers_hash_bucket_size"] = "keyword2",
["proxy_headers_hash_max_size"] = "keyword2",
["proxy_hide_header"] = "keyword2",
["proxy_http_version"] = "keyword2",
["proxy_ignore_client_abort"] = "keyword2",
["proxy_intercept_errors"] = "keyword2",
["proxy_max_temp_file_size"] = "keyword2",
["proxy_method"] = "keyword2",
["proxy_next_upstream"] = "keyword2",
["proxy_next_upstream_tries"] = "keyword2",
["proxy_next_upstream_timeout"] = "keyword2",
["proxy_pass"] = "keyword2",
["proxy_pass_header"] = "keyword2",
["proxy_pass_request_body"] = "keyword2",
["proxy_pass_request_headers"] = "keyword2",
["proxy_read_timeout"] = "keyword2",
["proxy_redirect"] = "keyword2",
["proxy_redirect_errors"] = "keyword2",
["proxy_send_lowat"] = "keyword2",
["proxy_send_timeout"] = "keyword2",
["proxy_set_body"] = "keyword2",
["proxy_set_header"] = "keyword2",
["proxy_store"] = "keyword2",
["proxy_store_access"] = "keyword2",
["proxy_temp_file_write_size"] = "keyword2",
["proxy_temp_path"] = "keyword2",
["proxy_upstream_fail_timeout"] = "keyword2",
["proxy_upstream_max_fails"] = "keyword2",
["proxy_no_cache"] = "keyword2",
-- constant.language.module.http.realip
["set_real_ip_from"] = "keyword",
["real_ip_header"] = "keyword",
["real_ip_recursive"] = "keyword",
-- constant.language.module.http.rewrite
["break"] = "keyword",
["if"] = "keyword",
["return"] = "keyword",
["rewrite"] = "keyword",
["set"] = "keyword",
["uninitialized_variable_warn"] = "keyword",
-- constant.language.module.http.ssi
["ssi"] = "keyword",
["ssi_silent_errors"] = "keyword",
["ssi_types"] = "keyword",
["ssi_value_length"] = "keyword",
-- constant.language.module.http.upstream
["ip_hash"] = "keyword",
["upstream"] = "keyword",
["server"] = "keyword",
-- constant.language.module.http.userid
["userid"] = "keyword",
["userid_domain"] = "keyword",
["userid_expires"] = "keyword",
["userid_name"] = "keyword",
["userid_p3p"] = "keyword",
["userid_path"] = "keyword",
["userid_service"] = "keyword",
-- constant.language.module.http.uwsgi
["uwsgi_bind"] = "keyword",
["uwsgi_buffer_size"] = "keyword",
["uwsgi_buffering"] = "keyword",
["uwsgi_buffers"] = "keyword",
["uwsgi_busy_buffers_size"] = "keyword",
["uwsgi_cache"] = "keyword",
["uwsgi_cache_background_update"] = "keyword",
["uwsgi_cache_bypass"] = "keyword",
["uwsgi_cache_key"] = "keyword",
["uwsgi_cache_lock"] = "keyword",
["uwsgi_cache_lock_age"] = "keyword",
["uwsgi_cache_lock_timeout"] = "keyword",
["uwsgi_cache_max_range_offset"] = "keyword",
["uwsgi_cache_methods"] = "keyword",
["uwsgi_cache_min_uses"] = "keyword",
["uwsgi_cache_path"] = "keyword",
["uwsgi_cache_purge"] = "keyword",
["uwsgi_cache_revalidate"] = "keyword",
["uwsgi_cache_use_stale"] = "keyword",
["uwsgi_cache_valid"] = "keyword",
["uwsgi_connect_timeout"] = "keyword",
["uwsgi_force_ranges"] = "keyword",
["uwsgi_hide_header"] = "keyword",
["uwsgi_ignore_client_abort"] = "keyword",
["uwsgi_ignore_headers"] = "keyword",
["uwsgi_intercept_errors"] = "keyword",
["uwsgi_limit_rate"] = "keyword",
["uwsgi_max_temp_file_size"] = "keyword",
["uwsgi_modifier1"] = "keyword",
["uwsgi_modifier2"] = "keyword",
["uwsgi_next_upstream"] = "keyword",
["uwsgi_next_upstream_timeout"] = "keyword",
["uwsgi_next_upstream_tries"] = "keyword",
["uwsgi_no_cache"] = "keyword",
["uwsgi_param"] = "keyword",
["uwsgi_pass"] = "keyword",
["uwsgi_pass_header"] = "keyword",
["uwsgi_pass_request_body"] = "keyword",
["uwsgi_pass_request_headers"] = "keyword",
["uwsgi_read_timeout"] = "keyword",
["uwsgi_request_buffering"] = "keyword",
["uwsgi_send_timeout"] = "keyword",
["uwsgi_ssl_certificate"] = "keyword",
["uwsgi_ssl_certificate_key"] = "keyword",
["uwsgi_ssl_ciphers"] = "keyword",
["uwsgi_ssl_crl"] = "keyword",
["uwsgi_ssl_name"] = "keyword",
["uwsgi_ssl_password_file"] = "keyword",
["uwsgi_ssl_protocols"] = "keyword",
["uwsgi_ssl_server_name"] = "keyword",
["uwsgi_ssl_session_reuse"] = "keyword",
["uwsgi_ssl_trusted_certificate"] = "keyword",
["uwsgi_ssl_verify"] = "keyword",
["uwsgi_ssl_verify_depth"] = "keyword",
["uwsgi_store"] = "keyword",
["uwsgi_store_access"] = "keyword",
["uwsgi_temp_file_write_size"] = "keyword",
["uwsgi_temp_path"] = "keyword",
-- constant.language.directive.module.http
["ssl"] = "keyword",
["ssl_buffer_size"] = "keyword",
["ssl_certificate"] = "keyword",
["ssl_certificate_key"] = "keyword",
["ssl_ciphers"] = "keyword",
["ssl_client_certificate"] = "keyword",
["ssl_crl"] = "keyword",
["ssl_dhparam"] = "keyword",
["ssl_ecdh_curve"] = "keyword",
["ssl_password_file"] = "keyword",
["ssl_prefer_server_ciphers"] = "keyword",
["ssl_protocols"] = "keyword",
["ssl_session_cache"] = "keyword",
["ssl_session_ticket_key"] = "keyword",
["ssl_session_tickets"] = "keyword",
["ssl_session_timeout"] = "keyword",
["ssl_stapling"] = "keyword",
["ssl_stapling_file"] = "keyword",
["ssl_stapling_responder"] = "keyword",
["ssl_stapling_verify"] = "keyword",
["ssl_trusted_certificate"] = "keyword",
["ssl_verify_client"] = "keyword",
["ssl_verify_depth"] = "keyword",
["true"] = "literal",
["false"] = "literal",
["on"] = "literal",
["off"] = "literal",
["all"] = "literal",
["null"] = "literal"
},
}
+145
View File
@@ -0,0 +1,145 @@
-- mod-version:3
local syntax = require "core.syntax"
local patterns = {}
local symbols = {
["nil"] = "literal",
["true"] = "literal",
["false"] = "literal",
}
local number_patterns = {
"0[bB][01][01_]*",
"0o[0-7][0-7_]*",
"0[xX]%x[%x_]*",
"%d[%d_]*%.%d[%d_]*[eE][-+]?%d[%d_]*",
"%d[%d_]*%.%d[%d_]*",
"%d[%d_]*",
}
local type_suffix_patterns = {}
for _, size in ipairs({"", "8", "16", "32", "64"}) do
table.insert(type_suffix_patterns, "'?[fuiFUI]"..size)
end
for _, pattern in ipairs(number_patterns) do
for _, suffix in ipairs(type_suffix_patterns) do
table.insert(patterns, { pattern = pattern..suffix, type = "literal" })
end
table.insert(patterns, { pattern = pattern, type = "literal" })
end
local keywords = {
"addr", "and", "as", "asm",
"bind", "block", "break",
"case", "cast", "concept", "const", "continue", "converter",
"defer", "discard", "distinct", "div", "do",
"elif", "else", "end", "enum", "except", "export",
"finally", "for", "from", "func",
"if", "import", "in", "include", "interface", "is", "isnot", "iterator",
"let",
"macro", "method", "mixin", "mod",
"not", "notin",
"object", "of", "or", "out",
"proc", "ptr",
"raise", "ref", "return",
"shl", "shr", "static",
"template", "try", "tuple", "type",
"using",
"var",
"when", "while",
"xor",
"yield",
}
for _, keyword in ipairs(keywords) do
symbols[keyword] = "keyword"
end
local standard_types = {
"bool", "byte",
"int", "int8", "int16", "int32", "int64",
"uint", "uint8", "uint16", "uint32", "uint64",
"float", "float32", "float64",
"char", "string", "cstring",
"pointer",
"typedesc",
"void", "auto", "any",
"untyped", "typed",
"clong", "culong", "cchar", "cschar", "cshort", "cint", "csize", "csize_t",
"clonglong", "cfloat", "cdouble", "clongdouble", "cuchar", "cushort",
"cuint", "culonglong", "cstringArray",
}
for _, type in ipairs(standard_types) do
symbols[type] = "keyword2"
end
local standard_generic_types = {
"range",
"array", "open[aA]rray", "varargs", "seq", "set",
"sink", "lent", "owned",
}
for _, type in ipairs(standard_generic_types) do
table.insert(patterns, { pattern = type.."%f[%[]", type = "keyword2" })
table.insert(patterns, { pattern = type.." +%f[%w]", type = "keyword2" })
end
local function string_pattern(start, stop, syntax)
return {
pattern = { start, stop, '\\' },
type = "string",
syntax = syntax and {
patterns = syntax,
symbols = {},
} or nil
}
end
local interpolation_syntax = {
{ pattern = { '{{', '}}' }, type = "string" },
{ pattern = { '{', '}', '\\' }, type = "keyword2", syntax = ".nim" },
{ pattern = "[%S][%w]*", type = "string" },
}
local user_patterns = {
-- comments
{ pattern = { "##?%[", "]##?" }, type = "comment" },
{ pattern = "##?.-\n", type = "comment" },
-- strings and chars
{ pattern = { "'", "'", '\\' }, type = "literal" },
string_pattern('"""', '"""%f[^"]'),
string_pattern('"' , '"' ),
string_pattern('\\"', '\\"' ), -- For highlighting strings inside iterpolated blocks
-- string interpolation
string_pattern('%&"""' , '"""%f[^"]', interpolation_syntax),
string_pattern('fmt"""', '"""%f[^"]', interpolation_syntax),
string_pattern('%&"' , '"' , interpolation_syntax),
string_pattern('fmt"' , '"' , interpolation_syntax),
-- function calls
{ pattern = "[a-zA-Z][a-zA-Z0-9_]*%f[(]", type = "function" },
-- identifiers
{ pattern = "[A-Z][a-zA-Z0-9_]*", type = "keyword2" },
{ pattern = "[a-zA-Z][a-zA-Z0-9_]*", type = "symbol" },
-- operators
{ pattern = "%.%f[^.]", type = "normal" },
{ pattern = ":%f[ ]", type = "normal" },
{ pattern = "[=+%-*/<>@$~&%%|!?%^&.:\\]+", type = "operator" },
}
for _, pattern in ipairs(user_patterns) do
table.insert(patterns, pattern)
end
local nim = {
name = "Nim",
files = { "%.nim$", "%.nims$", "%.nimble$" },
comment = "#",
patterns = patterns,
symbols = symbols,
}
syntax.add(nim)
+87
View File
@@ -0,0 +1,87 @@
-- mod-version:3
-- https://nixos.wiki/wiki/Overview_of_the_Nix_Language
local syntax = require "core.syntax"
local function merge_tables(a, b)
for _, v in pairs(b) do
table.insert(a, v)
end
end
local default_symbols = {
["import"] = "keyword2",
["with"] = "keyword2",
["builtins"] = "keyword2",
["inherit"] = "keyword2",
["assert"] = "keyword2",
["let"] = "keyword2",
["in"] = "keyword2",
["rec"] = "keyword2",
["if"] = "keyword",
["else"] = "keyword",
["then"] = "keyword",
["true"] = "literal",
["false"] = "literal",
["null"] = "literal",
}
local default_patterns = {}
local string_interpolation = {
{ pattern = {"%${", "}"}, type = "keyword2", syntax = {
patterns = default_patterns,
symbols = default_symbols,
}},
{ pattern = "[%S][%w]*", type = "string" },
}
merge_tables(default_patterns, {
{ pattern = "#.*", type = "comment" },
{ pattern = {"/%*", "%*/"}, type = "comment" },
{ pattern = "-?%.?%d+", type = "number" },
-- interpolation
{ pattern = {"%${", "}"}, type = "keyword2", syntax = {
patterns = default_patterns,
symbols = default_symbols,
}},
{ pattern = {'"', '"', '\\'}, type = "string", syntax = {
patterns = string_interpolation,
symbols = {},
}},
{ pattern = {"''", "''"}, type = "string", syntax = {
patterns = string_interpolation,
symbols = {},
}},
-- operators
{ pattern = "[%+%-%?!>%*]", type = "operator" },
{ pattern = "/ ", type = "operator" },
{ pattern = "< ", type = "operator" },
{ pattern = "//", type = "operator" },
{ pattern = "&&", type = "operator" },
{ pattern = "%->", type = "operator" },
{ pattern = "||", type = "operator" },
{ pattern = "==", type = "operator" },
{ pattern = "!=", type = "operator" },
{ pattern = ">=", type = "operator" },
{ pattern = "<=", type = "operator" },
-- paths (function because its not used otherwise)
{ pattern = "%.?%.?/[^%s%[%]%(%){};,:]+", type = "function" },
{ pattern = "~/[^%s%[%]%(%){};,:]+", type = "function" },
{ pattern = {"<", ">"}, type = "function" },
-- every other symbol
{ pattern = "[%a%-%_][%w%-%_]*", type = "symbol" },
{ pattern = ";%.,:", type = "normal" },
})
syntax.add {
name = "Nix",
files = {"%.nix$"},
comment = "#",
block_comment = {"/*", "*/"},
patterns = default_patterns,
symbols = default_symbols,
}
+63
View File
@@ -0,0 +1,63 @@
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "Objective-C",
files = { "%.m$" },
comment = "//",
patterns = {
{ pattern = "//.-\n", type = "comment" },
{ pattern = { "/%*", "%*/" }, type = "comment" },
{ pattern = { "#", "[^\\]\n" }, type = "comment" },
{ 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_]*%f[(]", type = "function" },
{ pattern = "@[%a_][%w_]*", type = "keyword2" },
{ pattern = "[%a_][%w_]*", type = "symbol" },
},
symbols = {
["if"] = "keyword",
["then"] = "keyword",
["else"] = "keyword",
["elseif"] = "keyword",
["do"] = "keyword",
["while"] = "keyword",
["for"] = "keyword",
["break"] = "keyword",
["continue"] = "keyword",
["return"] = "keyword",
["goto"] = "keyword",
["struct"] = "keyword",
["union"] = "keyword",
["typedef"] = "keyword",
["enum"] = "keyword",
["extern"] = "keyword",
["static"] = "keyword",
["volatile"] = "keyword",
["const"] = "keyword",
["inline"] = "keyword",
["switch"] = "keyword",
["case"] = "keyword",
["default"] = "keyword",
["auto"] = "keyword",
["const"] = "keyword",
["void"] = "keyword",
["int"] = "keyword2",
["short"] = "keyword2",
["long"] = "keyword2",
["float"] = "keyword2",
["double"] = "keyword2",
["char"] = "keyword2",
["unsigned"] = "keyword2",
["bool"] = "keyword2",
["true"] = "literal",
["false"] = "literal",
["NULL"] = "literal",
["nil"] = "literal",
},
}
+162
View File
@@ -0,0 +1,162 @@
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "Odin",
files = "%.odin$",
comment = "//",
block_comment = { "/*", "*/" },
patterns = {
{ pattern = "//.-\n", type = "comment" },
{ pattern = { "/%*", "%*/" }, type = "comment" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = { "`", "`" }, type = "string" },
{ pattern = "0b[01_]+", type = "number" },
{ pattern = "0o[0-7_]+", type = "number" },
{ pattern = "0[dz][%d_]+", type = "number" },
{ pattern = "0x[%da-fA-F_]+", type = "number" },
{ pattern = "-?%d+[%d%._e]*i?", type = "number" },
{ pattern = "[<>~=+-*/]=", type = "operator" },
{ pattern = "%.%.", type = "operator" },
{ pattern = "[%+%-=/%*%^%%<>!~|&:%?]", type = "operator" },
{ pattern = "%$[%a_][%w_]*", type = "operator" },
{ pattern = "[%a_][%w_]*%f[(]", type = "function" },
{ pattern = "[#@][%a_][%w_]*", type = "keyword2" },
{ pattern = "[#@]%b()", type = "keyword2" },
{ pattern = "[%a_][%w_]*", type = "symbol" },
},
symbols = {
-- Keywords
["package"] = "keyword",
["import"] = "keyword",
["foreign"] = "keyword",
["when"] = "keyword",
["if"] = "keyword",
["else"] = "keyword",
["for"] = "keyword",
["defer"] = "keyword",
["return"] = "keyword",
["switch"] = "keyword",
["case"] = "keyword",
["in"] = "keyword",
["not_in"] = "keyword",
["do"] = "keyword",
["break"] = "keyword",
["continue"] = "keyword",
["fallthrough"] = "keyword",
["proc"] = "keyword",
["struct"] = "keyword",
["union"] = "keyword",
["enum"] = "keyword",
["bit_set"] = "keyword",
["map"] = "keyword",
["dynamic"] = "keyword",
["using"] = "keyword",
["context"] = "keyword",
["distinct"] = "keyword",
["asm"] = "keyword",
["or_break"] = "keyword",
["or_continue"] = "keyword",
["or_else"] = "keyword",
["or_return"] = "keyword",
-- Builtin procedures and directives
["cast"] = "keyword2",
["auto_cast"] = "keyword2",
["transmute"] = "keyword2",
["len"] = "keyword2",
["cap"] = "keyword2",
["size_of"] = "keyword2",
["align_of"] = "keyword2",
["offset_of"] = "keyword2",
["offset_of_selector"] = "keyword2",
["offset_of_member"] = "keyword2",
["offset_of_by_string"] = "keyword2",
["typeid_of"] = "keyword2",
["type_of"] = "keyword2",
["type_info_of"] = "keyword2",
["type_info_base"] = "keyword2",
["swizzle"] = "keyword2",
["complex"] = "keyword2",
["quaternion"] = "keyword2",
["real"] = "keyword2",
["imag"] = "keyword2",
["jmag"] = "keyword2",
["kmag"] = "keyword2",
["conj"] = "keyword2",
["expand_values"] = "keyword2",
["min"] = "keyword2",
["max"] = "keyword2",
["abs"] = "keyword2",
["clamp"] = "keyword2",
["assert"] = "keyword2",
["soa_zip"] = "keyword2",
["soa_unzip"] = "keyword2",
["raw_data"] = "keyword2",
-- Types
["rawptr"] = "keyword2",
["typeid"] = "keyword2",
["any"] = "keyword2",
["string"] = "keyword2",
["cstring"] = "keyword2",
["int"] = "keyword2",
["uint"] = "keyword2",
["uintptr"] = "keyword2",
["rune"] = "keyword2",
["byte"] = "keyword2",
["u8"] = "keyword2",
["u16"] = "keyword2",
["u32"] = "keyword2",
["u64"] = "keyword2",
["u128"] = "keyword2",
["i8"] = "keyword2",
["i16"] = "keyword2",
["i32"] = "keyword2",
["i64"] = "keyword2",
["i128"] = "keyword2",
["f16"] = "keyword2",
["f32"] = "keyword2",
["f64"] = "keyword2",
["f16le"] = "keyword2",
["f32le"] = "keyword2",
["f64le"] = "keyword2",
["f16be"] = "keyword2",
["f32be"] = "keyword2",
["f64be"] = "keyword2",
["u16le"] = "keyword2",
["u32le"] = "keyword2",
["u64le"] = "keyword2",
["u128le"] = "keyword2",
["i16le"] = "keyword2",
["i32le"] = "keyword2",
["i64le"] = "keyword2",
["i128le"] = "keyword2",
["u16be"] = "keyword2",
["u32be"] = "keyword2",
["u64be"] = "keyword2",
["u128be"] = "keyword2",
["i16be"] = "keyword2",
["i32be"] = "keyword2",
["i64be"] = "keyword2",
["i128be"] = "keyword2",
["complex32"] = "keyword2",
["complex64"] = "keyword2",
["complex128"] = "keyword2",
["quaternion64"] = "keyword2",
["quaternion128"] = "keyword2",
["quaternion256"] = "keyword2",
["bool"] = "keyword2",
["b8"] = "keyword2",
["b16"] = "keyword2",
["b32"] = "keyword2",
["b64"] = "keyword2",
["b128"] = "keyword2",
-- Literals
["true"] = "literal",
["false"] = "literal",
["nil"] = "literal",
}
}
+119
View File
@@ -0,0 +1,119 @@
-- mod-version:3
local syntax = require "core.syntax"
-- Language Syntax References
-- https://openscad.org/documentation.html#language-reference
syntax.add {
name = "OpenSCAD",
files = {"%.scad$"},
comment = "//",
block_comment = { "/*", "*/" },
patterns = {
{ pattern = "//.*", type = "comment" }, -- Single-line comment
{ pattern = { "/%*", "%*/" }, type = "comment" }, -- Multi-line comment
{ pattern = { '"', '"', '\\' }, type = "string" }, -- String, double quotes
{ pattern = { "'", "'", '\\' }, type = "string" }, -- String, apices
{ pattern = "-?0x%x+", type = "number" }, -- ?
{ pattern = "-?%d+[%d%.eE]*[a-zA-Z]?", type = "number" }, -- ?
{ pattern = "-?%.?%d+", type = "number" }, -- ?
{ pattern = "[%+%-=/%*%^%%<>!~|&%?%:]", type = "operator" }, -- Operators
{ pattern = "[%a_][%w_]*%f[(]", type = "function" }, -- Functions
{ regex = "\\$[a-zA-Z]+", type = "keyword" }, -- Special variables
{ pattern = "[%a_][%w_]*", type = "symbol" },
},
symbols = {
-- ?
["var"] = "keyword",
["module"] = "keyword",
["function"] = "keyword",
["include"] = "keyword",
["use"] = "keyword",
-- Constants
["undef"] = "keyword2",
["PI"] = "keyword2",
-- 2D
["circle"] = "keyword",
["square"] = "keyword",
["polygon"] = "keyword",
["text"] = "keyword",
["import"] = "keyword",
["projection"] = "keyword",
-- 3D
["sphere"] = "keyword",
["cube"] = "keyword",
["cylinder"] = "keyword",
["polyhedron"] = "keyword",
["surface"] = "keyword",
-- Transformations
["linear_extrude"] = "keyword",
["rotate_extrude"] = "keyword",
["translate"] = "keyword",
["rotate"] = "keyword",
["scale"] = "keyword",
["resize"] = "keyword",
["mirror"] = "keyword",
["multmatrix"] = "keyword",
["color"] = "keyword",
["offset"] = "keyword",
["hull"] = "keyword",
["minkowski"] = "keyword",
-- Boolean Operations
["union"] = "keyword",
["difference"] = "keyword",
["intersection"] = "keyword",
-- Flow Control
["for"] = "keyword",
["each"] = "keyword",
-- Type Test Functions
["is_undef"] = "function",
["is_bool"] = "function",
["is_num"] = "function",
["is_string"] = "function",
["is_list"] = "function",
["is_function"] = "function",
-- Other
["echo"] = "keyword",
["render"] = "keyword",
["children"] = "keyword",
["assert"] = "keyword",
-- Functions
["concat"] = "function",
["lookup"] = "function",
["str"] = "function",
["chr"] = "function",
["ord"] = "function",
["search"] = "function",
["version"] = "function",
["version_num"] = "function",
["parent_module"] = "function",
-- Math Functions
["abs"] = "keyword",
["sign"] = "keyword",
["sin"] = "keyword",
["cos"] = "keyword",
["tan"] = "keyword",
["acos"] = "keyword",
["asin"] = "keyword",
["atan"] = "keyword",
["atan2"] = "keyword",
["floor"] = "keyword",
["round"] = "keyword",
["ceil"] = "keyword",
["ln"] = "keyword",
["len"] = "keyword",
["let"] = "keyword",
["log"] = "keyword",
["pow"] = "keyword",
["sqrt"] = "keyword",
["exp"] = "keyword",
["rands"] = "keyword",
["min"] = "keyword",
["max"] = "keyword",
["norm"] = "keyword",
["cross"] = "keyword",
-- Literals
["true"] = "literal",
["false"] = "literal",
}
}
+291
View File
@@ -0,0 +1,291 @@
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "Perl",
files = { "%.pm$", "%.pl$" },
headers = "^#!.*[ /]perl",
comment = "#",
patterns = {
{ pattern = "%#.-\n", type = "comment" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = { "qw%(", "%)", '\\' }, type = "string" },
{ pattern = { "qw%[", "%]", '\\' }, type = "string" },
{ pattern = { "qw%/", "%/", '\\' }, type = "string" },
{ pattern = { "qq?%(", "%)", '\\' }, type = "string" },
{ pattern = { "qq?%[", "%]", '\\' }, type = "string" },
{ pattern = { "qq?%/", "%/", '\\' }, type = "string" },
{ pattern = { "^=%w+", "=cut" }, type = "comment" },
-- until we can get this workign with s///, just don't do any of them.
-- { pattern = { '/', '/', '\\' }, type = "string" },
{ pattern = "-?%d+[%d%.eE]*", type = "number" },
{ pattern = "-?%.?%d+", type = "number" },
{ pattern = "[%a_][%w_]*%f[(]", type = "function" },
{ pattern = "[%@%$%*%%]+[%a_][%w_]*", type = "keyword2" },
{ pattern = "[%a_][%w_]*%s+()=>", type = { "string", "operator" } },
{ pattern = "sub%s+()[%w_]+", type = { "keyword", "operator" } },
{ pattern = "[<=>%+%-%*%/:%&%|%!%?%~]+", type = "operator" },
{ pattern = "%--[%a_][%w_]*", type = "symbol" },
},
symbols = {
["-A"] = "keyword",
["END"] = "keyword",
["length"] = "keyword",
["setpgrp"] = "keyword",
["-B"] = "keyword",
["endgrent"] = "keyword",
["link"] = "keyword",
["setpriority"] = "keyword",
["-b"] = "keyword",
["endhostent"] = "keyword",
["listen"] = "keyword",
["setprotoent"] = "keyword",
["-C"] = "keyword",
["endnetent"] = "keyword",
["local"] = "keyword",
["setpwent"] = "keyword",
["-c"] = "keyword",
["endprotoent"] = "keyword",
["localtime"] = "keyword",
["setservent"] = "keyword",
["-d"] = "keyword",
["endpwent"] = "keyword",
["log"] = "keyword",
["setsockopt"] = "keyword",
["-e"] = "keyword",
["endservent"] = "keyword",
["lstat"] = "keyword",
["shift"] = "keyword",
["-f"] = "keyword",
["eof$"] = "keyword",
["map"] = "keyword",
["shmctl"] = "keyword",
["-g"] = "keyword",
["eval"] = "keyword",
["mkdir"] = "keyword",
["shmget"] = "keyword",
["-k"] = "keyword",
["exec"] = "keyword",
["msgctl"] = "keyword",
["shmread"] = "keyword",
["-l"] = "keyword",
["exists"] = "keyword",
["msgget"] = "keyword",
["shmwrite"] = "keyword",
["-M"] = "keyword",
["exit"] = "keyword",
["msgrcv"] = "keyword",
["shutdown"] = "keyword",
["-O"] = "keyword",
["fcntl"] = "keyword",
["msgsnd"] = "keyword",
["sin"] = "keyword",
["-o"] = "keyword",
["fileno"] = "keyword",
["my"] = "keyword",
["sleep"] = "keyword",
["-p"] = "keyword",
["flock"] = "keyword",
["next"] = "keyword",
["socket"] = "keyword",
["package"] = "keyword",
["-r"] = "keyword",
["fork"] = "keyword",
["not"] = "keyword",
["socketpair"] = "keyword",
["-R"] = "keyword",
["format"] = "keyword",
["oct"] = "keyword",
["sort"] = "keyword",
["-S"] = "keyword",
["formline"] = "keyword",
["open"] = "keyword",
["splice"] = "keyword",
["-s"] = "keyword",
["getc"] = "keyword",
["opendir"] = "keyword",
["split"] = "keyword",
["-T"] = "keyword",
["getgrent"] = "keyword",
["ord"] = "keyword",
["sprintf"] = "keyword",
["-t"] = "keyword",
["getgrgid"] = "keyword",
["our"] = "keyword",
["sqrt"] = "keyword",
["-u"] = "keyword",
["getgrnam"] = "keyword",
["pack"] = "keyword",
["srand"] = "keyword",
["-w"] = "keyword",
["gethostbyaddr"] = "keyword",
["pipe"] = "keyword",
["stat"] = "keyword",
["-W"] = "keyword",
["gethostbyname"] = "keyword",
["pop"] = "keyword",
["state"] = "keyword",
["-X"] = "keyword",
["gethostent"] = "keyword",
["pos"] = "keyword",
["study"] = "keyword",
["-x"] = "keyword",
["getlogin"] = "keyword",
["print"] = "keyword",
["substr"] = "keyword",
["-z"] = "keyword",
["getnetbyaddr"] = "keyword",
["printf"] = "keyword",
["symlink"] = "keyword",
["abs"] = "keyword",
["getnetbyname"] = "keyword",
["prototype"] = "keyword",
["syscall"] = "keyword",
["accept"] = "keyword",
["getnetent"] = "keyword",
["push"] = "keyword",
["sysopen"] = "keyword",
["alarm"] = "keyword",
["getpeername"] = "keyword",
["quotemeta"] = "keyword",
["sysread"] = "keyword",
["atan2"] = "keyword",
["getpgrp"] = "keyword",
["rand"] = "keyword",
["sysseek"] = "keyword",
["AUTOLOAD"] = "keyword",
["getppid"] = "keyword",
["read"] = "keyword",
["system"] = "keyword",
["BEGIN"] = "keyword",
["getpriority"] = "keyword",
["readdir"] = "keyword",
["syswrite"] = "keyword",
["bind"] = "keyword",
["getprotobyname"] = "keyword",
["readline"] = "keyword",
["tell"] = "keyword",
["binmode"] = "keyword",
["getprotobynumber"] = "keyword",
["SUPER"] = "keyword",
["readlink"] = "keyword",
["telldir"] = "keyword",
["bless"] = "keyword",
["sub"] = "keyword",
["getprotoent"] = "keyword",
["readpipe"] = "keyword",
["tie"] = "keyword",
["getpwent"] = "keyword",
["recv"] = "keyword",
["tied"] = "keyword",
["caller"] = "keyword",
["getpwnam"] = "keyword",
["redo"] = "keyword",
["time"] = "keyword",
["chdir"] = "keyword",
["getpwuid"] = "keyword",
["ref"] = "keyword",
["times"] = "keyword",
["CHECK"] = "keyword",
["getservbyname"] = "keyword",
["rename"] = "keyword",
["truncate"] = "keyword",
["chmod"] = "keyword",
["getservbyport"] = "keyword",
["require"] = "keyword",
["uc"] = "keyword",
["chomp"] = "keyword",
["getservent"] = "keyword",
["reset"] = "keyword",
["ucfirst"] = "keyword",
["chop"] = "keyword",
["getsockname"] = "keyword",
["return"] = "keyword",
["umask"] = "keyword",
["chown"] = "keyword",
["getsockopt"] = "keyword",
["reverse"] = "keyword",
["undef"] = "keyword",
["chr"] = "keyword",
["glob"] = "keyword",
["rewinddir"] = "keyword",
["UNITCHECK"] = "keyword",
["chroot"] = "keyword",
["gmtime"] = "keyword",
["rindex"] = "keyword",
["unlink"] = "keyword",
["close"] = "keyword",
["goto"] = "keyword",
["rmdir"] = "keyword",
["unpack"] = "keyword",
["closedir"] = "keyword",
["grep"] = "keyword",
["say"] = "keyword",
["unshift"] = "keyword",
["connect"] = "keyword",
["hex"] = "keyword",
["scalar"] = "keyword",
["untie"] = "keyword",
["cos"] = "keyword",
["index"] = "keyword",
["seek"] = "keyword",
["use"] = "keyword",
["crypt"] = "keyword",
["INIT"] = "keyword",
["seekdir"] = "keyword",
["utime"] = "keyword",
["dbmclose"] = "keyword",
["int"] = "keyword",
["select"] = "keyword",
["values"] = "keyword",
["dbmopen"] = "keyword",
["ioctl"] = "keyword",
["semctl"] = "keyword",
["vec"] = "keyword",
["defined"] = "keyword",
["join"] = "keyword",
["semget"] = "keyword",
["wait"] = "keyword",
["delete"] = "keyword",
["keys"] = "keyword",
["semop"] = "keyword",
["waitpid"] = "keyword",
["DESTROY"] = "keyword",
["kill"] = "keyword",
["send"] = "keyword",
["wantarray"] = "keyword",
["die"] = "keyword",
["last"] = "keyword",
["setgrent"] = "keyword",
["warn"] = "keyword",
["dump"] = "keyword",
["lc"] = "keyword",
["sethostent"] = "keyword",
["write"] = "keyword",
["each"] = "keyword",
["lcfirst"] = "keyword",
["setnetent"] = "keyword",
["while"] = "keyword",
["for"] = "keyword",
["if"] = "keyword",
["else"] = "keyword",
["elsif"] = "keyword",
["unless"] = "keyword",
["no"] = "keyword",
["new"] = "keyword",
["do"] = "keyword",
["__PACKAGE__"] = "keyword",
["warnings"] = "keyword2",
["strict"] = "keyword2",
["eq"] = "operator",
["ne"] = "operator",
["lt"] = "operator",
["gt"] = "operator",
["le"] = "operator",
["ge"] = "operator",
["cmp"] = "operator",
["STDERR"] = "keyword2",
["STDOUT"] = "keyword2"
}
}
+421
View File
@@ -0,0 +1,421 @@
-- mod-version:3
--[[
language_php.lua
provides php syntax support allowing mixed html, css and js
version: 20220614_1
--]]
local syntax = require "core.syntax"
local common = require "core.common"
local config = require "core.config"
-- load syntax dependencies to add additional rules
require "plugins.language_css"
require "plugins.language_js"
local psql_found = pcall(require, "plugins.language_psql")
local sql_strings = {}
config.plugins.language_php = common.merge({
sql_strings = true,
-- The config specification used by the settings gui
config_spec = {
name = "Language PHP",
{
label = "SQL Strings",
description = "Highlight as SQL, strings starting with sql statements, "
.. "depends on language_psql.",
path = "sql_strings",
type = "toggle",
default = true,
on_apply = function(enabled)
local syntax_php = syntax.get("file.phps")
if enabled and psql_found then
if
not syntax_php.patterns[6].syntax
or
syntax_php.patterns[6].syntax ~= '.sql'
then
table.insert(syntax_php.patterns, 5, sql_strings[1])
table.insert(syntax_php.patterns, 6, sql_strings[2])
end
elseif
syntax_php.patterns[6].syntax
and
syntax_php.patterns[6].syntax == '.sql'
then
table.remove(syntax_php.patterns, 5)
table.remove(syntax_php.patterns, 5)
end
end
}
}
}, config.plugins.language_php)
-- Patterns to match some of the string inline variables
local inline_variables = {
{ pattern = "%s+", type = "string" },
{ pattern = "\\%$", type = "string" },
{ pattern = "%{[%$%s]*%}", type = "string" },
-- matches {$varname[index]}
{ pattern = "{"
.. "()%$[%a_][%w_]*"
.. "()%["
.. "()[%w%s_%-\"\'%(%)|;:,%.#@%%!%^&%*%+=%[%]<>~`%?\\/]*"
.. "()%]"
.. "}",
type = {
"keyword", "keyword2", "keyword", "string", "keyword"
}
},
{ pattern = "{"
.. "()%$[%a_][%w_]*"
.. "()%->"
.. "()[%a_][%w_]*"
.. "()}",
type = {
"keyword", "keyword2", "keyword", "symbol", "keyword"
}
},
{ pattern = "{()%$[%a_][%w_]*()}",
type = { "keyword", "keyword2", "keyword" }
},
{ pattern = "%$[%a_][%w_]*()%[()[%w_]*()%]",
type = { "keyword2", "keyword", "string", "keyword" }
},
{ pattern = "%$[%a_][%w_]*()%->()%a[%w_]*",
type = { "keyword2", "keyword", "symbol" }
},
{ pattern = "%$[%a_][%w_]*", type = "keyword2" },
{ pattern = "%w+", type = "string" }
}
local function combine_patterns(t1, t2)
local temp = { table.unpack(t1) }
for _, t in ipairs(t2) do
table.insert(temp, t)
end
return temp
end
local function clone(tbl)
local t = {}
if tbl then
for k, v in pairs(tbl) do
if type(v) == "table" then
t[k] = clone(v)
else
t[k] = v
end
end
end
return t
end
-- optionally allow sql syntax on strings
if psql_found then
-- generate SQL string marker regex
local sql_markers = { 'create', 'select', 'insert', 'update', 'replace', 'delete', 'drop', 'alter' }
local sql_regex = table.concat(sql_markers, '|')
-- inject inline variable rules to cloned psql syntax
local syntax_phpsql = clone(syntax.get("file.sql"))
syntax_phpsql.name = "PHP SQL"
syntax_phpsql.files = "%.phpsql$"
table.insert(syntax_phpsql.patterns, 2, { pattern = "\\%$", type = "symbol" })
table.insert(syntax_phpsql.patterns, 3, { pattern = "%{[%$%s]*%}", type = "symbol" })
for i=4, 9 do
table.insert(syntax_phpsql.patterns, i, inline_variables[i])
end
-- SQL strings
sql_strings = {
{
regex = { '"(?=[\\s(]*(?i:'..sql_regex..')\\s+)', '"', '\\' },
syntax = syntax_phpsql,
type = "string"
},
{
regex = { "'(?=[\\s(]*(?i:"..sql_regex..")\\s+)", '\'', '\\' },
syntax = '.sql',
type = "string"
},
}
end
-- define the core php syntax coloring
syntax.add {
name = "PHP Source",
files = { "%.phps$" },
headers = "^<%?php",
comment = "//",
block_comment = {"/*", "*/"},
patterns = {
-- Attributes
{ pattern = {"#%[", "%]"}, type = "normal" },
-- Comments
{ pattern = "//.-\n", type = "comment" },
{ pattern = "#.-\n", type = "comment" },
{ pattern = { "/%*", "%*/" }, type = "comment" },
-- Single quote string
{ pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = { "<<<'%a%w*'\n", "^%s*%a%w*%f[;]", '\\' },
type = "string"
},
-- Strings with support for some inline variables syntax
{ pattern = { "<<<%a%w*\n", "^%s*%a%w*%f[;]", '\\' },
syntax = {
patterns = combine_patterns(inline_variables, {
-- prevent matching outside of the parent string
{ pattern = "^%s*%a%w*();$",
type = { "string", "normal" }
},
{ pattern = "%p", type = "string" },
}),
symbols = {}
},
type = "string"
},
{ pattern = { '"', '"', '\\' },
syntax = {
patterns = combine_patterns(inline_variables, {
-- prevent matching outside of the parent string
{ pattern = "[^\"]", type = "string" },
{ pattern = "%p+%f[\"]", type = "string" },
{ pattern = "%p", type = "string" },
}),
symbols = {}
},
type = "string"
},
{ pattern = { '`', '`', '\\' },
syntax = {
patterns = combine_patterns(inline_variables, {
-- prevent matching outside of the parent string
{ pattern = "[^`]", type = "string" },
{ pattern = "%p+%f[`]", type = "string" },
{ pattern = "%p", type = "string" },
}),
symbols = {}
},
type = "string"
},
{ pattern = "0[bB][%d]+", type = "number" },
{ pattern = "0[xX][%da-fA-F]+", type = "number" },
{ pattern = "-?%d[%d_%.eE]*", type = "number" },
{ pattern = "-?%.?%d+", type = "number" },
{ pattern = "[%.%+%-=/%*%^%%<>!~|&%?:@]", type = "operator" },
-- Variables
{ pattern = "%$[%w_]+", type = "keyword2" },
-- Respect control structures, treat as keyword not function
{ pattern = "if[%s]*%f[(]", type = "keyword" },
{ pattern = "else[%s]*%f[(]", type = "keyword" },
{ pattern = "elseif[%s]*%f[(]", type = "keyword" },
{ pattern = "for[%s]*%f[(]", type = "keyword" },
{ pattern = "foreach[%s]*%f[(]", type = "keyword" },
{ pattern = "while[%s]*%f[(]", type = "keyword" },
{ pattern = "catch[%s]*%f[(]", type = "keyword" },
{ pattern = "switch[%s]*%f[(]", type = "keyword" },
{ pattern = "match[%s]*%f[(]", type = "keyword" },
{ pattern = "fn[%s]*%f[(]", type = "keyword" },
-- All functions that aren't control structures
{ pattern = "[%a_][%w_]*[%s]*%f[(]", type = "function" },
-- Array type hint not added on symbols to also make it work
-- as a function call
{ pattern = "array", type = "literal" },
-- Match static or namespace container on sub element access
{ pattern = "[%a_][%w_]*[%s]*%f[:]", type = "literal" },
-- Uppercase constants of at least 2 chars in len
{
pattern = "%u[%u_][%u%d_]*%f[%s%+%*%-%.%(%)%?%^%%=/<>~|&;:,!]",
type = "number"
},
-- Magic constants
{ pattern = "__[%u]+__", type = "number" },
-- Everything else
{ pattern = "[%a_][%w_]*", type = "symbol" },
},
symbols = {
["return"] = "keyword",
["if"] = "keyword",
["else"] = "keyword",
["elseif"] = "keyword",
["endif"] = "keyword",
["declare"] = "keyword",
["enddeclare"] = "keyword",
["switch"] = "keyword",
["endswitch"] = "keyword",
["as"] = "keyword",
["do"] = "keyword",
["for"] = "keyword",
["endfor"] = "keyword",
["foreach"] = "keyword",
["endforeach"] = "keyword",
["while"] = "keyword",
["endwhile"] = "keyword",
["match"] = "keyword",
["case"] = "keyword",
["continue"] = "keyword",
["default"] = "keyword",
["break"] = "keyword",
["goto"] = "keyword",
["yield"] = "keyword",
["try"] = "keyword",
["catch"] = "keyword",
["throw"] = "keyword",
["finally"] = "keyword",
["class"] = "keyword",
["enum"] = "keyword",
["trait"] = "keyword",
["interface"] = "keyword",
["public"] = "keyword",
["static"] = "keyword",
["protected"] = "keyword",
["private"] = "keyword",
["readonly"] = "keyword",
["abstract"] = "keyword",
["final"] = "keyword",
["$this"] = "literal",
["function"] = "keyword",
["fn"] = "keyword",
["global"] = "keyword",
["var"] = "keyword",
["const"] = "keyword",
["bool"] = "literal",
["boolean"] = "literal",
["int"] = "literal",
["integer"] = "literal",
["real"] = "literal",
["double"] = "literal",
["float"] = "literal",
["string"] = "literal",
["object"] = "literal",
["callable"] = "literal",
["iterable"] = "literal",
["void"] = "literal",
["parent"] = "literal",
["self"] = "literal",
["mixed"] = "literal",
["never"] = "literal",
["namespace"] = "keyword",
["extends"] = "keyword",
["implements"] = "keyword",
["instanceof"] = "keyword",
["require"] = "keyword",
["require_once"] = "keyword",
["include"] = "keyword",
["include_once"] = "keyword",
["use"] = "keyword",
["new"] = "keyword",
["clone"] = "keyword",
["true"] = "number",
["false"] = "number",
["NULL"] = "number",
["null"] = "number",
["print"] = "function",
["echo"] = "function",
["exit"] = "function",
},
}
-- insert sql string rules after the "/%*", "%*/" pattern
if psql_found and config.plugins.language_php.sql_strings then
local syntax_php = syntax.get("file.phps")
table.insert(syntax_php.patterns, 5, sql_strings[1])
table.insert(syntax_php.patterns, 6, sql_strings[2])
end
-- allows html, css and js coloring on php files
syntax.add {
name = "PHP",
files = { "%.php$", "%.phtml" },
block_comment = { "<!--", "-->" },
patterns = {
{
regex = {
"<\\?php\\s+",
"(?:\\?>|(?=`{3}))" -- end if inside markdown code tags
},
syntax = ".phps",
type = "keyword2"
},
{
pattern = {
"<%?=?",
"%?>"
},
syntax = ".phps",
type = "keyword2"
},
{
pattern = {
"<%s*[sS][cC][rR][iI][pP][tT]%f[%s>].->",
"<%s*/%s*[sS][cC][rR][iI][pP][tT]%s*>"
},
syntax = ".js",
type = "function"
},
{
pattern = {
"<%s*[sS][tT][yY][lL][eE]%f[%s>].->",
"<%s*/%s*[sS][tT][yY][lL][eE]%s*>"
},
syntax = ".css",
type = "function"
},
{ pattern = { "<!%-%-", "%-%->" }, type = "comment" },
{ pattern = { '%f[^>][^<]', '%f[<]' }, type = "normal" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = "0x[%da-fA-F]+", type = "number" },
{ pattern = "-?%d+[%d%.]*f?", type = "number" },
{ pattern = "-?%.?%d+f?", type = "number" },
{ pattern = "%f[^<]![%a_][%w_]*", type = "keyword2" },
{ pattern = "%f[^<][%a_][%w_]*", type = "function" },
{ pattern = "%f[^<]/[%a_][%w_]*", type = "function" },
{ pattern = "[%a_][%w_]*", type = "keyword" },
{ pattern = "[/<>=]", type = "operator" },
-- match markdown code tags to be able to end php highlighting
-- when inside the subsyntax .phps
{ regex = "(?=`{3})", type = "string" }
},
symbols = {},
}
-- allow coloring of php code inside css and js code
local syntaxes = { "css", "js" }
for _, ext in pairs(syntaxes) do
local syntax_table = syntax.get("file."..ext, "")
table.insert(
syntax_table.patterns,
1,
{
pattern = {
"<%?=?",
"%?>"
},
syntax = ".phps",
type = "keyword2"
}
)
table.insert(
syntax_table.patterns,
1,
{
pattern = {
"<%?php%s+",
"%?>"
},
syntax = ".phps",
type = "keyword2"
}
)
end
+53
View File
@@ -0,0 +1,53 @@
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "PICO-8",
files = "%.p8$",
headers = "^pico-8 cartridge",
comment = "--",
patterns = {
{ pattern = { 'pico%-8 cartridge', '__lua__' }, type = "comment" },
{ pattern = { '__gfx__\n', '%z' }, type = "comment" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = { "%[%[", "%]%]" }, type = "string" },
{ pattern = { "%-%-%[%[", "%]%]"}, type = "comment" },
{ pattern = "%-%-.-\n", type = "comment" },
{ pattern = "-?0x%x+", type = "number" },
{ pattern = "-?%d+[%d%.eE]*", type = "number" },
{ pattern = "-?%.?%d+", type = "number" },
{ pattern = "%.%.%.?", type = "operator" },
{ pattern = "[<>~=&|]=", type = "operator" },
{ pattern = "[%+%-=/%*%^%%#<>]", type = "operator" },
{ pattern = "[%a_][%w_]*%s*%f[(\"{]", type = "function" },
{ pattern = "[%a_][%w_]*", type = "symbol" },
{ pattern = "::[%a_][%w_]*::", type = "function" },
},
symbols = {
["if"] = "keyword",
["then"] = "keyword",
["else"] = "keyword",
["elseif"] = "keyword",
["end"] = "keyword",
["do"] = "keyword",
["function"] = "keyword",
["repeat"] = "keyword",
["until"] = "keyword",
["while"] = "keyword",
["for"] = "keyword",
["break"] = "keyword",
["return"] = "keyword",
["local"] = "keyword",
["in"] = "keyword",
["not"] = "keyword",
["and"] = "keyword",
["or"] = "keyword",
["goto"] = "keyword",
["self"] = "keyword2",
["true"] = "literal",
["false"] = "literal",
["nil"] = "literal",
},
}
+251
View File
@@ -0,0 +1,251 @@
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "PKGBUILD",
files = { PATHSEP .. "PKGBUILD$" },
comment = "#",
patterns = {
-- Don't colorize number of arguments expression as comment
{ pattern = "%$#", type = "keyword2" },
{ pattern = "#.*", type = "comment" },
-- Strings
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = { '`', '`', '\\' }, type = "string" },
-- Ignore numbers that start with dots or slashes
{ pattern = "%f[%w_%.%/]%d[%d%.]*%f[^%w_%.]", type = "number" },
-- Custom keyword matches
{ pattern = "source%f[=]", type = "literal" },
{ pattern = "[ \t]source ", type = "keyword" },
{ pattern = "install%f[=]", type = "literal" },
{ pattern = "[ \t]tar ", type = "keyword" },
{ pattern = "[ \t]install ", type = "keyword" },
{ pattern = "[ \t]arch%-meson ", type = "keyword" },
{ pattern = "[ \t]patch ", type = "keyword" },
{ pattern = "[ \t]git ", type = "keyword" },
{ pattern = "[ \t]svn ", type = "keyword" },
{ pattern = "[ \t]fossil ", type = "keyword" },
{ pattern = "[ \t]meson ", type = "keyword" },
{ pattern = "[ \t]ninja ", type = "keyword" },
{ pattern = "[ \t]cmake ", type = "keyword" },
{ pattern = "[ \t]waf ", type = "keyword" },
{ pattern = "[ \t]%./configure[%s%c]+", type = "keyword" },
-- Operators
{ pattern = "[!<>|&%[%]:=*]", type = "operator" },
-- Match parameters
{ pattern = "%f[%S][%+%-][%w%-_:]+", type = "function" },
{ pattern = "%f[%S][%+%-][%w%-_]+%f[=]", type = "function" },
-- Prevent parameters with assignments from been matched as variables
{
pattern = "%s%-%a[%w_%-]*%s+()%d[%d%.]+",
type = { "function", "number" }
},
{
pattern = "%s%-%a[%w_%-]*%s+()%a[%a%-_:=]+",
type = { "function", "symbol" }
},
-- Match variable assignments
{ pattern = "[_%a][%w_]+%f[%+=]", type = "keyword2" },
-- Match variable expansions
{ pattern = "%${.-}", type = "keyword2" },
{ pattern = "%$[%d%$%a_@*][%w_]*", type = "keyword2" },
-- Functions
{ pattern = "[%a_%-][%w_%-]*[%s]*%f[(]", type = "function" },
-- Everything else
{ pattern = "[%a_][%w_]*", type = "symbol" },
},
symbols = {
-- Bash keywords
["true"] = "literal",
["false"] = "literal",
["case"] = "keyword",
["in"] = "keyword",
["esac"] = "keyword",
["if"] = "keyword",
["then"] = "keyword",
["elif"] = "keyword",
["else"] = "keyword",
["fi"] = "keyword",
["until"] = "keyword",
["while"] = "keyword",
["do"] = "keyword",
["done"] = "keyword",
["for"] = "keyword",
["break"] = "keyword",
["continue"] = "keyword",
["shift"] = "keyword",
["function"] = "keyword",
["local"] = "keyword",
["echo"] = "keyword",
["return"] = "keyword",
["exit"] = "keyword",
["alias"] = "keyword",
["test"] = "keyword",
["select"] = "keyword",
["type"] = "keyword",
["declare"] = "keyword",
["set"] = "keyword",
["unalias"] = "keyword",
["unset"] = "keyword",
["enable"] = "keyword",
["eval"] = "keyword",
["exec"] = "keyword",
["export"] = "keyword",
["getopts"] = "keyword",
["hash"] = "keyword",
["history"] = "keyword",
["help"] = "keyword",
["jobs"] = "keyword",
["kill"] = "keyword",
["let"] = "keyword",
["mapfile"] = "keyword",
["readarray"] = "keyword",
-- Commands
["printf"] = "keyword",
["read"] = "keyword",
["pwd"] = "keyword",
["time"] = "keyword",
["cd"] = "keyword",
["cp"] = "keyword",
["mv"] = "keyword",
["mkdir"] = "keyword",
["rm"] = "keyword",
["rmdir"] = "keyword",
["chown"] = "keyword",
["chmod"] = "keyword",
["touch"] = "keyword",
["ln"] = "keyword",
["cat"] = "keyword",
["sed"] = "keyword",
["awk"] = "keyword",
["find"] = "keyword",
["grep"] = "keyword",
["head"] = "keyword",
["less"] = "keyword",
["gcc"] = "keyword",
["gpp"] = "keyword",
["make"] = "keyword",
["qmake"] = "keyword",
-- PKGBUILD keywords
["pkgbase"] = "literal",
["pkgname"] = "literal",
["pkgver"] = "literal",
["pkgrel"] = "literal",
["epoch"] = "literal",
["pkgdesc"] = "literal",
["arch"] = "literal",
["url"] = "literal",
["license"] = "literal",
["groups"] = "literal",
["depends"] = "literal",
["depends_arm"] = "literal",
["depends_armv6h"] = "literal",
["depends_armv7h"] = "literal",
["depends_aarch64"] = "literal",
["depends_i686"] = "literal",
["depends_x86_64"] = "literal",
["makedepends"] = "literal",
["makedepends_arm"] = "literal",
["makedepends_armv6h"] = "literal",
["makedepends_armv7h"] = "literal",
["makedepends_aarch64"] = "literal",
["makedepends_i686"] = "literal",
["makedepends_x86_64"] = "literal",
["checkdepends"] = "literal",
["checkdepends_arm"] = "literal",
["checkdepends_armv6h"] = "literal",
["checkdepends_armv7h"] = "literal",
["checkdepends_aarch64"] = "literal",
["checkdepends_i686"] = "literal",
["checkdepends_x86_64"] = "literal",
["optdepends"] = "literal",
["optdepends_arm"] = "literal",
["optdepends_armv6h"] = "literal",
["optdepends_armv7h"] = "literal",
["optdepends_aarch64"] = "literal",
["optdepends_i686"] = "literal",
["optdepends_x86_64"] = "literal",
["provides"] = "literal",
["provides_arm"] = "literal",
["provides_armv6h"] = "literal",
["provides_armv7h"] = "literal",
["provides_aarch64"] = "literal",
["provides_i686"] = "literal",
["provides_x86_64"] = "literal",
["conflicts"] = "literal",
["conflicts_arm"] = "literal",
["conflicts_armv6h"] = "literal",
["conflicts_armv7h"] = "literal",
["conflicts_aarch64"] = "literal",
["conflicts_i686"] = "literal",
["conflicts_x86_64"] = "literal",
["replaces"] = "literal",
["replaces_arm"] = "literal",
["replaces_armv6h"] = "literal",
["replaces_armv7h"] = "literal",
["replaces_aarch64"] = "literal",
["replaces_i686"] = "literal",
["replaces_x86_64"] = "literal",
["backup"] = "literal",
["options"] = "literal",
["changelog"] = "literal",
["source_arm"] = "literal",
["source_armv6h"] = "literal",
["source_armv7h"] = "literal",
["source_aarch64"] = "literal",
["source_i686"] = "literal",
["source_x86_64"] = "literal",
["noextract"] = "literal",
["validpgpkeys"] = "literal",
["md5sums"] = "literal",
["md5sums_arm"] = "literal",
["md5sums_armv6h"] = "literal",
["md5sums_armv7h"] = "literal",
["md5sums_aarch64"] = "literal",
["md5sums_i686"] = "literal",
["md5sums_x86_64"] = "literal",
["sha1sums"] = "literal",
["sha1sums_arm"] = "literal",
["sha1sums_armv6h"] = "literal",
["sha1sums_armv7h"] = "literal",
["sha1sums_aarch64"] = "literal",
["sha1sums_i686"] = "literal",
["sha1sums_x86_64"] = "literal",
["sha256sums"] = "literal",
["sha256sums_arm"] = "literal",
["sha256sums_armv6h"] = "literal",
["sha256sums_armv7h"] = "literal",
["sha256sums_aarch64"] = "literal",
["sha256sums_i686"] = "literal",
["sha256sums_x86_64"] = "literal",
["sha224sums"] = "literal",
["sha224sums_arm"] = "literal",
["sha224sums_armv6h"] = "literal",
["sha224sums_armv7h"] = "literal",
["sha224sums_aarch64"] = "literal",
["sha224sums_i686"] = "literal",
["sha224sums_x86_64"] = "literal",
["sha384sums"] = "literal",
["sha384sums_arm"] = "literal",
["sha384sums_armv6h"] = "literal",
["sha384sums_armv7h"] = "literal",
["sha384sums_aarch64"] = "literal",
["sha384sums_i686"] = "literal",
["sha384sums_x86_64"] = "literal",
["sha512sums"] = "literal",
["sha512sums_arm"] = "literal",
["sha512sums_armv6h"] = "literal",
["sha512sums_armv7h"] = "literal",
["sha512sums_aarch64"] = "literal",
["sha512sums_i686"] = "literal",
["sha512sums_x86_64"] = "literal",
["b2sums"] = "literal",
["b2sums_arm"] = "literal",
["b2sums_armv6h"] = "literal",
["b2sums_armv7h"] = "literal",
["b2sums_aarch64"] = "literal",
["b2sums_i686"] = "literal",
["b2sums_x86_64"] = "literal",
},
}
+21
View File
@@ -0,0 +1,21 @@
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "PO",
files = { "%.po$", "%.pot$" },
comment = "#",
patterns = {
{ pattern = { "#", "\n"}, type = "comment" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = "[%[%]]", type = "operator" },
{ pattern = "%d+", type = "number" },
{ pattern = "[%a_][%w_]*", type = "symbol" },
},
symbols = {
["msgctxt"] = "keyword",
["msgid"] = "keyword",
["msgid_plural"] = "keyword",
["msgstr"] = "keyword",
},
}
+77
View File
@@ -0,0 +1,77 @@
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "PowerShell",
files = {
"%.ps1$", "%.psm1$", "%.psd1$", "%.ps1xml$",
"%.pssc$", "%.psrc$", "%.cdxml$"
},
comment = "#",
patterns = {
{pattern = "#.*\n", type = "comment"},
{pattern = [[\.]], type = "normal"},
{pattern = {'"', '"'}, type = "string"},
{pattern = {"'", "'"}, type = "string"},
{pattern = "%f[%w_][%d%.]+%f[^%w_]", type = "number"},
{pattern = "[%+=/%*%^%%<>!~|&,:]+", type = "operator"},
{pattern = "%f[%S]%-[%w%-_]+", type = "function"},
{pattern = "[%u][%a]+[%-][%u][%a]+", type = "function"},
{pattern = "${.*}", type = "symbol"},
{pattern = "$[%a_@*][%w_]*", type = "keyword2"},
{pattern = "$[%$][%a]+", type = "keyword2"},
{pattern = "[%a_][%w_]*", type = "symbol"}
},
symbols = {
["if"] = "keyword",
["else"] = "keyword",
["elseif"] = "keyword",
["switch"] = "keyword",
["default"] = "keyword",
["function"] = "keyword",
["filter"] = "keyword",
["workflow"] = "keyword",
["configuration"] = "keyword",
["class"] = "keyword",
["enum"] = "keyword",
["Parameter"] = "keyword",
["ValidateScript"] = "keyword",
["CmdletBinding"] = "keyword",
["try"] = "keyword",
["catch"] = "keyword",
["finally"] = "keyword",
["throw"] = "keyword",
["while"] = "keyword",
["for"] = "keyword",
["do"] = "keyword",
["until"] = "keyword",
["break"] = "keyword",
["continue"] = "keyword",
["foreach"] = "keyword",
["in"] = "keyword",
["return"] = "keyword",
["where"] = "function",
["select"] = "function",
["filter"] = "keyword",
["in"] = "keyword",
["trap"] = "keyword",
["param"] = "keyword",
["data"] = "keyword",
["dynamicparam"] = "keyword",
["begin"] = "function",
["process"] = "function",
["end"] = "function",
["exit"] = "function",
["inlinescript"] = "function",
["parallel"] = "function",
["sequence"] = "function",
["true"] = "literal",
["false"] = "literal",
["TODO"] = "comment",
["FIXME"] = "comment",
["XXX"] = "comment",
["TBD"] = "comment",
["HACK"] = "comment",
["NOTE"] = "comment"
}
}
+92
View File
@@ -0,0 +1,92 @@
-- mod-version:3
local syntax = require "core.syntax"
-- In sql symbols can be lower case and upper case
local keywords = {
"CREATE", "SELECT", "ADD", "INSERT", "INTO", "UPDATE",
"DELETE", "TABLE", "DROP", "VALUES", "NOT",
"NULL", "PRIMARY", "KEY", "REFERENCES",
"DEFAULT", "UNIQUE", "CONSTRAINT", "CHECK",
"ON", "EXCLUDE", "WITH", "USING", "WHERE",
"GROUP", "BY", "HAVING", "DISTINCT", "LIMIT",
"OFFSET", "ONLY", "CROSS", "JOIN", "INNER",
"LEFT", "RIGHT", "FULL", "OUTER", "NATURAL",
"AND", "OR", "AS", "ORDER", "ORDINALITY",
"UNNEST", "FROM", "VIEW", "RETURNS", "SETOF",
"LANGUAGE", "SQL", "LIKE", "LATERAL",
"INTERVAL", "PARTITION", "UNION", "INTERSECT",
"EXCEPT", "ALL", "ASC", "DESC", "NULLS",
"FIRST", "LAST", "IN", "RECURSIVE", "ARRAY",
"RETURNING", "SET", "ALSO", "INSTEAD",
"ALTER", "SEQUENCE", "OWNED", "AT", "ZONE",
"WITHOUT", "TO", "TIMEZONE", "TYPE", "ENUM",
"DOCUMENT", "XMLPARSE", "XMLSERIALIZE",
"CONTENT", "OPTION", "INDEX", "ANY",
"EXTENSION", "ISNULL", "NOTNULL", "UNKNOWN",
"CASE", "THEN", "WHEN", "ELSE", "END",
"ROWS", "BETWEEN", "UNBOUNDED", "PRECEDING",
"UNBOUNDED", "FOLLOWING", "EXISTS", "SOME",
"COLLATION", "FOR", "TRIGGER", "BEFORE",
"EACH", "ROW", "EXECUTE", "PROCEDURE",
"FUNCTION", "DECLARE", "BEGIN", "LOOP",
"RAISE", "NOTICE", "LOOP", "EVENT",
"OPERATOR", "DOMAIN", "VARIADIC", "FOREIGN"
}
local types = {
"BIGINT", "INT8", "BIGSERIAL", "SERIAL8",
"BIT", "VARBIT", "BOOLEAN", "BOOL", "BOX",
"BYTEA", "CHARACTER", "CHAR", "VARCHAR",
"CIDR", "CIRCLE", "DATE", "DOUBLE",
"PRECISION", "FLOAT8", "INET", "INTEGER",
"INT", "INT4", "INTERVAL", "JSON", "JSONB",
"LINE", "LSEG", "MACADDR", "MONEY", "NUMERIC",
"DECIMAL", "PATH", "POINT", "POLYGON", "REAL",
"FLOAT4", "INT2", "SMALLINT", "SMALLSERIAL",
"SERIAL2", "SERIAL", "SERIAL4", "TEXT",
"TIME", "TIMEZ", "TIMESTAMP", "TIMESTAMPZ",
"TSQUERY", "TSVECTOR", "TXID_SNAPSHOT",
"UUID", "XML", "INT4RANGE", "INT8RANGE",
"NUMRANGE", "TSRANGE", "TSTZRANGE",
"DATERANGE", "PG_LSN"
}
local literals = {
"FALSE", "TRUE", "CURRENT_TIMESTAMP",
"CURRENT_TIME", "CURRENT_DATE", "LOCALTIME",
"LOCALTIMESTAMP"
}
local symbols = {}
for _, keyword in ipairs(keywords) do
symbols[keyword:lower()] = "keyword"
symbols[keyword] = "keyword"
end
for _, type in ipairs(types) do
symbols[type:lower()] = "keyword2"
symbols[type] = "keyword2"
end
for _, literal in ipairs(literals) do
symbols[literal:lower()] = "literal"
symbols[literal] = "literal"
end
syntax.add {
name = "PostgreSQL",
files = { "%.sql$", "%.psql$" },
comment = "--",
patterns = {
{ pattern = "%-%-.-\n", type = "comment" },
{ pattern = { "/%*", "%*/" }, type = "comment" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ 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 = symbols,
}
+60
View File
@@ -0,0 +1,60 @@
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "ReScript",
files = { "%.res$" },
comment = "//",
patterns = {
{ pattern = "//.-\n", type = "comment" },
{ pattern = { "/%*", "%*/" }, type = "comment" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = { "`", "`", '\\' }, type = "string" },
{ pattern = "#[%a_][%w_]*", type = "literal" },
{ pattern = "0x[%da-fA-F]+", type = "number" },
{ pattern = "-?%d+[%d%.eE]*", type = "number" },
{ pattern = "-?%.?%d+", type = "number" },
{ pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" },
{ pattern = "%f[^%.>]%l[%w_]*", type = "function" },
{ pattern = "%l[%w_]*%f[(]", type = "function" },
{ pattern = "%u[%w_]*", type = "keyword2" },
{ pattern = "[%l_][%w_%.]*", type = "symbol" },
{ pattern = "@%l[%w_]*", type = "string" },
},
symbols = {
["and"] = "keyword",
["array"] = "keyword2",
["as"] = "keyword",
["assert"] = "keyword",
["bool"] = "keyword2",
["constraint"] = "keyword",
["downto"] = "keyword",
["else"] = "keyword",
["exception"] = "keyword",
["external"] = "keyword",
["false"] = "literal",
["for"] = "keyword",
["if"] = "keyword",
["in"] = "keyword",
["int"] = "keyword2",
["include"] = "keyword",
["lazy"] = "keyword",
["let"] = "keyword",
["module"] = "keyword",
["mutable"] = "keyword",
["of"] = "keyword",
["open"] = "keyword",
["option"] = "keyword2",
["rec"] = "keyword",
["switch"] = "keyword",
["string"] = "keyword2",
["to"] = "keyword",
["true"] = "literal",
["try"] = "keyword",
["type"] = "keyword",
["when"] = "keyword",
["while"] = "keyword",
["with"] = "keyword",
}
}
+92
View File
@@ -0,0 +1,92 @@
-- mod-version:3
-- Refrence: https://ring-lang.github.io/doc1.21.2/syntaxflexibility.html
local syntax = require "core.syntax"
-- Keywords
local keywords = {
"enablehashcomments", "disablehashcomments", "call", "class", "from", "get", "give",
"import", "load", "new", "package", "private", "changeringkeyword", "changeringoperator",
"loadsyntax", "endclass", "endpackage", "if", "but", "else", "elseif", "ok", "for",
"foreach", "to", "next", "catch", "step", "endfor", "while", "other", "end", "do",
"endwhile", "endswitch", "endtry", "try", "break", "bye", "continue", "default",
"endfunc", "endfunction", "return", "switch", "case", "on", "off", "again", "exit",
"loop", "done", "in", "func", "def", "nl"
}
-- Types using ring type hints library
local types = {
"char", "unsigned", "signed", "int", "short", "long", "float", "double", "void",
"byte", "boolean", "string", "list", "number", "object", "public", "static",
"abstract", "protected", "override"
}
-- Special values
local literals = {
"true", "false", "null"
}
-- Built-in functions
local builtin_functions = {
"see", "put", "print"
}
local symbols = {}
for _, keyword in ipairs(keywords) do
symbols[keyword:upper()] = "keyword"
symbols[keyword:gsub("^%l", string.upper)] = "keyword"
symbols[keyword] = "keyword"
end
for _, type in ipairs(types) do
symbols[type:upper()] = "keyword2"
symbols[type:gsub("^%l", string.upper)] = "keyword2"
symbols[type] = "keyword2"
end
for _, literal in ipairs(literals) do
symbols[literal:upper()] = "literal"
symbols[literal:gsub("^%l", string.upper)] = "literal"
symbols[literal] = "literal"
end
for _, func in ipairs(builtin_functions) do
symbols[func:upper()] = "function"
symbols[func:gsub("^%l", string.upper)] = "function"
symbols[func] = "function"
end
local string_syntax = {
patterns = {
{ pattern = {"%#{", "}", "\\"}, type="keyword", syntax = ".ring" },
{ pattern = "[^#\"`']+", type = "string"},
{ pattern = "[#\"`']", type = "string"}
},
symbols = {}
}
syntax.add {
name = "Ring",
files = { "%.ring$", "%.rh$", "%.rform$" },
comment = "//",
patterns = {
{ pattern = "#.*", type = "comment" },
{ pattern = "//.*", type = "comment" },
{ pattern = { "/%*", "%*/" }, type = "comment" },
{ pattern = { '"', '"', '\\' }, type = "string", syntax = string_syntax },
{ pattern = { "'", "'", '\\' }, type = "string", syntax = string_syntax },
{ pattern = { "`", "`", '\\' }, type = "string", syntax = string_syntax },
{ pattern = "-?%d+[%d%.]*f?", type = "number" },
{ pattern = "-?0x%x+", type = "number" },
{ pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" },
{ pattern = "[%a_][%w_]*%f[(]", type = "function" },
{ pattern = "[Dd][Ee][Ff]()%s+()[%a_][%w_]*", type = { "keyword", "normal", "function" } },
{ pattern = "[Ff][Uu][Nn][Cc]()%s+()[%a_][%w_]*", type = { "keyword", "normal", "function" } },
{ pattern = "[Cc][Ll][Aa][Ss][Ss]()%s+()[%a_][%w_]*", type = { "keyword", "normal", "function" } },
{ pattern = "[%a_][%w_]*", type = "symbol" },
{ pattern = "%?", type = "keyword" },
{ pattern = ":[%a_][%w_]*", type = "literal" },
},
symbols = symbols
}
+102
View File
@@ -0,0 +1,102 @@
-- mod-version:3
-- Syntax highlighting for the Rivet programming language.
-- This plugin is always updated to the latest Rivet syntax.
-- By StunxFS =).
local syntax = require "core.syntax"
syntax.add {
name = "Rivet",
files = {"%.ri$"},
comment = "//",
block_comment = {"/*", "*/"},
patterns = {
{pattern = "//.*", type = "comment"},
{pattern = {"/%*", "%*/"}, type = "comment"},
{pattern = {'[bcr]?"', '"', "\\"}, type = "string"},
{pattern = {"[b]?'", "'", "\\"}, type = "string"},
{pattern = "0b[01_]+", type = "number"},
{pattern = "0o[0-7_]+", type = "number"},
{pattern = "0x[%x_]+", type = "number"},
{pattern = "%d[%d_]*%.[%d_]*[eE][-+]?%d+", type = "number"},
{pattern = "%d[%d_]*%.[%d_]*", type = "number"},
{pattern = "%d[%d_]*", type = "number"},
{pattern = "-?%.?%d+", type = "number"},
{pattern = "[%[%]%(%)%+%-=/%*%^%%<>!~|&%.%?:;]", type = "operator"},
{
pattern = "_?%u[%u_][%u%d_]*%f[%s%+%*%-%.%)%]}%?%^%%=/<>~|&;:,!]",
type = "literal"
},
-- types
{pattern = "[A-Z][%w_]*", type = "keyword2"},
-- builtin func/var
{pattern = "%@%s?[%a_][%w_]*", type = "literal"},
-- `defer` modes
{pattern = "defer%s?%(%s?()[%a_][%w_]*()%s?%)", type = {"keyword", "comment", "normal"} },
-- functions
{pattern = "[%a_][%w_]*%f[(]", type = "function"},
-- attributes
{pattern = "#%s?%[.*%]", type = "keyword2"},
-- symbols
{pattern = "[%a_][%w_]*", type = "symbol"}
},
symbols = {
["alias"] = "keyword",
["as"] = "keyword",
["break"] = "keyword",
["catch"] = "keyword",
["const"] = "keyword",
["continue"] = "keyword",
["defer"] = "keyword",
["else"] = "keyword",
["enum"] = "keyword",
["extend"] = "keyword",
["extern"] = "keyword",
["func"] = "keyword",
["for"] = "keyword",
["if"] = "keyword",
["import"] = "keyword",
["in"] = "keyword",
["is"] = "keyword",
["match"] = "keyword",
["mut"] = "keyword",
["pub"] = "keyword",
["return"] = "keyword",
["struct"] = "keyword",
["test"] = "keyword",
["throw"] = "keyword",
["trait"] = "keyword",
["unsafe"] = "keyword",
["var"] = "keyword",
["while"] = "keyword",
-- literals
["false"] = "literal",
["none"] = "literal",
["self"] = "literal",
["true"] = "literal",
-- types
["never"] = "keyword2",
["bool"] = "keyword2",
["comptime_int"] = "keyword2",
["comptime_float"] = "keyword2",
["int"] = "keyword2",
["int8"] = "keyword2",
["int16"] = "keyword2",
["int32"] = "keyword2",
["int64"] = "keyword2",
["uint"] = "keyword2",
["uint8"] = "keyword2",
["uint16"] = "keyword2",
["uint32"] = "keyword2",
["uint64"] = "keyword2",
["float32"] = "keyword2",
["float64"] = "keyword2",
["rawptr"] = "keyword2",
["rune"] = "keyword2",
["string"] = "keyword2",
["Self"] = "keyword2"
}
}
+73
View File
@@ -0,0 +1,73 @@
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "Ruby",
files = { "%.rb$", PATHSEP .. "%.gemspec$", PATHSEP .. "Gemfile$", PATHSEP .. "Gemfile%.lock$" },
headers = "^#!.*[ /]ruby",
comment = "#",
patterns = {
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = "-?0x%x+", type = "number" },
{ pattern = "%#.-\n", type = "comment" },
{ 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 = "keyword2" },
{ pattern = "::[%w_]*", type = "symbol" },
{ pattern = ":[%w_]*", type = "keyword2" },
{ pattern = "[%a_][%w_]*:[^:]", type = "keyword2" },
{ pattern = "[%a_][%w_]*", type = "symbol" },
},
symbols = {
["nil"] = "literal",
["true"] = "literal",
["false"] = "literal",
["private"] = "keyword",
["extend"] = "keyword",
["include"] = "keyword",
["require"] = "keyword",
["require_dependency"] = "keyword",
["__ENCODING__"] = "keyword",
["__LINE__"] = "keyword",
["__FILE__"] = "keyword",
["BEGIN"] = "keyword",
["END"] = "keyword",
["alias"] = "keyword",
["and"] = "keyword",
["begin"] = "keyword",
["break"] = "keyword",
["case"] = "keyword",
["class"] = "keyword",
["def"] = "keyword",
["defined?"] = "keyword",
["do"] = "keyword",
["else"] = "keyword",
["elsif"] = "keyword",
["end"] = "keyword",
["ensure"] = "keyword",
["for"] = "keyword",
["if"] = "keyword",
["in"] = "keyword",
["module"] = "keyword",
["next"] = "keyword",
["not"] = "keyword",
["or"] = "keyword",
["redo"] = "keyword",
["rescue"] = "keyword",
["retry"] = "keyword",
["return"] = "keyword",
["self"] = "keyword",
["super"] = "keyword",
["then"] = "keyword",
["undef"] = "keyword",
["unless"] = "keyword",
["until"] = "keyword",
["when"] = "keyword",
["while"] = "keyword",
["yield"] = "keyword"
},
}
+89
View File
@@ -0,0 +1,89 @@
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "Rust",
files = { "%.rs$" },
comment = "//",
block_comment = { "/*", "*/" },
patterns = {
{ pattern = "//.-\n", type = "comment" },
{ pattern = { "/%*", "%*/" }, type = "comment" },
{ pattern = { 'r#"', '"#', '\\' }, type = "string" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = "'.'", type = "string" },
{ pattern = "'[%a_][%a%d_]*", type = "keyword2" },
{ 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" },
{ regex = "[[:alpha:]_][\\w]*(?=\\s*<[\\w\\s,']+>\\s*\\()", type = "function" },
{ pattern = "[%a_][%w_]*!%f[%[(]", type = "function" },
{ pattern = "[%a_][%w_]*%f[(]", type = "function" },
{ pattern = "[%a_][%w_]*", type = "symbol" },
},
symbols = {
["as"] = "keyword",
["async"] = "keyword",
["await"] = "keyword",
["break"] = "keyword",
["const"] = "keyword",
["continue"] = "keyword",
["crate"] = "keyword",
["dyn"] = "keyword",
["else"] = "keyword",
["enum"] = "keyword",
["extern"] = "keyword",
["fn"] = "keyword",
["for"] = "keyword",
["if"] = "keyword",
["impl"] = "keyword",
["in"] = "keyword",
["let"] = "keyword",
["loop"] = "keyword",
["match"] = "keyword",
["mod"] = "keyword",
["move"] = "keyword",
["mut"] = "keyword",
["pub"] = "keyword",
["ref"] = "keyword",
["return"] = "keyword",
["Self"] = "keyword",
["self"] = "keyword",
["static"] = "keyword",
["struct"] = "keyword",
["super"] = "keyword",
["trait"] = "keyword",
["type"] = "keyword",
["unsafe"] = "keyword",
["use"] = "keyword",
["where"] = "keyword",
["while"] = "keyword",
["i32"] = "keyword2",
["i64"] = "keyword2",
["i128"] = "keyword2",
["i16"] = "keyword2",
["i8"] = "keyword2",
["u8"] = "keyword2",
["u16"] = "keyword2",
["u32"] = "keyword2",
["u64"] = "keyword2",
["usize"] = "keyword2",
["isize"] = "keyword2",
["f32"] = "keyword2",
["f64"] = "keyword2",
["f128"] = "keyword2",
["String"] = "keyword2",
["char"] = "keyword2",
["str"] = "keyword2",
["bool"] = "keyword2",
["true"] = "literal",
["false"] = "literal",
["None"] = "literal",
["Some"] = "literal",
["Option"] = "literal",
["Result"] = "literal",
},
}
+47
View File
@@ -0,0 +1,47 @@
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "Sass",
files = { "%.sass$" ,"%.scss$"},
comment = "//",
patterns = {
{ pattern = "/[/%*].-\n", type = "comment" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = "$%w+", type = "keyword" },
{ pattern = "@%w+", type = "literal" },
{ pattern = "[#,]%w+", type = "function" },
{ pattern = "&", type = "keyword2" },
{ pattern = "[:%/%*%-]", type = "operator" },
{ pattern = "[%a][%w-]*%s*%f[:]", type = "keyword2" },
{ pattern = "-?%d+[%d%.]*p[xt]", type = "number" },
{ pattern = "-?%d+[%d%.]*deg", type = "number" },
{ pattern = "-?%d+[%d%.]*[s%%]", type = "number" },
{ pattern = "-?%d+[%d%.]*", type = "number" },
{ pattern = "[%a_][%w_]*", type = "symbol" },
},
symbols = {
["transparent"] = "literal",
["none"] = "literal",
["absolute"] = "literal",
["relative"] = "literal",
["solid"] = "literal",
["flex"] = "literal",
["flex-start"] = "literal",
["flex-end"] = "literal",
["row"] = "literal",
["center"] = "literal",
["column"] = "literal",
["pointer"] = "literal",
["ease"] = "literal",
["white"] = "function",
["black"] = "function",
["gray"] = "function",
["blue"] = "function",
["red"] = "function",
["purple"] = "function",
["green"] = "function",
["yellow"] = "function"
}
}
+80
View File
@@ -0,0 +1,80 @@
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "Scala",
files = { "%.sc$", "%.scala$" },
comment = "//",
patterns = {
{ pattern = "//.-\n", type = "comment" },
{ pattern = { "/%*", "%*/" }, type = "comment" },
{ pattern = { '[ruU]?"', '"', '\\' }, type = "string" },
{ pattern = { "[ruU]?'", "'", '\\' }, type = "string" },
{ pattern = "0x[%da-fA-F]+", type = "number" },
{ pattern = "-?%d+[%d%.eE]*", type = "number" },
{ pattern = "-?%.?%d+", type = "number" },
{ pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" },
{ pattern = '[%a_][%w_]*"""*[%a_][%w_]*"""', type = "string" },
{ pattern = "[%a_][%w_]*%f[(]", type = "function" },
{ pattern = "[%a_][%w_]*", type = "symbol" },
},
symbols = {
["abstract"] = "keyword",
["case"] = "keyword",
["catch"] = "keyword",
["class"] = "keyword",
["finally"] = "keyword",
["final"] = "keyword",
["do"] = "keyword",
["extends"] = "keyword",
["forSome"] = "keyword",
["implicit"] = "keyword",
["lazy"] = "keyword",
["match"] = "keyword",
["new"] = "keyword",
["override"] = "keyword",
["package"] = "keyword",
["throw"] = "keyword",
["trait"] = "keyword",
["type"] = "keyword",
["var"] = "keyword",
["val"] = "keyword",
["println"] = "keyword",
["return"] = "keyword",
["for"] = "keyword",
["Try"] = "keyword",
["def"] = "keyword",
["while"] = "keyword",
["with"] = "keyword",
["if"] = "keyword",
["else"] = "keyword",
["import"] = "keyword",
["object"] = "keyword",
["yield"] = "keyword",
["private"] = "keyword2",
["protected"] = "keyword2",
["sealed"] = "keyword2",
["super"] = "keyword2",
["this"] = "keyword2",
["Byte"] = "keyword2",
["Short"] = "keyword2",
["Int"] = "keyword2",
["Long"] = "keyword2",
["Float"] = "keyword2",
["Double"] = "keyword2",
["Char"] = "keyword2",
["String"] = "keyword2",
["List"] = "keyword2",
["Array"] = "keyword2",
["Boolean"] = "keyword2",
["Null"] = "literal",
["Any"] = "literal",
["AnyRef"] = "literal",
["Nothing"] = "literal",
["Unit"] = "literal",
["true"] = "literal",
["false"] = "literal",
}
}
+103
View File
@@ -0,0 +1,103 @@
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "Shell script",
files = {
"%.sh$", "%.bash$",
PATHSEP .. "%.bashrc$", PATHSEP .. "%.bash_profile$", PATHSEP .. "%.profile$",
"%.zsh$", "%.fish$",
PATHSEP .. "APKBUILD$",
},
headers = "^#!.*bin.*sh\n",
comment = "#",
patterns = {
-- $# is a bash special variable and the '#' shouldn't be interpreted
-- as a comment.
{ pattern = "%$[%a_@*#][%w_]*", type = "keyword2" },
-- Comments
{ pattern = "#.*", type = "comment" },
-- Strings
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = { '`', '`', '\\' }, type = "string" },
-- Ignore numbers that start with dots or slashes
{ pattern = "%f[%w_%.%/]%d[%d%.]*%f[^%w_%.]", type = "number" },
-- Operators
{ pattern = "[!<>|&%[%]:=*]", type = "operator" },
-- Match parameters
{ pattern = "%f[%S][%+%-][%w%-_:]+", type = "function" },
{ pattern = "%f[%S][%+%-][%w%-_]+%f[=]", type = "function" },
-- Prevent parameters with assignments from been matched as variables
{
pattern = "%s%-%a[%w_%-]*%s+()%d[%d%.]+",
type = { "function", "number" }
},
{
pattern = "%s%-%a[%w_%-]*%s+()%a[%a%-_:=]+",
type = { "function", "symbol" }
},
-- Match variable assignments
{ pattern = "[_%a][%w_]+%f[%+=]", type = "keyword2" },
-- Match variable expansions
{ pattern = "%${.-}", type = "keyword2" },
{ pattern = "%$[%d%$%a_@*][%w_]*", type = "keyword2" },
-- Everything else
{ pattern = "[%a_][%w_]*", type = "symbol" },
-- Functions
{ pattern = "[%a_%-][%w_%-]*[%s]*%f[(]", type = "function" },
},
symbols = {
["case"] = "keyword",
["in"] = "keyword",
["esac"] = "keyword",
["if"] = "keyword",
["then"] = "keyword",
["elif"] = "keyword",
["else"] = "keyword",
["fi"] = "keyword",
["while"] = "keyword",
["do"] = "keyword",
["done"] = "keyword",
["for"] = "keyword",
["break"] = "keyword",
["continue"] = "keyword",
["function"] = "keyword",
["local"] = "keyword",
["echo"] = "keyword",
["return"] = "keyword",
["exit"] = "keyword",
["alias"] = "keyword",
["test"] = "keyword",
["cd"] = "keyword",
["declare"] = "keyword",
["enable"] = "keyword",
["eval"] = "keyword",
["exec"] = "keyword",
["export"] = "keyword",
["getopts"] = "keyword",
["hash"] = "keyword",
["history"] = "keyword",
["help"] = "keyword",
["jobs"] = "keyword",
["kill"] = "keyword",
["let"] = "keyword",
["mapfile"] = "keyword",
["printf"] = "keyword",
["read"] = "keyword",
["readarray"] = "keyword",
["pwd"] = "keyword",
["select"] = "keyword",
["set"] = "keyword",
["shift"] = "keyword",
["source"] = "keyword",
["time"] = "keyword",
["type"] = "keyword",
["until"] = "keyword",
["unalias"] = "keyword",
["unset"] = "keyword",
["true"] = "literal",
["false"] = "literal"
}
}
+58
View File
@@ -0,0 +1,58 @@
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "SSH config",
files = { PATHSEP .. "sshd?" .. PATHSEP .. "?_?config$" },
comment = '#',
patterns = {
{ pattern = "#.*", type = "comment" },
{ pattern = "%d+", type = "number" },
{ pattern = "[%a_][%w_]*", type = "symbol" },
{ pattern = "@", type = "operator" },
},
symbols = {
-- ssh config
["Host"] = "function",
["ProxyCommand"] = "function",
["HostName"] = "keyword",
["IdentityFile"] = "keyword",
["IdentitiesOnly"] = "keyword",
["User"] = "keyword",
["Port"] = "keyword",
["ForwardAgent"] = "keyword",
["ForwardX11"] = "keyword",
["ForwardX11Trusted"] = "keyword",
["HostbasedAuthentication"] = "keyword",
["GSSAPIAuthentication"] = "keyword",
["GSSAPIDelegateCredentials"] = "keyword",
["GSSAPIKeyExchange"] = "keyword",
["GSSAPITrustDNS"] = "keyword",
["BatchMode"] = "keyword",
["CheckHostIP"] = "keyword",
["AddressFamily"] = "keyword",
["ConnectTimeout"] = "keyword",
["StrictHostKeyChecking"] = "keyword",
["Ciphers"] = "keyword",
["MACs"] = "keyword",
["EscapeChar"] = "keyword",
["Tunnel"] = "keyword",
["TunnelDevice"] = "keyword",
["PermitLocalCommand"] = "keyword",
["VisualHostKey"] = "keyword",
["RekeyLimit"] = "keyword",
["SendEnv"] = "keyword",
["HashKnownHosts"] = "keyword",
-- sshd config
["Subsystem"] = "keyword2",
["yes"] = "literal",
["no"] = "literal",
["any"] = "literal",
["ask"] = "literal",
},
}
+125
View File
@@ -0,0 +1,125 @@
-- mod-version:3
local syntax = require "core.syntax"
-- Language Syntax References
-- https://pdhonline.com/courses/e334/e334content.pdf
syntax.add {
name = "PLC Structured Text IEC 61131-3",
files = { "%.stx?$", "%.iecst$" },
comment = "//",
block_comment = { "%(%*", "%*%)" },
patterns = {
{ pattern = "//.*", type = "comment" }, -- Single-line comment
{ pattern = { "%(%*", "%*%)" }, type = "comment" }, -- Multi-line comment
{ pattern = { '"', '"', '\\' }, type = "string" }, -- String, quotation marks
{ pattern = { "'", "'", '\\' }, type = "string" }, -- String, apices
{ pattern = "%w+#[0-9]+m?s?", type = "number" }, -- Time/Date formats
{ pattern = "[%a_][%w_]*%f[(]", type = "function" }, -- Function
{ pattern = "[%a_][%w_]*", type = "symbol" }, -- Symbols
{ pattern = ":%s*%w[%w_]*", type = "keyword2" }, -- Variable/Method Type
{ regex = [[[-+]?\d+\.{2,4}[-+]?\d+]], type = "number" }, -- Number Range
{ pattern = "[%+%-=/%*%^%%<>!~|&:]", type = "operator" }, -- Operators
{ pattern = "-?0x%x+", type = "number" }, -- Number
{ pattern = "-?%d+[%deE]*f?", type = "number" }, -- Number
{ pattern = "-?%.?%d+f?", type = "number" }, -- Number
},
symbols = {
["PROGRAM"] = "keyword",
["PROGRAM_INIT"] = "keyword",
["PROGRAM_CYCLIC"] = "keyword",
["PROGRAM_CLOSE"] = "keyword",
["END_PROGRAM"] = "keyword",
["FUNCTION_BLOCK"] = "keyword",
["END_FUNCTION_BLOCK"] = "keyword",
["FUNCTION"] = "keyword",
["END_FUNCTION"] = "keyword",
["METHOD"] = "keyword",
["END_METHOD"] = "keyword",
["IMPLEMENTATION"] = "keyword",
["END_IMPLEMENTATION"] = "keyword",
["INTERFACE"] = "keyword",
["END_INTERFACE"] = "keyword",
["IF"] = "keyword",
["THEN"] = "keyword",
["ELSE"] = "keyword",
["ELSIF"] = "keyword",
["END_IF"] = "keyword",
["CASE"] = "keyword",
["END_CASE"] = "keyword",
["OF"] = "keyword",
["FOR"] = "keyword",
["TO"] = "keyword",
["BY"] = "keyword",
["DO"] = "keyword",
["END_FOR"] = "keyword",
["WHILE"] = "keyword",
["END_WHILE"] = "keyword",
["REPEAT"] = "keyword",
["END_REPEAT"] = "keyword",
["MOD"] = "operator",
["UNTIL"] = "operator",
["EXIT"] = "keyword",
["RETURN"] = "keyword",
["AND"] = "keyword",
["NOT"] = "keyword",
["OR"] = "keyword",
["XOR"] = "keyword",
["NAMESPACE"] = "keyword",
["END_NAMESPACE"] = "keyword",
["VAR"] = "keyword",
["VAR_GLOBAL"] = "keyword",
["VAR_INPUT"] = "keyword",
["VAR_OUTPUT"] = "keyword",
["VAR_IN_OUT"] = "keyword",
["VAR_ACCESS"] = "keyword",
["VAR_EXTERNAL"] = "keyword",
["VAR_TEMP"] = "keyword",
["AT"] = "keyword",
["RETAIN"] = "keyword",
["END_VAR"] = "keyword",
["CONST"] = "keyword",
["END_CONST"] = "keyword",
["TYPE"] = "keyword",
["END_TYPE"] = "keyword",
["STRUCT"] = "keyword",
["END_STRUCT"] = "keyword",
["ORGANIZATION_BLOCK"] = "keyword",
["END_ORGANIZATION_BLOCK"] = "keyword",
["TRUE"] = "literal",
["FALSE"] = "literal",
["true"] = "literal",
["false"] = "literal",
["SINT"] = "keyword2",
["INT"] = "keyword2",
["DINT"] = "keyword2",
["LINT"] = "keyword2",
["USINT"] = "keyword2",
["UINT"] = "keyword2",
["UDINT"] = "keyword2",
["ULINT"] = "keyword2",
["LDINT"] = "keyword2",
["REAL"] = "keyword2",
["LREAL"] = "keyword2",
["TIME"] = "keyword2",
["DATE"] = "keyword2",
["TIME_OF_DAY"] = "keyword2",
["DATE_AND_TIME"] = "keyword2",
["STRING"] = "keyword2",
["BOOL"] = "keyword2",
["BYTE"] = "keyword2",
["WORD"] = "keyword2",
["DWORD"] = "keyword2",
["LWORD"] = "keyword2",
}
}
+101
View File
@@ -0,0 +1,101 @@
--- Author: Rohan Vashisht: https://github.com/rohanvashisht1234/
-- mod-version:3
------------ IMPORT LIB ------------
local syntax_highlight = require("core.syntax")
------------------------------------
------------- DATABASE -------------
---- SYMBOLS ----
local SYMBOLS = {}
local KEYWORDS = {
"break",
"continue",
"elif",
"else",
"for",
"if",
"pass",
"return",
"True",
"False"
}
local KEYWORDS2 = {
"as",
"assert",
"class",
"del",
"except",
"finally",
"from",
"global",
"import",
"in",
"is",
"lambda",
"nonlocal",
"raise",
"try",
"while",
"with",
"yield"
}
local LITERALS = {
"all",
"any",
"bool",
"dict",
"dir",
"enumerate",
"getattr",
"hasattr",
"hash",
"int",
"len",
"list",
"load",
"max",
"min",
"repr",
"reversed",
"sorted",
"str",
"tuple",
"type",
"zip"
}
-----------------
---- PATTERNS ----
local PATTERNS = {
{ pattern = { '"', '"', '\\' }, type = "string" }, -- tested ok
{ pattern = "#.*", type = "comment" }, -- tested ok
{ pattern = "[!%-/*?:=><]", type = "operator" }, -- tested ok
{ pattern = "-?%d+[%d%.eE_]*", type = "number" }, -- tested ok
{ pattern = '[%a_][%w_]*%f[(]', type = 'function' }, -- tested ok
{ pattern = "[%a_][%w_]*", type = "normal" } -- tested ok
}
------------------
------------------------------------
--------------- MAIN ---------------
for _, keyword in ipairs(KEYWORDS) do
SYMBOLS[keyword] = "keyword"
end
for _, keyword2 in ipairs(KEYWORDS2) do
SYMBOLS[keyword2] = "keyword2"
end
for _, literal in ipairs(LITERALS) do
SYMBOLS[literal] = "literal"
end
syntax_highlight.add {
name = "Starlark",
files = {"%.bazel$","%.bzl$"},
comment = "#",
patterns = PATTERNS,
symbols = SYMBOLS,
}
------------------------------------
+149
View File
@@ -0,0 +1,149 @@
-- Author: Rohan Vashisht: https://github.com/rohanvashisht1234/
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "Swift",
files = { "%.swift$" },
comment = "//",
patterns = {
{ pattern = { '"', '"', '\\' }, type = "string" }, -- tested ok
{ pattern = { '"""', '"""', '\\' }, type = "string" }, -- tested ok
{ pattern = { '#"', '"#', '\\' }, type = "string" }, -- tested ok
{ pattern = { '#"""', '"""#', '\\' }, type = "string" }, -- tested ok
{ pattern = "//.*", type = "comment" }, -- tested ok
{ pattern = { "/%*", "%*/" }, type = "comment" }, -- tested ok
{ pattern = "[!%-/*?:=><+]", type = "operator" }, -- tested ok
{ pattern = "[%a_][%w_]*%f[(]", type = "function" }, -- tested ok
{ pattern = "let()%s+()[%a_][%w_]*", type = { "keyword", "normal", "literal" } }, -- tested ok
{ pattern = "var()%s+()[%a_][%w_]*", type = { "keyword", "normal", "literal" } }, -- tested ok
{ pattern = "import()%s+()[%a_][%w_]*", type = { "keyword", "normal", "literal" } }, -- tested ok
{ pattern = "struct()%s+()[%a_][%w_]*", type = { "keyword", "normal", "literal" } }, -- tested ok
{ pattern = "class()%s+()[%a_][%w_]*", type = { "keyword", "normal", "literal" } }, -- tested ok
{ pattern = "enum()%s+()[%a_][%w_]*", type = { "keyword", "normal", "literal" } }, -- tested ok
{ pattern = "-?%d+[%d%.eE_]*", type = "number" }, -- tested ok
{ pattern = "-?%.?%d+", type = "number" }, -- tested ok
{ pattern = "[%a_][%w_]*", type = "normal" }, -- tested ok
},
symbols = {
["import"] = "keyword", -- tested ok
["inout"] = "keyword", -- tested ok
["internal"] = "keyword", -- tested ok
["let"] = "keyword", -- tested ok
["Let"] = "keyword", -- tested ok
["open"] = "keyword", -- tested ok
["operator"] = "keyword", -- tested ok
["private"] = "keyword", -- tested ok
["precedencegroup"] = "keyword", -- tested ok
["protocol"] = "keyword", -- tested ok
["public"] = "keyword", -- tested ok
["rethrows"] = "keyword", -- tested ok
["static"] = "keyword", -- tested ok
["struct"] = "keyword", -- tested ok
["subscript"] = "keyword", -- tested ok
["typealias"] = "keyword", -- tested ok
["var"] = "keyword", -- tested ok
["break"] = "keyword", -- tested ok
["while"] = "keyword", -- tested ok
["nil"] = "keyword", -- tested ok
["associativity"] = "keyword", -- tested ok
["convenience"] = "keyword", -- tested ok
["didSet"] = "keyword", -- tested ok
["dynamic"] = "keyword", -- tested ok
["final"] = "keyword", -- tested ok
["get"] = "keyword", -- tested ok
["indirect"] = "keyword", -- tested ok
["infix"] = "keyword", -- tested ok
["left"] = "keyword", -- tested ok
["mutating"] = "keyword", -- tested ok
["none"] = "keyword", -- tested ok
["nonmutating"] = "keyword", -- tested ok
["optional"] = "keyword", -- tested ok
["override"] = "keyword", -- tested ok
["postfix"] = "keyword", -- tested ok
["Protocol"] = "keyword", -- tested ok
["required"] = "keyword", -- tested ok
["right"] = "keyword", -- tested ok
["set"] = "keyword", -- tested ok
["some"] = "keyword", -- tested ok
["Type"] = "keyword", -- tested ok
["unowned"] = "keyword", -- tested ok
["weak"] = "keyword", -- tested ok
["lazy"] = "keyword", -- tested ok
["prefix"] = "keyword", -- tested ok
["willSet"] = "keyword", -- tested ok
["try"] = "keyword", -- tested ok
["true"] = "keyword", -- tested ok
["throws"] = "keyword", -- tested ok
["super"] = "keyword", -- tested ok
["Self"] = "keyword", -- tested ok
["self"] = "keyword", -- tested ok
["is"] = "keyword", -- tested ok
["false"] = "keyword", -- tested ok
["as"] = "keyword", -- tested ok
["Any"] = "keyword", -- tested ok
["where"] = "keyword", -- tested ok
["switch"] = "keyword", -- tested ok
["throw"] = "keyword", -- tested ok
["catch"] = "keyword", -- tested ok
["return"] = "keyword", -- tested ok
["repeat"] = "keyword", -- tested ok
["in"] = "keyword", -- tested ok
["if"] = "keyword", -- tested ok
["gaurd"] = "keyword", -- tested ok
["for"] = "keyword", -- tested ok
["fallthrough"] = "keyword", -- tested ok
["else"] = "keyword", -- tested ok
["do"] = "keyword", -- tested ok
["defer"] = "keyword", -- tested ok
["default"] = "keyword", -- tested ok
["continue"] = "keyword", -- tested ok
["case"] = "keyword", -- tested ok
["init"] = "keyword", -- tested ok
["func"] = "keyword", -- tested ok
["fileprivate"] = "keyword", -- tested ok
["extension"] = "keyword", -- tested ok
["associatedtype"] = "keyword", -- tested ok
["enum"] = "keyword", -- tested ok
["Init"] = "keyword", -- tested ok
["Enum"] = "keyword", -- tested ok
["deinit"] = "keyword", -- tested ok
["class"] = "keyword", -- tested ok
["Class"] = "keyword", -- tested ok
["precedence"] = "keyword", -- tested ok
["#available"] = "keyword2", -- tested ok
["#colorLiteral"] = "keyword2", -- tested ok
["#column"] = "keyword2", -- tested ok
["#dsohandle"] = "keyword2", -- tested ok
["#elseif"] = "keyword2", -- tested ok
["#else"] = "keyword2", -- tested ok
["#endif"] = "keyword2", -- tested ok
["#error"] = "keyword2", -- tested ok
["#keyPath"] = "keyword2", -- tested ok
["#line"] = "keyword2", -- tested ok
["#selector"] = "keyword2", -- tested ok
["#sourceLocation"] = "keyword2", -- tested ok
["#warning"] = "keyword2", -- tested ok
["_COLUMN_"] = "keyword2", -- tested ok
["_FILE_"] = "keyword2", -- tested ok
["_FUNCTION_"] = "keyword2", -- tested ok
["_LINE_"] = "keyword2", -- tested ok
["String"] = "keyword2", -- tested ok
["Int"] = "keyword2", -- tested ok
["Int8"] = "keyword2", -- tested ok
["Int16"] = "keyword2", -- tested ok
["Int32"] = "keyword2", -- tested ok
["Int64"] = "keyword2", -- tested ok
["UInt8"] = "keyword2", -- tested ok
["UInt16"] = "keyword2", -- tested ok
["UInt32"] = "keyword2", -- tested ok
["UInt64"] = "keyword2", -- tested ok
["Float"] = "keyword2", -- tested ok
["Bool"] = "keyword2", -- tested ok
["at"] = "keyword2", -- tested ok
}
}
+70
View File
@@ -0,0 +1,70 @@
--mod-version:3
local syntax = require 'core.syntax'
local label, sublabel = "function", "keyword2"
syntax.add {
name = "Uxntal",
files = { "%.tal$" },
block_comment = { '(', ')' },
patterns = {
{ pattern = {'%(', '%)'}, type = "comment" },
{ pattern = "@%S*%s+%f[[]", type = label },
{ pattern = "@%S+", type = "string" },
{ pattern = "%u+()[2kr]*", type = { "symbol", "keyword" } },
{ pattern = "%%%S+", type = "keyword" },
{ pattern = "&%S+", type = sublabel },
{ pattern = "\"%S+", type = "string" },
{ pattern = "%.%S+()/%S*", type = { label, sublabel } },
{ pattern = "%.%S+", type = label },
{ pattern = "|%x+", type = "string" },
{ pattern = "[.,;_=-]%S+", type = sublabel },
{ pattern = "%$%d+", type = "number" },
{ pattern = "#?%x%x%x%x%f[%X]", type = "number" },
{ pattern = "#?%x%x%f[%X]", type = "number" },
{ pattern = "[!?]()[^%[%]{}%s]+", type = { "operator", "function" } },
{ pattern = "[^%[%]{}%s]+", type = "function" },
},
symbols = {
-- no mode keywords
["JCI"] = "keyword",
["JMI"] = "keyword",
["JSI"] = "keyword",
["BRK"] = "keyword",
-- lit only has 4 modes
["LIT"] = "keyword",
-- the rest
["EQU"] = "keyword",
["LDZ"] = "keyword",
["ADD"] = "keyword",
["INC"] = "keyword",
["NEQ"] = "keyword",
["STZ"] = "keyword",
["SUB"] = "keyword",
["POP"] = "keyword",
["GTH"] = "keyword",
["LDR"] = "keyword",
["MUL"] = "keyword",
["NIP"] = "keyword",
["LTH"] = "keyword",
["STR"] = "keyword",
["DIV"] = "keyword",
["SWP"] = "keyword",
["JMP"] = "keyword",
["LDA"] = "keyword",
["AND"] = "keyword",
["ROT"] = "keyword",
["JCN"] = "keyword",
["STA"] = "keyword",
["ORA"] = "keyword",
["DUP"] = "keyword",
["JSR"] = "keyword",
["DEI"] = "keyword",
["EOR"] = "keyword",
["OVR"] = "keyword",
["STH"] = "keyword",
["DEO"] = "keyword",
["SFT"] = "keyword",
}}
+95
View File
@@ -0,0 +1,95 @@
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "Tau",
files = { "%.tau$" },
comment = "#",
patterns = {
{ pattern = { '{', '}' }, type = "operator", syntax = ".tau" },
-- funtion declaration
{
pattern = { '%.?()[%a_][%w_]*()%s*=%s*()fn()%(', '%)%s*' },
type = { "operator", "function", "operator", "keyword", "normal" },
syntax = {
patterns = {
{ pattern = '[%a_][%w_]*', type = "literal" },
},
symbols = {
[','] = "normal",
},
},
},
-- strings
{ pattern = { "`", "`" }, type = "string" },
{ pattern = { '\\"', '\\"' }, type = "string" },
{
pattern = { '"', '"', '\\' },
type = "string",
syntax = {
-- TODO: formatted strings has still some issues with inner {} blocks like if { .. } else { ... } and escaped \"strings\"
patterns = {
{ pattern = { '{', '}' }, type = "operator", syntax = ".tau" },
{ pattern = '[^%s"]+', type = "string" },
},
symbols = {},
},
},
-- numbers and values
{ pattern = "0b[01]{0,64}", type = "number" },
{ pattern = "0o[0-7]{0,24}", type = "number" },
{ pattern = "0x[%da-fA-F]{0,16}", type = "number" },
{ pattern = "-?%d{0,20}", type = "number" },
{ pattern = "-?%d+[%d%.eE]*", type = "number" },
{ pattern = "-?%.?%d+", type = "number" },
-- others
{ pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" },
{ pattern = "%.?()[%a_][%w_]*%f[(]", type = { "operator", "function" } },
{ pattern = "%.()[%a_][%w_]*", type = { "operator", "literal" } },
{ pattern = "[%a_][%w_]*", type = "symbol" },
},
symbols = {
-- actual keywords
["if"] = "keyword",
["else"] = "keyword",
["for"] = "keyword",
["break"] = "keyword",
["continue"] = "keyword",
["tau"] = "keyword",
["fn"] = "keyword",
["return"] = "keyword",
-- literal values
["true"] = "literal",
["false"] = "literal",
["null"] = "literal",
-- builtin functions
["new"] = "keyword2",
["len"] = "keyword2",
["println"] = "keyword2",
["print"] = "keyword2",
["input"] = "keyword2",
["string"] = "keyword2",
["error"] = "keyword2",
["type"] = "keyword2",
["int"] = "keyword2",
["float"] = "keyword2",
["exit"] = "keyword2",
["append"] = "keyword2",
["newfailed"] = "keyword2",
["plugin"] = "keyword2",
["pipesend"] = "keyword2",
["recv"] = "keyword2",
["close"] = "keyword2",
["hex"] = "keyword2",
["oct"] = "keyword2",
["bin"] = "keyword2",
["slice"] = "keyword2",
["keys"] = "keyword2",
["delete"] = "keyword2"
},
}
+69
View File
@@ -0,0 +1,69 @@
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "Tcl",
files = { "%.tcl$" },
comment = "#",
patterns = {
{ pattern = "#.-\n", type = "comment" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = "0x%x+", type = "number" },
{ pattern = "%d+[%d%.eE]*f?", type = "number" },
{ pattern = "%.?%d+f?", type = "number" },
{ pattern = "%$[%a_][%w_]*", type = "literal" },
{ pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" },
{ pattern = "::[%a_][%w_]*", type = "function" },
{ pattern = "[%a_][%w_]*%f[:]", type = "function" },
{ pattern = "[%a_][%w_]*", type = "symbol" },
},
symbols = {
["set"] = "keyword",
["unset"] = "keyword",
["rename"] = "keyword",
["upvar"] = "keyword",
["incr"] = "keyword",
["source"] = "keyword",
["expr"] = "keyword",
["gets"] = "keyword",
["puts"] = "keyword",
["package"] = "keyword",
["list"] = "keyword",
["dict"] = "keyword",
["split"] = "join",
["concat"] = "join",
["lappend"] = "keyword",
["lset"] = "keyword",
["lassign"] = "keyword",
["lindex"] = "keyword",
["llength"] = "keyword",
["lsearch"] = "keyword",
["lrange"] = "keyword",
["linsert"] = "keyword",
["lreplace"] = "keyword",
["lrepeat"] = "keyword",
["lsort"] = "keyword",
["lreverse"] = "keyword",
["array"] = "keyword",
["concat"] = "keyword",
["regexp"] = "keyword",
["for"] = "keyword",
["foreach"] = "keyword",
["while"] = "keyword",
["case"] = "keyword",
["proc"] = "keyword",
["if"] = "keyword",
["else"] = "keyword",
["elseif"] = "keyword",
["break"] = "keyword",
["continue"] = "keyword",
["return"] = "keyword",
["eval"] = "keyword",
["try"] = "keyword2",
["on"] = "keyword2",
["finally"] = "keyword2",
["throw"] = "keyword2",
["error"] = "keyword2",
},
}
+57
View File
@@ -0,0 +1,57 @@
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "Teal",
files = {"%.tl$","%.d.tl$"},
comment = "--",
patterns = {
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = { "%[%[", "%]%]" }, type = "string" },
{ pattern = { "%-%-%[%[", "%]%]"}, type = "comment" },
{ pattern = "%-%-.-\n", type = "comment" },
{ pattern = "-?0x%x+", type = "number" },
{ pattern = "-?%d+[%d%.eE]*", type = "number" },
{ pattern = "-?%.?%d+", type = "number" },
{ pattern = "<%a+>", type = "keyword2" },
{ pattern = "%.%.%.?", type = "operator" },
{ pattern = "[<>~=]=", type = "operator" },
{ pattern = "[%+%-=/%*%^%%#<>]", type = "operator" },
{ pattern = "[%a_][%w_]*%s*%f[(\"{]", type = "function" },
{ pattern = "[%a_][%w_]*", type = "symbol" },
{ pattern = "::[%a_][%w_]*::", type = "function" },
},
symbols = {
["if"] = "keyword",
["then"] = "keyword",
["else"] = "keyword",
["elseif"] = "keyword",
["end"] = "keyword",
["do"] = "keyword",
["function"] = "keyword",
["repeat"] = "keyword",
["until"] = "keyword",
["while"] = "keyword",
["for"] = "keyword",
["break"] = "keyword",
["return"] = "keyword",
["local"] = "keyword",
["global"] = "keyword",
["in"] = "keyword",
["not"] = "keyword",
["and"] = "keyword",
["or"] = "keyword",
["goto"] = "keyword",
["enum"] = "keyword",
["record"] = "keyword",
["any"] = "keyword2",
["boolean"] = "keyword2",
["number"] = "keyword2",
["string"] = "keyword2",
["thread"] = "keyword2",
["true"] = "literal",
["false"] = "literal",
["nil"] = "literal",
},
}
+27
View File
@@ -0,0 +1,27 @@
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "TeX",
files = { "%.tex$", "%.dtx$", "%.sty$", "%.ins$", "%.cls$" },
comment = "%%",
patterns = {
{ pattern = "%%.-\n", type = "comment" },
{ pattern = "\\documentclass().-{()%a%w+()}", type = {"keyword", "symbol", "function", "symbol"} },
{ pattern = "\\usepackage", type = "keyword" },
{ pattern = "\\chapter", type = "keyword" },
{ pattern = "\\section", type = "keyword" },
{ pattern = "\\subsection", type = "keyword" },
{ pattern = "\\paragraph", type = "keyword" },
{ pattern = "\\subparagraph", type = "keyword" },
{ pattern = "\\begin(){()%a%w+()}", type = {"keyword2", "symbol", "function", "symbol"} },
{ pattern = "\\end(){()%a%w+()}", type = {"keyword2", "symbol", "function", "symbol"} },
{ pattern = "\\%a%w+()%*", type = {"keyword2", "operator"} },
{ pattern = "\\%a%w+", type = "keyword2" },
{ pattern = "&", type = "operator" },
{ pattern = "\\\\", type = "operator" },
{ pattern = "%$", type = "operator" },
{ pattern = "\\[%[%]()]", type = "operator" },
},
symbols = {}
}
+40
View File
@@ -0,0 +1,40 @@
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "TOML",
files = { "%.toml$" },
comment = '#',
patterns = {
{ pattern = "#.*", type = "comment" },
{ pattern = { '"""', '"""', '\\' }, type = "string" },
{ pattern = { "'''", "'''" }, type = "string" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'", "'" }, type = "string" },
{ pattern = "[%w_%.%-]+%s*%f[=]", type = "function" },
{ pattern = {"^%s*%[", "%]"}, type = "keyword" },
{ pattern = "0x[%x_]+", type = "number" },
{ pattern = "0o[0-7_]+", type = "number" },
{ pattern = "0b[01_]+", type = "number" },
{ pattern = "%d[%d_]*%.?[%d_]*[eE][%-+]?[%d_]+", type = "number" },
{ pattern = "%d[%d_]*%.?[$d_]*", type = "number" },
{ pattern = "%f[-+%w_][-+]%f[%w%.]", type = "number" },
{ pattern = "[%+%-:TZ]", type = "operator" },
{ pattern = "%a+", type = "symbol" },
},
symbols = {
["true"] = "literal",
["false"] = "literal",
["nan"] = "number",
["inf"] = "number"
},
}
+74
View File
@@ -0,0 +1,74 @@
-- mod-version:3
-- copied from language_js, but added regex highlighting back
local syntax = require "core.syntax"
syntax.add {
name = "TypeScript",
files = { "%.ts$" },
comment = "//",
patterns = {
{ pattern = "//.-\n", type = "comment" },
{ pattern = { "/%*", "%*/" }, type = "comment" },
{ pattern = { '/%g', '/', '\\' }, type = "string" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = { "`", "`", '\\' }, type = "string" },
{ pattern = "0x[%da-fA-F]+", type = "number" },
{ pattern = "-?%d+[%d%.eE]*", type = "number" },
{ pattern = "-?%.?%d+", type = "number" },
{ pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" },
{ pattern = "interface%s()[%a_][%w_]*", type = {"keyword", "keyword2"} },
{ pattern = "type%s()[%a_][%w_]*", type = {"keyword", "keyword2"} },
{ pattern = "[%a_][%w_]*%f[(]", type = "function" },
{ pattern = "[%a_][%w_]*", type = "symbol" },
},
symbols = {
["async"] = "keyword",
["await"] = "keyword",
["break"] = "keyword",
["case"] = "keyword",
["catch"] = "keyword",
["class"] = "keyword",
["const"] = "keyword",
["continue"] = "keyword",
["debugger"] = "keyword",
["default"] = "keyword",
["delete"] = "keyword",
["do"] = "keyword",
["else"] = "keyword",
["export"] = "keyword",
["extends"] = "keyword",
["finally"] = "keyword",
["for"] = "keyword",
["function"] = "keyword",
["get"] = "keyword",
["if"] = "keyword",
["import"] = "keyword",
["implements"] = "keyword",
["in"] = "keyword",
["instanceof"] = "keyword",
["let"] = "keyword",
["new"] = "keyword",
["return"] = "keyword",
["set"] = "keyword",
["static"] = "keyword",
["super"] = "keyword",
["switch"] = "keyword",
["throw"] = "keyword",
["try"] = "keyword",
["typeof"] = "keyword",
["var"] = "keyword",
["void"] = "keyword",
["while"] = "keyword",
["with"] = "keyword",
["yield"] = "keyword",
["true"] = "literal",
["false"] = "literal",
["null"] = "literal",
["undefined"] = "literal",
["arguments"] = "keyword2",
["Infinity"] = "keyword2",
["NaN"] = "keyword2",
["this"] = "keyword2",
},
}

Some files were not shown because too many files have changed in this diff Show More