Skip to content

Commit

Permalink
Sync docker lexer to latest Pygments.
Browse files Browse the repository at this point in the history
Fixes #265.
  • Loading branch information
alecthomas committed Sep 11, 2019
1 parent 2f5349a commit 5152194
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions lexers/d/docker.go
Expand Up @@ -2,8 +2,9 @@ package d

import (
. "github.com/alecthomas/chroma" // nolint
. "github.com/alecthomas/chroma/lexers/b"
"github.com/alecthomas/chroma/lexers/b"
"github.com/alecthomas/chroma/lexers/internal"
"github.com/alecthomas/chroma/lexers/j"
)

// Docker lexer.
Expand All @@ -17,11 +18,14 @@ var Docker = internal.Register(MustNewLexer(
},
Rules{
"root": {
{`^(ONBUILD)(\s+)((?:FROM|MAINTAINER|CMD|EXPOSE|ENV|ADD|ENTRYPOINT|VOLUME|WORKDIR))\b`, ByGroups(NameKeyword, TextWhitespace, Keyword), nil},
{`^((?:FROM|MAINTAINER|CMD|EXPOSE|ENV|ADD|ENTRYPOINT|VOLUME|WORKDIR))\b(.*)`, ByGroups(Keyword, LiteralString), nil},
{`#.*`, Comment, nil},
{`RUN`, Keyword, nil},
{`(.*\\\n)*.+`, Using(Bash), 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},
},
},
))

0 comments on commit 5152194

Please sign in to comment.