aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJefferson González <jgmdev@gmail.com>2022-02-16 05:25:21 -0400
committerGitHub <noreply@github.com>2022-02-16 05:25:21 -0400
commitc1d68c445e2189b37040a09de41d895d52c8d641 (patch)
treea193ce0a12897db9d4a82d5efd9105759876ab8b
parentc45790bafcdb8e8b6860b1ef61a327a9bd560d7a (diff)
parent3bfa44513b615353378bb437724a3c3ec48ca43e (diff)
downloadlite-xl-plugins-c1d68c445e2189b37040a09de41d895d52c8d641.tar.gz
lite-xl-plugins-c1d68c445e2189b37040a09de41d895d52c8d641.zip
Merge pull request #35 from jgmdev/language-pkgbuild
Added language_pkgbuild
-rw-r--r--README.md1
-rw-r--r--plugins/language_pkgbuild.lua159
2 files changed, 160 insertions, 0 deletions
diff --git a/README.md b/README.md
index 004fde3..21aadc6 100644
--- a/README.md
+++ b/README.md
@@ -83,6 +83,7 @@ to something other than a raw file it should be marked with an asterisk.*
| [`language_perl`](plugins/language_perl.lua?raw=1) | Syntax for the [Perl](https://perl.org) programming language |
| [`language_php`](plugins/language_php.lua?raw=1) | Syntax for the [PHP](https://php.net) programming language |
| [`language_pico8`](plugins/language_pico8.lua?raw=1) | Syntax for [Pico-8](https://www.lexaloffle.com/pico-8.php) cartridge files |
+| [`language_pkgbuild`](plugins/language_pkgbuild.lua?raw=1) | Syntax for [PKGBUILD](https://wiki.archlinux.org/title/PKGBUILD) package description files |
| [`language_po`](plugins/language_po.lua?raw=1) | Syntax for [PO](https://www.gnu.org/software/gettext/manual/html_node/PO-Files.html) translation files |
| [`language_pony`](https://github.com/MrAnyx/lite-plugin-pony)\* | Syntax for [Pony](https://www.ponylang.io/) programming language |
| [`language_powershell`](plugins/language_powershell.lua?raw=1) | Syntax for [PowerShell](https://docs.microsoft.com/en-us/powershell) scripting language |
diff --git a/plugins/language_pkgbuild.lua b/plugins/language_pkgbuild.lua
new file mode 100644
index 0000000..486a8a6
--- /dev/null
+++ b/plugins/language_pkgbuild.lua
@@ -0,0 +1,159 @@
+-- mod-version:2 -- lite-xl 2.0
+local syntax = require "core.syntax"
+
+syntax.add {
+ name = "PKGBUILD",
+ files = "/*PKGBUILD$",
+ comment = "#",
+ patterns = {
+ { pattern = "#.*\n", 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",
+ -- Commands
+ ["mapfile"] = "keyword",
+ ["printf"] = "keyword",
+ ["read"] = "keyword",
+ ["readarray"] = "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",
+ ["makedepends"] = "literal",
+ ["checkdepends"] = "literal",
+ ["optdepends"] = "literal",
+ ["provides"] = "literal",
+ ["conflicts"] = "literal",
+ ["replaces"] = "literal",
+ ["backup"] = "literal",
+ ["options"] = "literal",
+ ["changelog"] = "literal",
+ ["noextract"] = "literal",
+ ["validpgpkeys"] = "literal",
+ ["md5sums"] = "literal",
+ ["sha1sums"] = "literal",
+ ["sha256sums"] = "literal",
+ ["sha224sums"] = "literal",
+ ["sha384sums"] = "literal",
+ ["sha512sums"] = "literal",
+ ["b2sums"] = "literal"
+ },
+}