@@ -8,27 +8,50 @@ first_line_match: \s*(FROM|ARG)\s
8
8
scope : source.dockerfile
9
9
10
10
variables :
11
- build_directive : (?:(ONBUILD)\s+)?(ADD|ARG|COPY|ENV|EXPOSE|HEALTHCHECK|LABEL|MAINTAINER|RUN|SHELL|STOPSIGNAL|USER|VOLUME|WORKDIR)
12
- runtime_directive : (?:(ONBUILD)\s+)?(CMD|ENTRYPOINT)
11
+ onbuild_directive : (?:(ONBUILD)\s+)?
12
+ onbuild_commands_directive : " {{onbuild_directive}}(?:ADD|ARG|ENV|EXPOSE|HEALTHCHECK|LABEL|RUN|SHELL|STOPSIGNAL|USER|VOLUME|WORKDIR)"
13
+ nononbuild_commands_directive : MAINTAINER
14
+ runtime_directive : " {{onbuild_directive}}(?:CMD|ENTRYPOINT)"
15
+ from_directive : (FROM)\s+[^\s:@]+(?:[:@](\S+))?(?:\s+(AS)\s+(\S+))?
16
+ copy_directive : ({{onbuild_directive}}COPY)(?:\s+--from=(\S+))?
13
17
14
18
contexts :
15
19
main :
16
20
- include : comments
17
- - match : ^FROM \s
21
+ - match : ^ARG \s
18
22
scope : keyword.control.dockerfile
23
+ - include : from
24
+
25
+ from :
26
+ - match : ^{{from_directive}}
27
+ captures :
28
+ 1 : keyword.control.dockerfile
29
+ 2 : entity.name.enum.tag-digest
30
+ 3 : keyword.control.dockerfile
31
+ 4 : variable.stage-name
19
32
push : body
20
33
21
34
body :
22
35
- include : comments
23
36
- include : directives
24
37
- include : invalid
38
+ - include : from
25
39
26
40
directives :
27
- - match : ^\s*{{build_directive }}\s
41
+ - match : ^\s*{{onbuild_commands_directive }}\s
28
42
captures :
29
43
0 : keyword.control.dockerfile
30
44
1 : keyword.other.special-method.dockerfile
31
45
push : args
46
+ - match : ^\s*{{nononbuild_commands_directive}}\s
47
+ scope : keyword.control.dockerfile
48
+ push : args
49
+ - match : ^\s*{{copy_directive}}\s
50
+ captures :
51
+ 1 : keyword.control.dockerfile
52
+ 2 : keyword.other.special-method.dockerfile
53
+ 3 : variable.stage-name
54
+ push : args
32
55
- match : ^\s*{{runtime_directive}}\s
33
56
captures :
34
57
0 : keyword.operator.dockerfile
0 commit comments