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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
---
# http://www.sublimetext.com/docs/3/syntax.html
name: Dockerfile
scope: source.dockerfile
file_extensions:
- Dockerfile
- dockerfile
hidden_file_extensions:
- .Dockerfile
first_line_match: ^\s*(?i:(from(?!\s+\S+\s+import)|arg))\s+
variables:
onbuild_directive: (?i:(onbuild)\s+)?
onbuild_commands_directive:
"{{onbuild_directive}}(?i:add|arg|env|expose|healthcheck|label|run|shell|stopsignal|user|volume|workdir)"
nononbuild_commands_directive: (?i:maintainer)
runtime_directive: "{{onbuild_directive}}(?i:cmd|entrypoint)"
from_directive: (?i:(from))\s+[^\s:@]+(?:[:@](\S+))?(?:\s+(?i:(as))\s+(\S+))?
copy_directive: ({{onbuild_directive}}(?i:copy))(?:\s+--from=(\S+))?
contexts:
main:
- include: comments
- match: ^(?i:arg)\s
scope: keyword.control.dockerfile
- include: from
from:
- match: ^{{from_directive}}
captures:
1: keyword.control.from.dockerfile
2: entity.name.enum.tag-digest
3: keyword.control.dockerfile
4: variable.stage-name
push: body
body:
- include: comments
- include: directives
- include: invalid
- include: from
directives:
- match: ^\s*{{onbuild_commands_directive}}\s
captures:
0: keyword.control.dockerfile
1: keyword.other.special-method.dockerfile
push: args
- match: ^\s*{{nononbuild_commands_directive}}\s
scope: keyword.control.dockerfile
push: args
- match: ^\s*{{copy_directive}}\s
captures:
1: keyword.control.dockerfile
2: keyword.other.special-method.dockerfile
3: variable.stage-name
push: args
- match: ^\s*{{runtime_directive}}\s
captures:
0: keyword.operator.dockerfile
1: keyword.other.special-method.dockerfile
push: args
escaped-char:
- match: \\.
scope: constant.character.escaped.dockerfile
args:
- include: comments
- include: escaped-char
- match: ^\s*$
- match: \\\s+$
- match: \n
pop: true
- match: '"'
scope: punctuation.definition.string.begin.dockerfile
push: double_quote_string
- match: "'"
scope: punctuation.definition.string.begin.dockerfile
push: single_quote_string
double_quote_string:
- meta_scope: string.quoted.double.dockerfile
- include: escaped-char
- match: ^\s*$
- match: \\\s+$
- match: \n
set: invalid
- match: '"'
scope: punctuation.definition.string.end.dockerfile
pop: true
single_quote_string:
- meta_scope: string.quoted.single.dockerfile
- include: escaped-char
- match: ^\s*$
- match: \\\s+$
- match: \n
set: invalid
- match: "'"
scope: punctuation.definition.string.end.dockerfile
pop: true
comments:
- match: ^(\s*)((#).*$\n?)
comment: comment.line
captures:
1: punctuation.whitespace.comment.leading.dockerfile
2: comment.dockerfile
3: punctuation.definition.comment.dockerfile
invalid:
- match: ^[^A-Z\n](.*)$
scope: invalid
set: body