aboutsummaryrefslogtreecommitdiff
path: root/plugins/language_clojure.lua
blob: 21734be1733cdbb36340cd29e6d65605bd102a27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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
    },
}