aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md3
-rw-r--r--plugins/language_pico8.lua51
2 files changed, 53 insertions, 1 deletions
diff --git a/README.md b/README.md
index 218798a..b5a32f3 100644
--- a/README.md
+++ b/README.md
@@ -46,14 +46,15 @@ Plugin | Description
[`language_meson`](plugins/language_meson.lua?raw=1) | Syntax for the [Meson](https://mesonbuild.com) build system language
[`language_odin`](plugins/language_odin.lua?raw=1) | Syntax for the [Odin](https://github.com/odin-lang/Odin) 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_psql`](plugins/language_psql.lua?raw=1) | Syntax for the postgresql database access language
[`language_rust`](plugins/language_rust.lua?raw=1) | Syntax for the [Rust](https://rust-lang.org/) programming language
[`language_sh`](plugins/language_sh.lua?raw=1) | Syntax for shell scripting language
[`language_tex`](plugins/language_tex.lua?raw=1) | Syntax for the [LaTeX](https://www.latex-project.org/) typesetting language
[`language_wren`](plugins/language_wren.lua?raw=1) | Syntax for the [Wren](http://wren.io/) programming language
[`lfautoinsert`](plugins/lfautoinsert.lua?raw=1) | Automatically inserts indentation and closing bracket/text after newline
-[`lineguide`](plugins/lineguide.lua?raw=1) | Displays a line-guide at the line limit offset *([screenshot](https://user-images.githubusercontent.com/3920290/81476159-2cf70000-9208-11ea-928b-9dae3884c477.png))*
[`linecopypaste`](plugins/linecopypaste.lua?raw=1) | Copy, cut and paste the current line when nothing is selected
+[`lineguide`](plugins/lineguide.lua?raw=1) | Displays a line-guide at the line limit offset *([screenshot](https://user-images.githubusercontent.com/3920290/81476159-2cf70000-9208-11ea-928b-9dae3884c477.png))*
[`linter`](https://github.com/drmargarido/linters)* | Linters for multiple languages
[`macmodkeys`](plugins/macmodkeys.lua?raw=1) | Remaps mac modkeys `command/option` to `ctrl/alt`
[`markers`](plugins/markers.lua?raw=1) | Add markers to docs and jump between them quickly *([screenshot](https://user-images.githubusercontent.com/3920290/82252149-5faaa200-9946-11ea-9199-bea2efb7ee23.png))*
diff --git a/plugins/language_pico8.lua b/plugins/language_pico8.lua
new file mode 100644
index 0000000..8edf92f
--- /dev/null
+++ b/plugins/language_pico8.lua
@@ -0,0 +1,51 @@
+local syntax = require "core.syntax"
+
+syntax.add {
+ files = "%.p8$",
+ headers = "^pico-8 cartridge",
+ comment = "--",
+ patterns = {
+ { pattern = { 'pico%-8 cartridge', '__lua__' }, type = "comment" },
+ { pattern = { '__gfx__\n', '%z' }, type = "comment" },
+ { pattern = { '"', '"', '\\' }, type = "string" },
+ { pattern = { "'", "'", '\\' }, type = "string" },
+ { pattern = { "%[%[", "%]%]" }, type = "string" },
+ { pattern = { "%-%-%[%[", "%]%]"}, type = "comment" },
+ { pattern = "%-%-.-\n", type = "comment" },
+ { pattern = "-?0x%x+", type = "number" },
+ { pattern = "-?%d+[%d%.eE]*", type = "number" },
+ { pattern = "-?%.?%d+", type = "number" },
+ { pattern = "%.%.%.?", type = "operator" },
+ { pattern = "[<>~=&|]=", type = "operator" },
+ { pattern = "[%+%-=/%*%^%%#<>]", type = "operator" },
+ { pattern = "[%a_][%w_]*%s*%f[(\"{]", type = "function" },
+ { pattern = "[%a_][%w_]*", type = "symbol" },
+ { pattern = "::[%a_][%w_]*::", type = "function" },
+ },
+ symbols = {
+ ["if"] = "keyword",
+ ["then"] = "keyword",
+ ["else"] = "keyword",
+ ["elseif"] = "keyword",
+ ["end"] = "keyword",
+ ["do"] = "keyword",
+ ["function"] = "keyword",
+ ["repeat"] = "keyword",
+ ["until"] = "keyword",
+ ["while"] = "keyword",
+ ["for"] = "keyword",
+ ["break"] = "keyword",
+ ["return"] = "keyword",
+ ["local"] = "keyword",
+ ["in"] = "keyword",
+ ["not"] = "keyword",
+ ["and"] = "keyword",
+ ["or"] = "keyword",
+ ["goto"] = "keyword",
+ ["self"] = "keyword2",
+ ["true"] = "literal",
+ ["false"] = "literal",
+ ["nil"] = "literal",
+ },
+}
+