aboutsummaryrefslogtreecommitdiff
path: root/plugins/language_clojure.lua
diff options
context:
space:
mode:
authorRohan Vashisht <81112205+RohanVashisht1234@users.noreply.github.com>2024-04-08 14:48:15 +0530
committerGitHub <noreply@github.com>2024-04-08 11:18:15 +0200
commit6358c0fce4ff6f9fa119acb0ed336fe03cd25bd4 (patch)
tree0c97c6f95736a92f5c9265a8042f53a15685d74e /plugins/language_clojure.lua
parent1541d29e0f885923b612ec2e33635314604841eb (diff)
downloadlite-xl-plugins-6358c0fce4ff6f9fa119acb0ed336fe03cd25bd4.tar.gz
lite-xl-plugins-6358c0fce4ff6f9fa119acb0ed336fe03cd25bd4.zip
Added support for Clojure programming language (#414)
* Update manifest.json * Update manifest.json * Create language_clojure.lua * Update language_clojure.lua * Update manifest.json * Update plugins/language_clojure.lua Co-authored-by: Guldoman <giulio.lettieri@gmail.com> * Update manifest.json Co-authored-by: Guldoman <giulio.lettieri@gmail.com> * Update language_clojure.lua --------- Co-authored-by: Guldoman <giulio.lettieri@gmail.com>
Diffstat (limited to 'plugins/language_clojure.lua')
-rw-r--r--plugins/language_clojure.lua54
1 files changed, 54 insertions, 0 deletions
diff --git a/plugins/language_clojure.lua b/plugins/language_clojure.lua
new file mode 100644
index 0000000..21734be
--- /dev/null
+++ b/plugins/language_clojure.lua
@@ -0,0 +1,54 @@
+-- Author: Rohan Vashisht: https://github.com/RohanVashisht1234/
+
+-- mod-version:3
+local syntax = require "core.syntax"
+syntax.add {
+ name = "Clojure", -- tested ok
+ comment = ";;", -- tested ok
+ files = {
+ "%.clojure$", -- tested ok
+ },
+ patterns = {
+ { pattern = ';;.*', type = 'comment' }, -- tested ok
+ { pattern = ';.*', type = 'comment' }, -- tested ok
+ { pattern = { '#"', '"', '\\' }, type = 'string' }, -- tested ok
+ { pattern = { '"', '"', '\\' }, type = 'string' }, -- tested ok
+ { pattern = { '"""', '"""', '\\' }, type = 'string' }, -- tested ok
+ { pattern = 'Retention()%s+()[%a_][%w_/]*', type = { 'keyword', 'normal', 'literal' } }, -- tested ok
+ { pattern = ':[%a_][%w_/%-]*', type = 'keyword2' }, -- tested ok
+ { pattern = '[%a_][%w_]*()%.()[%a_][%w_/%-]*', type = { 'keyword', 'operator', 'keyword2' } },
+ { pattern = "%(()def()%s+()[%a_][%w_%-]*", type = { "normal", "keyword", "literal", 'literal' } }, -- tested ok
+ { pattern = "%(()def[%a_][%w_]*()%s+()[%a_][%w_%-]*", type = { "normal", "keyword", "literal", 'literal' } }, -- tested ok
+ { pattern = '%(()require()%s+()[%a_][%w_]*', type = { 'normal', 'keyword', 'literal', 'literal' } }, -- tested ok
+ { pattern = '%(()[%a_][%w_/]*', type = { 'normal', 'literal' } }, -- tested ok
+ { pattern = '-?0x%x+', type = 'number' }, -- tested ok
+ { pattern = '-?%d+[%d%.eE]*f?', type = 'number' }, -- tested ok
+ { pattern = '-?%.?%d+f?', type = 'number' }, -- tested ok
+ { pattern = '[!%#%$%%&*+./%<=>%?@\\%^|%-~:]', type = 'operator' }, -- tested ok
+ { pattern = "[%a_'][%w_']*", type = 'normal' }, -- tested ok
+ },
+ symbols = {
+ ['def'] = 'keyword', -- tested ok
+ ['defn'] = 'keyword', -- tested ok
+ ['str'] = 'keyword', -- tested ok
+ ['fn'] = 'keyword', -- tested ok
+ ['println'] = 'keyword', -- tested ok
+ ['if'] = 'keyword', -- tested ok
+ ['cond'] = 'keyword', -- tested ok
+ ['vector'] = 'keyword', -- tested ok
+ ['apply'] = 'keyword', -- tested ok
+ ['String'] = 'keyword', -- tested ok
+ ['ns'] = 'keyword', -- tested ok
+ ['try'] = 'keyword', -- tested ok
+ ['let'] = 'keyword', -- tested ok
+ ['get'] = 'keyword', -- tested ok
+ ['catch'] = 'keyword', -- tested ok
+ ['Retention'] = 'keyword', -- tested ok
+ ['Deprecated'] = 'keyword', -- tested ok
+ ['require'] = 'keyword2', -- tested ok
+ ['true'] = 'keyword2', -- tested ok
+ ['false'] = 'keyword2', -- tested ok
+ ['nil'] = 'literal', -- tested ok
+ ['int'] = 'literal', -- tested ok
+ },
+}