annotate runtime/syntax/dockerfile.vim @ 33872:2c5ae1ce5af2 v9.0.2146

patch 9.0.2146: text-property without type errors when joining Commit: https://github.com/vim/vim/commit/0d0b3b19517c321b089d637919e88e49a07a3d85 Author: Christian Brabandt <cb@256bit.org> Date: Sun Dec 3 17:56:43 2023 +0100 patch 9.0.2146: text-property without type errors when joining Problem: text-property without type errors when joining Solution: count all text-properties, with or without type before joining lines Error when joining lines with text properties without a proper type When joining lines, we need to consider all text properties that are attached to a line, even when those text properties are invalid and do not have a type attached to them. However, since patch v9.0.0993 (commit: 89469d157aea01513bde826b4519dd6b5fbceae4) those text properties won't be counted when joining lines and therefore this will cause the adjustment for text properties on joining to go wrong (and may later cause SIGABRT with an invalid free pointer) I am not sure, why the condition to not count text properties with a valid type was added in patch v9.0.993, because no test fails if those condition is removed. So let's just remove this condition and add a test that verifies, that we are able to join lines, even when the text properties attached to it do not have a valid type. fixes: #13609 closes: #13614 Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Sun, 10 Dec 2023 15:16:11 +0100
parents 7be3663e2f2b
children 0c191d9c6206
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6180
6921742f396a Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
1 " dockerfile.vim - Syntax highlighting for Dockerfiles
9860
9eaf8ef656e9 commit https://github.com/vim/vim/commit/0952131376a517fc12dc5ae908a97018b4ee23f0
Christian Brabandt <cb@256bit.org>
parents: 6180
diff changeset
2 " Maintainer: Honza Pokorny <https://honza.ca>
19404
7be3663e2f2b Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 19303
diff changeset
3 " Last Change: 2020 Feb 11
6180
6921742f396a Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
4 " License: BSD
6921742f396a Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
5
19303
51bc26d4a393 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 17758
diff changeset
6 " https://docs.docker.com/engine/reference/builder/
6180
6921742f396a Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
7
6921742f396a Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
8 if exists("b:current_syntax")
6921742f396a Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
9 finish
6921742f396a Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
10 endif
6921742f396a Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
11
19303
51bc26d4a393 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 17758
diff changeset
12 syntax include @JSON syntax/json.vim
51bc26d4a393 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 17758
diff changeset
13 unlet b:current_syntax
51bc26d4a393 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 17758
diff changeset
14
51bc26d4a393 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 17758
diff changeset
15 syntax include @Shell syntax/sh.vim
51bc26d4a393 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 17758
diff changeset
16 unlet b:current_syntax
6180
6921742f396a Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
17
6921742f396a Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
18 syntax case ignore
19303
51bc26d4a393 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 17758
diff changeset
19 syntax match dockerfileLinePrefix /\v^\s*(ONBUILD\s+)?\ze\S/ contains=dockerfileKeyword nextgroup=dockerfileInstruction skipwhite
51bc26d4a393 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 17758
diff changeset
20 syntax region dockerfileFrom matchgroup=dockerfileKeyword start=/\v^\s*(FROM)\ze(\s|$)/ skip=/\v\\\_./ end=/\v((^|\s)AS(\s|$)|$)/ contains=dockerfileOption
6180
6921742f396a Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
21
19303
51bc26d4a393 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 17758
diff changeset
22 syntax keyword dockerfileKeyword contained ADD ARG CMD COPY ENTRYPOINT ENV EXPOSE HEALTHCHECK LABEL MAINTAINER ONBUILD RUN SHELL STOPSIGNAL USER VOLUME WORKDIR
51bc26d4a393 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 17758
diff changeset
23 syntax match dockerfileOption contained /\v(^|\s)\zs--\S+/
6180
6921742f396a Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
24
19404
7be3663e2f2b Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 19303
diff changeset
25 syntax match dockerfileInstruction contained /\v<(\S+)>(\s+--\S+)*/ contains=dockerfileKeyword,dockerfileOption skipwhite nextgroup=dockerfileValue
7be3663e2f2b Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 19303
diff changeset
26 syntax match dockerfileInstruction contained /\v<(ADD|COPY)>(\s+--\S+)*/ contains=dockerfileKeyword,dockerfileOption skipwhite nextgroup=dockerfileJSON
7be3663e2f2b Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 19303
diff changeset
27 syntax match dockerfileInstruction contained /\v<(HEALTHCHECK)>(\s+--\S+)*/ contains=dockerfileKeyword,dockerfileOption skipwhite nextgroup=dockerfileInstruction
7be3663e2f2b Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 19303
diff changeset
28 syntax match dockerfileInstruction contained /\v<(CMD|ENTRYPOINT|RUN)>/ contains=dockerfileKeyword skipwhite nextgroup=dockerfileShell
7be3663e2f2b Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 19303
diff changeset
29 syntax match dockerfileInstruction contained /\v<(CMD|ENTRYPOINT|RUN)>\ze\s+\[/ contains=dockerfileKeyword skipwhite nextgroup=dockerfileJSON
7be3663e2f2b Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 19303
diff changeset
30 syntax match dockerfileInstruction contained /\v<(SHELL|VOLUME)>/ contains=dockerfileKeyword skipwhite nextgroup=dockerfileJSON
17758
f2c2f9126a82 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 9860
diff changeset
31
19303
51bc26d4a393 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 17758
diff changeset
32 syntax region dockerfileString contained start=/\v"/ skip=/\v\\./ end=/\v"/
51bc26d4a393 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 17758
diff changeset
33 syntax region dockerfileJSON contained keepend start=/\v\[/ skip=/\v\\\_./ end=/\v$/ contains=@JSON
51bc26d4a393 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 17758
diff changeset
34 syntax region dockerfileShell contained keepend start=/\v/ skip=/\v\\\_./ end=/\v$/ contains=@Shell
51bc26d4a393 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 17758
diff changeset
35 syntax region dockerfileValue contained keepend start=/\v/ skip=/\v\\\_./ end=/\v$/ contains=dockerfileString
6180
6921742f396a Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
36
19303
51bc26d4a393 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 17758
diff changeset
37 syntax region dockerfileComment start=/\v^\s*#/ end=/\v$/
51bc26d4a393 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 17758
diff changeset
38 set commentstring=#\ %s
6180
6921742f396a Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
39
6921742f396a Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
40 hi def link dockerfileString String
6921742f396a Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
41 hi def link dockerfileKeyword Keyword
6921742f396a Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
42 hi def link dockerfileComment Comment
19303
51bc26d4a393 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 17758
diff changeset
43 hi def link dockerfileOption Special
51bc26d4a393 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 17758
diff changeset
44
51bc26d4a393 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 17758
diff changeset
45 let b:current_syntax = "dockerfile"