From c0bd35b6f2daf94076f017d3f05cf59ca0f4b19c Mon Sep 17 00:00:00 2001 From: Adam Harrison Date: Sat, 1 May 2021 02:19:28 -0400 Subject: Added in perl as a syntax highlight. --- plugins/language_perl.lua | 51 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 plugins/language_perl.lua (limited to 'plugins') diff --git a/plugins/language_perl.lua b/plugins/language_perl.lua new file mode 100644 index 0000000..283a3fa --- /dev/null +++ b/plugins/language_perl.lua @@ -0,0 +1,51 @@ +-- lite-xl 1.16 +local syntax = require "core.syntax" + +syntax.add { + files = { "%.pm$", "%.pl$" }, + headers = "^#!.*[ /]perl", + comment = "#", + patterns = { + { pattern = "%#.-\n", type = "comment" }, + { pattern = { '"', '"', '\\' }, type = "string" }, + { pattern = { "'", "'", '\\' }, type = "string" }, + { pattern = { '/', '/', '\\' }, type = "string" }, + { pattern = "%\\x[%da-fA-F]+", type = "number" }, + { pattern = "-?%d+[%d%.eE]*", type = "number" }, + { pattern = "-?%.?%d+", type = "number" }, + { pattern = "[%a_][%w_]*%f[(]", type = "function" }, + { pattern = "[%@%$%*]+[%a_][%w_]*", type = "keyword2" }, + { pattern = "[%a_][%w_]*", type = "symbol" }, + }, + symbols = { + ["return"] = "keyword", + ["if"] = "keyword", + ["unless"] = "keyword", + ["else"] = "keyword", + ["elsif"] = "keyword", + ["do"] = "keyword", + ["for"] = "keyword", + ["foreach"] = "keyword", + ["while"] = "keyword", + ["next"] = "keyword", + ["last"] = "keyword", + ["exit"] = "keyword", + ["goto"] = "keyword", + ["eval"] = "keyword", + ["delete"] = "keyword", + ["exists"] = "keyword", + + ["use"] = "keyword", + ["die"] = "keyword", + ["require"] = "keyword", + ["require_once"] = "keyword", + ["new"] = "keyword", + ["our"] = "keyword", + ["my"] = "keyword", + ["sub"] = "keyword", + ["sub"] = "keyword", + ["clone"] = "keyword", + + ["undef"] = "literal", + }, +} -- cgit v1.2.3 From 259bffedf24b5dcefeafab3a9bdc5e4e75337ca0 Mon Sep 17 00:00:00 2001 From: Adam Harrison Date: Sat, 1 May 2021 15:38:00 -0400 Subject: Greatly expanded keyword listing. --- plugins/language_perl.lua | 266 +++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 237 insertions(+), 29 deletions(-) (limited to 'plugins') diff --git a/plugins/language_perl.lua b/plugins/language_perl.lua index 283a3fa..cb414d4 100644 --- a/plugins/language_perl.lua +++ b/plugins/language_perl.lua @@ -9,43 +9,251 @@ syntax.add { { pattern = "%#.-\n", type = "comment" }, { pattern = { '"', '"', '\\' }, type = "string" }, { pattern = { "'", "'", '\\' }, type = "string" }, - { pattern = { '/', '/', '\\' }, type = "string" }, - { pattern = "%\\x[%da-fA-F]+", type = "number" }, + -- 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_]*", type = "symbol" }, + { pattern = "%--[%a_][%w_]*", type = "symbol" }, }, symbols = { - ["return"] = "keyword", - ["if"] = "keyword", - ["unless"] = "keyword", - ["else"] = "keyword", - ["elsif"] = "keyword", - ["do"] = "keyword", - ["for"] = "keyword", - ["foreach"] = "keyword", - ["while"] = "keyword", - ["next"] = "keyword", - ["last"] = "keyword", - ["exit"] = "keyword", - ["goto"] = "keyword", + ["-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", - ["delete"] = "keyword", + ["mkdir"] = "keyword", + ["shmget"] = "keyword", + ["-k"] = "keyword", + ["exec"] = "keyword", + ["msgctl"] = "keyword", + ["shmread"] = "keyword", + ["-l"] = "keyword", ["exists"] = "keyword", - - ["use"] = "keyword", - ["die"] = "keyword", - ["require"] = "keyword", - ["require_once"] = "keyword", - ["new"] = "keyword", - ["our"] = "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", - ["sub"] = "keyword", - ["clone"] = "keyword", - - ["undef"] = "literal", - }, + ["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" + } } -- cgit v1.2.3 From a913af87e2f343a6080d5c156d05651bef2f0f51 Mon Sep 17 00:00:00 2001 From: Adam Harrison Date: Sat, 1 May 2021 16:19:49 -0400 Subject: Added in liquid syntax highlighting. --- README.md | 1 + plugins/language_liquid.lua | 144 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 145 insertions(+) create mode 100644 plugins/language_liquid.lua (limited to 'plugins') diff --git a/README.md b/README.md index c97fb1a..215b2e6 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,7 @@ Plugin | Description [`language_jiyu`](plugins/language_jiyu.lua?raw=1) | Syntax for the [jiyu](https://github.com/machinamentum/jiyu) programming language [`language_jsx`](plugins/language_jsx.lua?raw=1) | Syntax for the [JSX](https://reactjs.org/docs/introducing-jsx.html) language for the React framework in JavaScript [`language_ksy`](https://raw.githubusercontent.com/whiteh0le/lite-plugins/main/plugins/language_ksy.lua?raw=1) | Syntax for [Kaitai](http://kaitai.io/) struct files +[`language_liquid`](plugins/language_liquid.lua?raw=1) | Syntax for [Liquid](https://shopify.github.io/liquid/) templating language [`language_make`](plugins/language_make.lua?raw=1) | Syntax for the Make build system language [`language_meson`](plugins/language_meson.lua?raw=1) | Syntax for the [Meson](https://mesonbuild.com) build system language [`language_moon`](plugins/language_moon.lua?raw=1) | Syntax for the [MoonScript](https://moonscript.org) scripting language diff --git a/plugins/language_liquid.lua b/plugins/language_liquid.lua new file mode 100644 index 0000000..9dd7427 --- /dev/null +++ b/plugins/language_liquid.lua @@ -0,0 +1,144 @@ +-- lite-xl 1.16 +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 { + 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 = {}, +} -- cgit v1.2.3 From c8ee56f043b71bd0faaf794635727c2f534166ce Mon Sep 17 00:00:00 2001 From: Adam Harrison Date: Sat, 1 May 2021 16:53:17 -0400 Subject: Small syntax fix. --- plugins/language_liquid.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/language_liquid.lua b/plugins/language_liquid.lua index 9dd7427..f9ee8e4 100644 --- a/plugins/language_liquid.lua +++ b/plugins/language_liquid.lua @@ -1,7 +1,6 @@ -- lite-xl 1.16 local syntax = require "core.syntax" - local liquid_syntax = { patterns = { { pattern = { '"', '"', '\\' }, type = "string" }, @@ -58,7 +57,7 @@ local liquid_syntax = { ["map"] = "keyword2", ["minus"] = "keyword2", ["modulo"] = "keyword2", - ["nil"] = "literal" + ["nil"] = "literal", ["null"] = "literal", ["offset"] = "keyword2", ["or"] = "operator", @@ -142,3 +141,4 @@ syntax.add { }, symbols = {}, } + -- cgit v1.2.3 From 91a1db25b59965881ff3c19aa89f1fbb922a6a2d Mon Sep 17 00:00:00 2001 From: Adam Harrison Date: Sat, 1 May 2021 17:35:40 -0400 Subject: Changed text token, because of liquid syntax. --- plugins/language_liquid.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/language_liquid.lua b/plugins/language_liquid.lua index f9ee8e4..f097213 100644 --- a/plugins/language_liquid.lua +++ b/plugins/language_liquid.lua @@ -127,7 +127,7 @@ syntax.add { type = "function" }, { pattern = { "" }, type = "comment" }, - { pattern = { '%f[^>][^<]', '%f[<]' }, type = "normal" }, + { pattern = { '%f[^>][^<]', '%f[<{]' }, type = "normal" }, { pattern = { '"', '"', '\\' }, type = "string" }, { pattern = { "'", "'", '\\' }, type = "string" }, { pattern = "0x[%da-fA-F]+", type = "number" }, -- cgit v1.2.3