aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Huelsman <joshuahuelsman@gmail.com>2020-01-11 22:04:23 -0500
committerJoshua Huelsman <joshuahuelsman@gmail.com>2020-01-11 22:04:23 -0500
commit36aeca442e4fa010f334e2d350d73984a0a9beb3 (patch)
treed93ee8d3ff1bc763365f0fe248615117a418c7bb
parentae5622a3e6069bca10ffd94a2f673e4f12560b54 (diff)
downloadlite-xl-plugins-36aeca442e4fa010f334e2d350d73984a0a9beb3.tar.gz
lite-xl-plugins-36aeca442e4fa010f334e2d350d73984a0a9beb3.zip
Add language file for the Jiyu programming language.
-rw-r--r--README.md1
-rw-r--r--language_jiyu.lua91
2 files changed, 92 insertions, 0 deletions
diff --git a/README.md b/README.md
index 0e55b87..2d6e8f7 100644
--- a/README.md
+++ b/README.md
@@ -7,6 +7,7 @@ Plugins for the [lite text editor](https://github.com/rxi/lite)
Plugin | Description
-------|-----------------------------------------
[`language_fe`](language_fe.lua?raw=1) | Syntax for the [fe](https://github.com/rxi/fe) programming language
+[`language_jiyu`](language_jiyu.lua?raw=1) | Syntax for the [jiyu](https://github.com/machinamentum/jiyu) programming language
[`language_odin`](language_odin.lua?raw=1) | Syntax for the [Odin](https://github.com/odin-lang/Odin) programming language
[`macmodkeys`](macmodkeys.lua?raw=1) | Remaps mac modkeys `command/option` to `ctrl/alt`
[`togglesnakecamel`](togglesnakecamel.lua?raw=1) | Toggles symbols between snake\_case and camelCase
diff --git a/language_jiyu.lua b/language_jiyu.lua
new file mode 100644
index 0000000..1cf94dc
--- /dev/null
+++ b/language_jiyu.lua
@@ -0,0 +1,91 @@
+local syntax = require "core.syntax"
+
+syntax.add {
+ files = { "%.jiyu$", "%.jyu$" },
+ comment = "//",
+ patterns = {
+ { pattern = "//.-\n", type = "comment" },
+ { pattern = { "/%*", "%*/" }, type = "comment" },
+ { pattern = { "\"\"\"", "\"\"\"" }, type = "string" },
+ { pattern = { '"', '"', '\\' }, type = "string" },
+ { pattern = { "'", "'", '\\' }, type = "string" },
+ { pattern = "0b[0-1]+", type = "number" },
+ { pattern = "0x[%da-fA-F]+", type = "number" },
+ { pattern = "-?%d+[%d%.]*", type = "number" },
+ { pattern = "-?%.?%d+?", type = "number" },
+ { pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" },
+ { pattern = "[<>~=+-*/]=", type = "operator" },
+ { pattern = "[..]", type = "operator" },
+ { pattern = "[%a_][%w_]*%f[(]", type = "function" },
+ { pattern = "[#@]?[%a_][%w_]*", type = "symbol" },
+ },
+ symbols = {
+ -- Keywords
+ ["func"] = "keyword",
+ ["if"] = "keyword",
+ ["else"] = "keyword",
+ ["for"] = "keyword",
+ ["while"] = "keyword",
+ ["defer"] = "keyword",
+ ["return"] = "keyword",
+ ["switch"] = "keyword",
+ ["case"] = "keyword",
+ ["break"] = "keyword",
+ ["continue"] = "keyword",
+ ["fallthrough"] = "keyword",
+ ["struct"] = "keyword",
+ ["union"] = "keyword",
+ ["enum"] = "keyword",
+ ["using"] = "keyword",
+ ["var"] = "keyword",
+ ["let"] = "keyword",
+ ["typealias"] = "keyword",
+ ["library"] = "keyword",
+ ["framework"] = "keyword",
+ ["temporary_c_vararg"] = "keyword2";
+ -- Builtin procedures and directives
+ ["cast"] = "keyword2",
+ ["sizeof"] = "keyword2",
+ ["alignof"] = "keyword2",
+ ["strideof"] = "keyword2",
+ ["offsetof"] = "keyword2",
+ ["type_of"] = "keyword2",
+ ["type_info"] = "keyword2",
+ ["#if"] = "keyword2",
+ ["#load"] = "keyword2",
+ ["#import"] = "keyword2",
+ ["#clang_import"] = "keyword2",
+ ["#file"] = "keyword2",
+ ["#filepath"] = "keyword2",
+ ["#line"] = "keyword2",
+
+ ["@c_function"] = "keyword2",
+ ["@export"] = "keyword2",
+ ["@flags"] = "keyword2",
+ ["@metaprogram"] = "keyword2",
+ -- Types
+ ["string"] = "keyword2",
+ ["int"] = "keyword2",
+ ["uint"] = "keyword2",
+ ["uint8"] = "keyword2",
+ ["uint16"] = "keyword2",
+ ["uint32"] = "keyword2",
+ ["uint64"] = "keyword2",
+ ["uint128"] = "keyword2",
+ ["int8"] = "keyword2",
+ ["int16"] = "keyword2",
+ ["int32"] = "keyword2",
+ ["int64"] = "keyword2",
+ ["int128"] = "keyword2",
+ ["float"] = "keyword2",
+ ["double"] = "keyword2",
+ ["void"] = "keyword2",
+ ["bool"] = "keyword2",
+ ["Type"] = "keyword2",
+
+ -- Literals
+ ["true"] = "literal",
+ ["false"] = "literal",
+ ["null"] = "literal",
+ }
+}