File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed
Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ class Docker < RegexLexer
1212 mimetypes 'text/x-dockerfile-config'
1313
1414 KEYWORDS = %w(
15- FROM MAINTAINER CMD LABEL EXPOSE ENV ADD COPY ENTRYPOINT VOLUME USER WORKDIR ARG STOPSIGNAL HEALTHCHECK SHELL
15+ FROM MAINTAINER CMD EXPOSE ENV ADD COPY ENTRYPOINT VOLUME USER WORKDIR ARG STOPSIGNAL HEALTHCHECK SHELL
1616 ) . join ( '|' )
1717
1818 start { @shell = Shell . new ( @options ) }
@@ -40,16 +40,37 @@ class Docker < RegexLexer
4040 @shell . reset!
4141 end
4242
43+ rule %r/^LABEL(\s +)/i do
44+ token Keyword
45+ push :label
46+ end
47+
4348 rule %r/\w +/ , Text
4449 rule %r/[^\w ]+/ , Text
4550 rule %r/./ , Text
4651 end
4752
4853 state :run do
4954 rule %r/\n / , Text , :pop!
55+ rule %r/^\s *#.*\n / , Comment
5056 rule %r/\\ ./m , Str ::Escape
5157 rule ( /(\\ .|[^\n \\ ])+/ ) { delegate @shell }
5258 end
59+
60+ state :label do
61+ rule %r/\n / , Text , :pop!
62+ rule %r/^\s *#.*\n / , Comment
63+ rule %r/\s *\\ ./m , Str ::Escape
64+ rule %r/(\s *(?:\S +|"[^"]+"))(=)/ do
65+ groups Name ::Property , Punctuation
66+ push :value
67+ end
68+ end
69+
70+ state :value do
71+ rule %r/\n / , Text , :pop!
72+ rule %r/(".*?")|('.*?')/m , Str , :pop!
73+ end
5374 end
5475 end
5576end
You can’t perform that action at this time.
0 commit comments