-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCaddyfile.sublime-syntax
98 lines (83 loc) · 2.12 KB
/
Caddyfile.sublime-syntax
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
%YAML 1.2
---
name: Caddyfile
file_extensions: [Caddyfile]
scope: source.Caddyfile
variables:
directive: ^\s*([\w-]+)\b
key: "[\\w_.:/-]+"
contexts:
prototype:
- include: comments
- include: trailing_spaces
- include: extra_spaces
main:
- match: (^\s*import) (.*)
captures:
1: support.function.Caddyfile
2: source.Caddyfile
- include: keys
comments:
- match: "#.*"
scope: comment.line.Caddyfile
trailing_spaces:
- match: "[ \\t]+$"
scope: invalid.illegal.trailing-spaces.Caddyfile
extra_spaces:
- match: "\\s([ \\t]+){$"
captures:
1: invalid.illegal.extra-spaces.Caddyfile
server_block_common:
- include: brackets
- include: placeholders
- match: '"'
push: string
brackets:
- match: "\\s+{$"
scope: punctuation.definition.bracket.Caddyfile
push: nested_block
- match: "^\\s*}$"
scope: punctuation.definition.bracket.Caddyfile
pop: true
placeholders:
- include: env_placeholders
- match: "\\{>?\\w+\\}"
scope: constant.language.Caddyfile
env_placeholders:
- match: "\\{(\\$\\w+|%\\w+%)\\}"
scope: constant.language.Caddyfile
keys:
- include: env_placeholders
- match: "({{key}})$"
captures:
1: variable.other.Caddyfile
set: server_block
- match: "{{key}}"
scope: variable.other.Caddyfile
- match: ","
scope: keyword.operator.logical.Caddyfile
- match: "\\s{$"
scope: punctuation.definition.bracket.Caddyfile
set: server_block
server_block:
- include: matcher
- match: "{{directive}}"
captures:
1: support.function.Caddyfile
- include: server_block_common
nested_block:
- match: "{{directive}}"
captures:
1: keyword.other.Caddyfile
- include: server_block_common
string:
- meta_include_prototype: false
- meta_scope: string.quoted.double.Caddyfile
- include: placeholders
- match: \\.
scope: constant.character.escape.Caddyfile
- match: '"'
pop: true
matcher:
- match: "(?<!\\w)@\\w+"
scope: entity.name.matcher.Caddyfile