aboutsummaryrefslogtreecommitdiff
path: root/plugins/language_fennel.lua
diff options
context:
space:
mode:
authorrxi <rxi@users.noreply.github.com>2020-05-22 07:47:24 +0100
committerGitHub <noreply@github.com>2020-05-22 07:47:24 +0100
commit2d4cc1e82f1de37deae57c455f47b5347a637bb5 (patch)
tree775b8919be76d329dc36e49369c036c019584a3b /plugins/language_fennel.lua
parent45b2f56937691d055275687a504b2699dbf5b44a (diff)
parent0ceedf5322fefeb8fda1068438e2de421b711b17 (diff)
downloadlite-xl-plugins-2d4cc1e82f1de37deae57c455f47b5347a637bb5.tar.gz
lite-xl-plugins-2d4cc1e82f1de37deae57c455f47b5347a637bb5.zip
Merge pull request #38 from technomancy/language-fennel
Add language_fennel plugin for Fennel code.
Diffstat (limited to 'plugins/language_fennel.lua')
-rw-r--r--plugins/language_fennel.lua100
1 files changed, 100 insertions, 0 deletions
diff --git a/plugins/language_fennel.lua b/plugins/language_fennel.lua
new file mode 100644
index 0000000..7320e91
--- /dev/null
+++ b/plugins/language_fennel.lua
@@ -0,0 +1,100 @@
+-- Support for the Fennel programming language: https://fennel-lang.org
+-- Covers all the keywords up to Fennel version 0.4.0
+
+-- Currently only covers highlighting, not indentation, delimiter
+-- matching, or evaluation.
+
+local syntax = require "core.syntax"
+
+syntax.add {
+ files = "%.fnl$",
+ comment = ";",
+ patterns = {
+ { pattern = ";.-\n", type = "comment" },
+ { pattern = { '"', '"', '\\' }, type = "string" },
+ { pattern = "0x[%da-fA-F]+", type = "number" },
+ { pattern = "-?%d+[%d%.]*", type = "number" },
+ { pattern = "-?%.?%d+", type = "number" },
+ { pattern = "%f[^(][^()'%s\"]+", type = "function" },
+ { pattern = "[^()'%s\"]+", type = "symbol" },
+ },
+
+ symbols = {
+ ["eval-compiler"] = "keyword2",
+ ["doc"] = "keyword2",
+ ["lua"] = "keyword2",
+ ["hashfn"] = "keyword2",
+ ["macro"] = "keyword2",
+ ["macros"] = "keyword2",
+ ["import-macros"] = "keyword2",
+ ["do"] = "keyword2",
+ ["values"] = "keyword2",
+ ["if"] = "keyword2",
+ ["when"] = "keyword2",
+ ["each"] = "keyword2",
+ ["for"] = "keyword2",
+ ["fn"] = "keyword2",
+ ["lambda"] = "keyword2",
+ ["λ"] = "keyword2",
+ ["partial"] = "keyword2",
+ ["while"] = "keyword2",
+ ["set"] = "keyword2",
+ ["global"] = "keyword2",
+ ["var"] = "keyword2",
+ ["local"] = "keyword2",
+ ["let"] = "keyword2",
+ ["tset"] = "keyword2",
+ ["set-forcibly!"] = "keyword2",
+ ["doto"] = "keyword2",
+ ["match"] = "keyword2",
+ ["or"] = "keyword2",
+ ["and"] = "keyword2",
+ ["not"] = "keyword2",
+ ["not="] = "keyword2",
+ ["pick-args"] = "keyword2",
+ ["pick-values"] = "keyword2",
+ ["macrodebug"] = "keyword2",
+
+ ["."] = "keyword",
+ ["+"] = "keyword",
+ [".."] = "keyword",
+ ["^"] = "keyword",
+ ["-"] = "keyword",
+ ["*"] = "keyword",
+ ["%"] = "keyword",
+ ["/"] = "keyword",
+ [">"] = "keyword",
+ ["<"] = "keyword",
+ [">="] = "keyword",
+ ["<="] = "keyword",
+ ["="] = "keyword",
+ ["#"] = "keyword",
+ ["..."] = "keyword",
+ [":"] = "keyword",
+ ["->"] = "keyword",
+ ["->>"] = "keyword",
+ ["-?>"] = "keyword",
+ ["-?>>"] = "keyword",
+ ["$"] = "keyword",
+ ["$1"] = "keyword",
+ ["$2"] = "keyword",
+ ["$3"] = "keyword",
+ ["$4"] = "keyword",
+ ["$5"] = "keyword",
+ ["$6"] = "keyword",
+ ["$7"] = "keyword",
+ ["$8"] = "keyword",
+ ["$9"] = "keyword",
+
+ ["lshift"] = "keyword",
+ ["rshift"] = "keyword",
+ ["bor"] = "keyword",
+ ["band"] = "keyword",
+ ["bnot"] = "keyword",
+ ["bxor"] = "keyword",
+
+ ["nil"] = "literal",
+ ["true"] = "literal",
+ ["false"] = "literal",
+ }
+}