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
|
-- Author: Rohan Vashisht https://github.com/RohanVashisht1234
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "Bend",
files = { "%.bend$" },
comment = "#",
patterns = {
{ pattern = "#.*", type = "comment" },
{ pattern = { '"', '"' }, type = "string" },
{ pattern = { "'", "'" }, type = "string" },
{ pattern = "[%a_][%w_]*%f[(]", type = "function" },
{ pattern = "[%a_][%w_]*", type = "symbol" },
{ pattern = "[%+%-=/%*%^%%<>!|&]", type = "operator" },
{ pattern = "def()%s+()[%a_][%w_]*", type = { "keyword", "normal", "literal" } }, -- tested ok
{ pattern = "data()%s+()[%a_][%w_]*", type = { "keyword", "normal", "literal" } }, -- tested ok
{ pattern = "let()%s+()[%a_][%w_]*", type = { "keyword", "normal", "literal" } }, -- tested ok
{ pattern = "Some()%s+()[%a_][%w_]*", type = { "keyword", "normal", "literal" } }, -- tested ok
{ pattern = "bend()%s+()[%a_][%w_]*", type = { "keyword", "normal", "literal" } }, -- tested ok
{ pattern = "object()%s+()[%a_][%w_]*", type = { "keyword", "normal", "literal" } }, -- tested ok
{ pattern = "fold()%s+()[%a_][%w_]*", type = { "keyword", "normal", "literal" } }, -- tested ok
{ pattern = "open()%s+()[%a_][%w_]*", type = { "keyword", "normal", "literal" } }, -- tested ok
{ pattern = "do()%s+()[%a_][%w_]*", type = { "keyword", "normal", "literal" } }, -- tested ok
{ pattern = "identity()%s+()[%a_][%w_]*", type = { "keyword", "normal", "literal" } }, -- tested ok
{ pattern = "lambda()%s+()[%a_][%w_]*", type = { "keyword", "normal", "literal" } }, -- tested ok
{ pattern = "0x[%da-fA-F]+", type = "number" },
{ pattern = "-?%d+[%d%.eE]*", type = "number" },
{ pattern = "-?%.?%d+", type = "number" },
},
symbols = {
["def"] = "keyword",
["switch"] = "keyword",
["case"] = "keyword",
["return"] = "keyword",
["if"] = "keyword",
["else"] = "keyword",
["when"] = "keyword",
["match"] = "keyword",
["λ"] = "keyword",
["Some"] = "keyword",
["data"] = "keyword",
["let"] = "keyword",
["use"] = "keyword",
["object"] = "keyword",
["fold"] = "keyword",
["open"] = "keyword",
["do"] = "keyword",
["bind"] = "keyword",
["Name"] = "keyword",
["identity"] = "keyword",
["Bool"] = "keyword",
["ask"] = "keyword",
["with"] = "keyword",
["bend"] = "keyword2",
["None"] = "keyword2",
["Nil"] = "keyword2",
["Result"] = "keyword2",
["type"] = "keyword2",
["true"] = "literal",
["false"] = "literal",
}
}
|