aboutsummaryrefslogtreecommitdiff
path: root/plugins/language_fennel.lua
blob: 96283c18351a69a3d3c2339ae129d90dff1de449 (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
94
95
96
97
98
99
100
101
102
-- mod-version:3 --lite-xl 2.1
-- 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 {
  name = "Fennel",
  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",
  }
}