diff options
author | Adam <adamdharrison@gmail.com> | 2023-07-12 11:00:44 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-12 11:00:44 -0400 |
commit | 303b162601172b48653af7ff01422489ed318e37 (patch) | |
tree | 2fcc7a488bffdf5ccbaa7343e0c565c0c967408f | |
parent | ce5a6b72f679afef230696e707efa0bbb9a031bc (diff) | |
download | lite-xl-plugins-303b162601172b48653af7ff01422489ed318e37.tar.gz lite-xl-plugins-303b162601172b48653af7ff01422489ed318e37.zip |
Updated perl to improve syntax highlighting. (#265)
* Updated perl to improve syntax highlighting.
* Added in more perl stuff.
-rw-r--r-- | manifest.json | 2 | ||||
-rw-r--r-- | plugins/language_perl.lua | 37 |
2 files changed, 35 insertions, 4 deletions
diff --git a/manifest.json b/manifest.json index 63a62b5..c92c3db 100644 --- a/manifest.json +++ b/manifest.json @@ -727,7 +727,7 @@ }, { "description": "Syntax for the [Perl](https://perl.org) programming language", - "version": "0.1", + "version": "0.2", "path": "plugins/language_perl.lua", "id": "language_perl", "mod_version": "3" diff --git a/plugins/language_perl.lua b/plugins/language_perl.lua index 0e057e2..cc1547f 100644 --- a/plugins/language_perl.lua +++ b/plugins/language_perl.lua @@ -10,13 +10,23 @@ syntax.add { { 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_]*", type = "symbol" }, + { 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", @@ -255,6 +265,27 @@ syntax.add { ["write"] = "keyword", ["each"] = "keyword", ["lcfirst"] = "keyword", - ["setnetent"] = "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" } } |