mirror of https://github.com/go-gitea/gitea
Git with a cup of tea, painless self-hosted git service
Mirror for internal git.with.parts use
https://git.with.parts
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
1.1 KiB
32 lines
1.1 KiB
4 years ago
|
package d
|
||
|
|
||
|
import (
|
||
|
. "github.com/alecthomas/chroma" // nolint
|
||
|
"github.com/alecthomas/chroma/lexers/b"
|
||
|
"github.com/alecthomas/chroma/lexers/internal"
|
||
|
"github.com/alecthomas/chroma/lexers/j"
|
||
|
)
|
||
|
|
||
|
// Docker lexer.
|
||
|
var Docker = internal.Register(MustNewLexer(
|
||
|
&Config{
|
||
|
Name: "Docker",
|
||
|
Aliases: []string{"docker", "dockerfile"},
|
||
|
Filenames: []string{"Dockerfile", "*.docker"},
|
||
|
MimeTypes: []string{"text/x-dockerfile-config"},
|
||
|
CaseInsensitive: true,
|
||
|
},
|
||
|
Rules{
|
||
|
"root": {
|
||
|
{`#.*`, Comment, nil},
|
||
|
{`(ONBUILD)((?:\s*\\?\s*))`, ByGroups(Keyword, Using(b.Bash)), nil},
|
||
|
{`(HEALTHCHECK)(((?:\s*\\?\s*)--\w+=\w+(?:\s*\\?\s*))*)`, ByGroups(Keyword, Using(b.Bash)), nil},
|
||
|
{`(VOLUME|ENTRYPOINT|CMD|SHELL)((?:\s*\\?\s*))(\[.*?\])`, ByGroups(Keyword, Using(b.Bash), Using(j.JSON)), nil},
|
||
|
{`(LABEL|ENV|ARG)((?:(?:\s*\\?\s*)\w+=\w+(?:\s*\\?\s*))*)`, ByGroups(Keyword, Using(b.Bash)), nil},
|
||
|
{`((?:FROM|MAINTAINER|EXPOSE|WORKDIR|USER|STOPSIGNAL)|VOLUME)\b(.*)`, ByGroups(Keyword, LiteralString), nil},
|
||
|
{`((?:RUN|CMD|ENTRYPOINT|ENV|ARG|LABEL|ADD|COPY))`, Keyword, nil},
|
||
|
{`(.*\\\n)*.+`, Using(b.Bash), nil},
|
||
|
},
|
||
|
},
|
||
|
))
|