source: code/trunk/vendor/github.com/alecthomas/chroma/v2/lexers/docker.go@ 67

Last change on this file since 67 was 67, checked in by Izuru Yakumo, 23 months ago

Use vendored modules

Signed-off-by: Izuru Yakumo <yakumo.izuru@…>

File size: 1.1 KB
Line 
1package lexers
2
3import (
4 . "github.com/alecthomas/chroma/v2" // nolint
5)
6
7// Docker lexer.
8var Docker = Register(MustNewLexer(
9 &Config{
10 Name: "Docker",
11 Aliases: []string{"docker", "dockerfile"},
12 Filenames: []string{"Dockerfile", "Dockerfile.*", "*.docker"},
13 MimeTypes: []string{"text/x-dockerfile-config"},
14 CaseInsensitive: true,
15 },
16 dockerRules,
17))
18
19func dockerRules() Rules {
20 return Rules{
21 "root": {
22 {`#.*`, Comment, nil},
23 {`(ONBUILD)((?:\s*\\?\s*))`, ByGroups(Keyword, Using("Bash")), nil},
24 {`(HEALTHCHECK)(((?:\s*\\?\s*)--\w+=\w+(?:\s*\\?\s*))*)`, ByGroups(Keyword, Using("Bash")), nil},
25 {`(VOLUME|ENTRYPOINT|CMD|SHELL)((?:\s*\\?\s*))(\[.*?\])`, ByGroups(Keyword, Using("Bash"), Using("JSON")), nil},
26 {`(LABEL|ENV|ARG)((?:(?:\s*\\?\s*)\w+=\w+(?:\s*\\?\s*))*)`, ByGroups(Keyword, Using("Bash")), nil},
27 {`((?:FROM|MAINTAINER|EXPOSE|WORKDIR|USER|STOPSIGNAL)|VOLUME)\b(.*)`, ByGroups(Keyword, LiteralString), nil},
28 {`((?:RUN|CMD|ENTRYPOINT|ENV|ARG|LABEL|ADD|COPY))`, Keyword, nil},
29 {`(.*\\\n)*.+`, Using("Bash"), nil},
30 },
31 }
32}
Note: See TracBrowser for help on using the repository browser.