Mercurial > yakumo_izuru > aya
comparison vendor/github.com/alecthomas/chroma/v2/lexers/docker.go @ 66:787b5ee0289d draft
Use vendored modules
Signed-off-by: Izuru Yakumo <yakumo.izuru@chaotic.ninja>
author | yakumo.izuru |
---|---|
date | Sun, 23 Jul 2023 13:18:53 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
65:6d985efa0f7a | 66:787b5ee0289d |
---|---|
1 package lexers | |
2 | |
3 import ( | |
4 . "github.com/alecthomas/chroma/v2" // nolint | |
5 ) | |
6 | |
7 // Docker lexer. | |
8 var 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 | |
19 func 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 } |