Skip to content

Commit

Permalink
Added support for Clojure programming language (#414)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>

* Update manifest.json

Co-authored-by: Guldoman <[email protected]>

* Update language_clojure.lua

---------

Co-authored-by: Guldoman <[email protected]>
  • Loading branch information
RohanVashisht1234 and Guldoman authored Apr 8, 2024
1 parent 1541d29 commit 6358c0f
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 1 deletion.
13 changes: 12 additions & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
"language_c7": {},
"language_caddyfile": {},
"language_carbon": {},
"language_clojure": {},
"language_cmake": {},
"language_containerfile": {},
"language_crystal": {},
Expand Down Expand Up @@ -159,7 +160,7 @@
"id": "meta_languages",
"mod_version": "3",
"type": "meta",
"version": "0.1.10"
"version": "0.1.11"
},
{
"description": "Align multiple carets and selections *([clip](https://user-images.githubusercontent.com/2798487/165631951-532f8d24-d596-4dd0-9d21-ff53c71ed32f.mp4))*",
Expand Down Expand Up @@ -735,6 +736,16 @@
],
"version": "0.2"
},
{
"description": "Syntax for the [Clojure](https://clojure.org/) programming language",
"id": "language_clojure",
"mod_version": "3",
"path":"plugins/language_clojure.lua"
"tags": [
"language"
],
"version": "0.1"
},
{
"description": "Syntax for the CMake build system language",
"id": "language_cmake",
Expand Down
54 changes: 54 additions & 0 deletions plugins/language_clojure.lua
Original file line number Diff line number Diff line change
@@ -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
},
}

0 comments on commit 6358c0f

Please sign in to comment.