aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Harrison <adamdharrison@gmail.com>2021-05-01 02:19:28 -0400
committerAdam Harrison <adamdharrison@gmail.com>2021-05-01 15:15:21 -0400
commitc0bd35b6f2daf94076f017d3f05cf59ca0f4b19c (patch)
tree2b796446d3d66258b101553640deeeb50c4ecd2c
parentbcb3a34fdd2d1007364b26ba0ee659af8bd90178 (diff)
downloadlite-xl-plugins-c0bd35b6f2daf94076f017d3f05cf59ca0f4b19c.tar.gz
lite-xl-plugins-c0bd35b6f2daf94076f017d3f05cf59ca0f4b19c.zip
Added in perl as a syntax highlight.
-rw-r--r--README.md1
-rw-r--r--plugins/language_perl.lua51
2 files changed, 52 insertions, 0 deletions
diff --git a/README.md b/README.md
index 8f49e9b..c97fb1a 100644
--- a/README.md
+++ b/README.md
@@ -65,6 +65,7 @@ Plugin | Description
[`language_nim`](plugins/language_nim.lua?raw=1) | Syntax for the [Nim](https://nim-lang.org) programming language
[`language_objc`](plugins/language_objc.lua?raw=1) | Syntax for the [Objective C](https://en.wikipedia.org/wiki/Objective-C) programming language
[`language_odin`](plugins/language_odin.lua?raw=1) | Syntax for the [Odin](https://github.com/odin-lang/Odin) programming language
+[`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_powershell`](plugins/language_powershell.lua?raw=1) | Syntax for [PowerShell](https://docs.microsoft.com/en-us/powershell) scripting language
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",
+ },
+}