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
103
104
|
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
files = { "Caddyfile" },
comment = "#",
patterns = {
{ pattern = { "#", "\n"}, type = "comment" },
{ pattern = { '"', '"', '\\' }, type = "string" },
-- Matcher definition
{ pattern = "@[%w_]+", type = "operator" },
-- Snippet
{ pattern = "%(%g+%)", type = "operator" },
-- Properties
{ pattern = "^[%a_][%w_]*()%s+%f[%g]",
type = { "function", "normal" }
},
{ pattern = "^[%a_][%w_]*()%s+$",
type = { "function", "normal" }
},
{ pattern = "^%s*()[%a_][%w_]*()%s+$",
type = { "normal", "function", "normal" }
},
{ pattern = "^%s*()[%a_][%w_]*()%s+%f[%g]",
type = { "normal", "function", "normal" }
},
-- Environment variables
{ pattern = "{()%$[%w_]+():()[%w_]+()}",
type = { "operator", "keyword2", "operator", "keyword2", "operator" }
},
{ pattern = "{()%$[%w_]+()}",
type = { "operator", "keyword2", "operator" }
},
-- Place holder
{ pattern = "{%g-}", type = "keyword2" },
-- Operators
{ pattern = "[+%-,:]", type = "operator" },
-- IP Address
{ pattern = "%d+%.%d+%.%d+%.%d+", type = "literal" },
-- Path /path/subpath
{ pattern = "/[%w%./]+", type = "literal" },
-- Wildcard domain *.levels
{ pattern = "%*()[%w.]+",
type = { "operator", "literal" }
},
-- Match Operator
{ pattern = "%*+", type = "operator" },
-- Domain leve1.level2
{ pattern = "https?://[%w%./%*]+", type = "literal" },
-- Domain leve1.level2
{ pattern = "%w+%.[%w%.]+", type = "literal" },
-- Number
{ pattern = "%d+[mhskbi]*", type = "number" },
-- Everything else for symbols to work
{ pattern = "[%a_][%w_]*", type = "symbol" },
},
symbols = {
["true"] = "literal",
["false"] = "literal",
["localhost"] = "literal",
-- built-in directives
["abort"] = "keyword",
["acme_server"] = "keyword",
["basicauth"] = "keyword",
["bind"] = "keyword",
["encode"] = "keyword",
["error"] = "keyword",
["file_server"] = "keyword",
["forward_auth"] = "keyword",
["handle"] = "keyword",
["handle_errors"] = "keyword",
["handle_path"] = "keyword",
["header"] = "keyword",
["import"] = "keyword",
["log"] = "keyword",
["method"] = "keyword",
["map"] = "keyword",
["metrics"] = "keyword",
["php_fastcgi"] = "keyword",
["push"] = "keyword",
["redir"] = "keyword",
["request_body"] = "keyword",
["request_header"] = "keyword",
["respond"] = "keyword",
["reverse_proxy"] = "keyword",
["rewrite"] = "keyword",
["root"] = "keyword",
["route"] = "keyword",
["templates"] = "keyword",
["tls"] = "keyword",
["tracing"] = "keyword",
["try_files"] = "keyword",
["uri"] = "keyword",
["vars"] = "keyword",
-- Module directives
["cgi"] = "keyword",
["ssh"] = "keyword",
["exec"] = "keyword",
["supervisor"] = "keyword",
["layer4"] = "keyword",
},
}
|