aboutsummaryrefslogtreecommitdiff
path: root/plugins/language_elixir.lua
blob: 280c2cea21d8c6e4c30c5117fbc74246afa3abc3 (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
-- lite-xl 1.16
local syntax = require "core.syntax"

syntax.add {
  files = { "%.ex$", "%.exs$"},
  comment = "#",
  patterns = {
    { pattern = "#.*\n",                type = "comment"  },
    { pattern = { ':"', '"', '\\' },    type = "number"   },
    { pattern = { '"""', '"""', '\\' }, type = "string"   },
    { pattern = { '"', '"', '\\' },     type = "string"   },
    { pattern = { "'", "'", '\\' },     type = "string"   },
    { pattern = { '~%a[/"|\'%(%[%{<]', '[/"|\'%)%]%}>]', '\\' }, type = "string"},
    { pattern = "-?0x%x+",              type = "number"   },
    { pattern = "-?%d+[%d%.eE]*f?",     type = "number"   },
    { pattern = "-?%.?%d+f?",           type = "number"   },
    { pattern = ':"?[%a_][%w_]*"?',     type = "number"   },
    { pattern = "[%a][%w_!?]*%f[(]",    type = "function" },
    { pattern = "%u%w+",                type = "normal"   },
    { pattern = "@[%a_][%w_]*",         type = "keyword2" },
    { pattern = "_%a[%w_]*",            type = "keyword2" },
    { pattern = "[%+%-=/%*<>!|&]",      type = "operator" },
    { pattern = "[%a_][%w_]*",          type = "symbol"   },
  },
  symbols = {
    ["def"]              = "keyword",
    ["defp"]             = "keyword",
    ["defguard"]         = "keyword",
    ["defguardp"]        = "keyword",
    ["defmodule"]        = "keyword",
    ["defprotocol"]      = "keyword",
    ["defimpl"]          = "keyword",
    ["defrecord"]        = "keyword",
    ["defrecordp"]       = "keyword",
    ["defmacro"]         = "keyword",
    ["defmacrop"]        = "keyword",
    ["defdelegate"]      = "keyword",
    ["defoverridable"]   = "keyword",
    ["defexception"]     = "keyword",
    ["defcallback"]      = "keyword",
    ["defstruct"]        = "keyword",
    ["for"]              = "keyword",
    ["case"]             = "keyword",
    ["when"]             = "keyword",
    ["with"]             = "keyword",
    ["cond"]             = "keyword",
    ["if"]               = "keyword",
    ["unless"]           = "keyword",
    ["try"]              = "keyword",
    ["receive"]          = "keyword",
    ["after"]            = "keyword",
    ["raise"]            = "keyword",
    ["rescue"]           = "keyword",
    ["catch"]            = "keyword",
    ["else"]             = "keyword",
    ["quote"]            = "keyword",
    ["unquote"]          = "keyword",
    ["super"]            = "keyword",
    ["unquote_splicing"] = "keyword",
    ["do"]               = "keyword",
    ["end"]              = "keyword",
    ["fn"]               = "keyword",
    ["import"]           = "keyword2",
    ["alias"]            = "keyword2",
    ["use"]              = "keyword2",
    ["require"]          = "keyword2",
    ["and"]              = "operator",
    ["or"]               = "operator",
    ["true"]             = "literal",
    ["false"]            = "literal",
    ["nil"]              = "literal",
  },
}

syntax.add {
  files = { "%.l?eex$" },
  patterns = {
    { pattern = { "<!%-%-", "%-%->" },     type = "comment"  },
    { pattern = { '%f[^>][^<]', '%f[<]' }, type = "normal"   },
    { pattern = { '<%%=?', '%%>' },        type = "normal"   },
    { pattern = { '"', '"', '\\' },        type = "string"   },
    { pattern = { "'", "'", '\\' },        type = "string"   },
    { pattern = "0x[%da-fA-F]+",           type = "number"   },
    { pattern = "-?%d+[%d%.]*f?",          type = "number"   },
    { pattern = "-?%.?%d+f?",              type = "number"   },
    { pattern = "%f[^<]![%a_][%w_]*",      type = "keyword2" },
    { pattern = "%f[^<][%a_][%w_]*",       type = "function" },
    { pattern = "%f[^<]/[%a_][%w_]*",      type = "function" },
    { pattern = "[%a_][%w_]*",             type = "keyword"  },
    { pattern = "[/<>=]",                  type = "operator" },
  },
  symbols = {},
}