From 303b162601172b48653af7ff01422489ed318e37 Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 12 Jul 2023 11:00:44 -0400 Subject: Updated perl to improve syntax highlighting. (#265) * Updated perl to improve syntax highlighting. * Added in more perl stuff. --- manifest.json | 2 +- 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" } } -- cgit v1.2.3