Files
deb-lite-xl/debian/extra/plugins/language_starlark.lua
T
vhaudiquet 3bae6fd448 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)
2026-09-16 22:45:02 +02:00

102 lines
1.8 KiB
Lua

--- 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,
}
------------------------------------