summaryrefslogtreecommitdiff
path: root/pygments/lexers/configs.py
diff options
context:
space:
mode:
authorTim Hatch <tim@timhatch.com>2014-10-06 21:41:33 -0700
committerTim Hatch <tim@timhatch.com>2014-10-06 21:41:33 -0700
commit855647a8912f4b82209b45d028a69334c37b75d5 (patch)
tree91fc177928b54a451a4f03aa9236fc85b1cb4744 /pygments/lexers/configs.py
parent877a173f8a91b3626dd2681e549a50fa269d717f (diff)
downloadpygments-855647a8912f4b82209b45d028a69334c37b75d5.tar.gz
DockerLexer: Improve multiline and quote handling.
Fixes #1040
Diffstat (limited to 'pygments/lexers/configs.py')
-rw-r--r--pygments/lexers/configs.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/pygments/lexers/configs.py b/pygments/lexers/configs.py
index 6540615a..19d8c029 100644
--- a/pygments/lexers/configs.py
+++ b/pygments/lexers/configs.py
@@ -517,7 +517,7 @@ class DockerLexer(RegexLexer):
filenames = ['Dockerfile', '*.docker']
mimetypes = ['text/x-dockerfile-config']
- _keywords = (r'(?:FROM|MAINTAINER|RUN|CMD|EXPOSE|ENV|ADD|ENTRYPOINT|'
+ _keywords = (r'(?:FROM|MAINTAINER|CMD|EXPOSE|ENV|ADD|ENTRYPOINT|'
r'VOLUME|WORKDIR)')
flags = re.IGNORECASE | re.MULTILINE
@@ -526,8 +526,9 @@ class DockerLexer(RegexLexer):
'root': [
(r'^(ONBUILD)(\s+)(%s)\b' % (_keywords,),
bygroups(Name.Keyword, Whitespace, Keyword)),
- (_keywords + r'\b', Keyword),
+ (r'^(%s)\b(.*)' % (_keywords,), bygroups(Keyword, String)),
(r'#.*', Comment),
- (r'.+', using(BashLexer)),
+ (r'RUN', Keyword), # Rest of line falls through
+ (r'(.*\\\n)*.+', using(BashLexer)),
],
}