annotate runtime/syntax/dtd.vim @ 21528:e0aa9b81f6a9 v8.2.1314

patch 8.2.1314: Vim9: rule for comment after :function is confusing Commit: https://github.com/vim/vim/commit/9898107f54a330c6d9629976250a393169c698ca Author: Bram Moolenaar <Bram@vim.org> Date: Wed Jul 29 14:40:25 2020 +0200 patch 8.2.1314: Vim9: rule for comment after :function is confusing Problem: Vim9: rule for comment after :function is confusing. Solution: Allow double quoted comment after :function in vim9script. (closes #6556)
author Bram Moolenaar <Bram@vim.org>
date Wed, 29 Jul 2020 14:45:05 +0200
parents 6d11fc4aa683
children f0d7cb510ce3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 " Vim syntax file
18456
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 10051
diff changeset
2 " Language: DTD (Document Type Definition for XML)
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 10051
diff changeset
3 " Maintainer: Christian Brabandt <cb@256bit.org>
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 10051
diff changeset
4 " Repository: https://github.com/chrisbra/vim-xml-ftplugin
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 10051
diff changeset
5 " Previous Maintainer: Johannes Zellner <johannes@zellner.org>
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 10051
diff changeset
6 " Author: Daniel Amyot <damyot@site.uottawa.ca>
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 10051
diff changeset
7 " Last Changed: Sept 24, 2019
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 10051
diff changeset
8 " Filenames: *.dtd
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 " REFERENCES:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 " http://www.w3.org/TR/html40/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 " http://www.w3.org/TR/NOTE-html-970421
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 " TODO:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 " - improve synchronizing.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16
3526
dd6c2497c997 Fix more 'cpo' issues in runtime files.
Bram Moolenaar <bram@vim.org>
parents: 826
diff changeset
17 if exists("b:current_syntax")
dd6c2497c997 Fix more 'cpo' issues in runtime files.
Bram Moolenaar <bram@vim.org>
parents: 826
diff changeset
18 finish
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 endif
3526
dd6c2497c997 Fix more 'cpo' issues in runtime files.
Bram Moolenaar <bram@vim.org>
parents: 826
diff changeset
20 let s:dtd_cpo_save = &cpo
dd6c2497c997 Fix more 'cpo' issues in runtime files.
Bram Moolenaar <bram@vim.org>
parents: 826
diff changeset
21 set cpo&vim
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 if !exists("dtd_ignore_case")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 " I prefer having the case takes into consideration.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 syn case match
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 syn case ignore
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 " the following line makes the opening <! and
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 " closing > highlighted using 'dtdFunction'.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 " PROVIDES: @dtdTagHook
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 syn region dtdTag matchgroup=dtdFunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 \ start=+<!+ end=+>+ matchgroup=NONE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 \ contains=dtdTag,dtdTagName,dtdError,dtdComment,dtdString,dtdAttrType,dtdAttrDef,dtdEnum,dtdParamEntityInst,dtdParamEntityDecl,dtdCard,@dtdTagHook
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 if !exists("dtd_no_tag_errors")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 " mark everything as an error which starts with a <!
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 " and is not overridden later. If this is annoying,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 " it can be switched off by setting the variable
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 " dtd_no_tag_errors.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 syn region dtdError contained start=+<!+lc=2 end=+>+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 " if this is a html like comment hightlight also
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49 " the opening <! and the closing > as Comment.
826
1cdd2661f34c updated for version 7.0d01
vimboss
parents: 7
diff changeset
50 syn region dtdComment start=+<![ \t]*--+ end=+-->+ contains=dtdTodo,@Spell
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 " proper DTD comment
826
1cdd2661f34c updated for version 7.0d01
vimboss
parents: 7
diff changeset
54 syn region dtdComment contained start=+--+ end=+--+ contains=dtdTodo,@Spell
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57 " Start tags (keywords). This is contained in dtdFunction.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58 " Note that everything not contained here will be marked
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59 " as error.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60 syn match dtdTagName contained +<!\(ATTLIST\|DOCTYPE\|ELEMENT\|ENTITY\|NOTATION\|SHORTREF\|USEMAP\|\[\)+lc=2,hs=s+2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 " wildcards and operators
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 syn match dtdCard contained "|"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65 syn match dtdCard contained ","
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 " evenutally overridden by dtdEntity
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 syn match dtdCard contained "&"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68 syn match dtdCard contained "?"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69 syn match dtdCard contained "\*"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 syn match dtdCard contained "+"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 " ...and finally, special cases.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73 syn match dtdCard "ANY"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74 syn match dtdCard "EMPTY"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76 if !exists("dtd_no_param_entities")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78 " highlight parameter entity declarations
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 " and instances. Note that the closing `;'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80 " is optional.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 " instances
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83 syn region dtdParamEntityInst oneline matchgroup=dtdParamEntityPunct
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84 \ start="%[-_a-zA-Z0-9.]\+"he=s+1,rs=s+1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85 \ skip=+[-_a-zA-Z0-9.]+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86 \ end=";\|\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87 \ matchgroup=NONE contains=dtdParamEntityPunct
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88 syn match dtdParamEntityPunct contained "\."
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90 " declarations
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91 " syn region dtdParamEntityDecl oneline matchgroup=dtdParamEntityDPunct start=+<!ENTITY % +lc=8 skip=+[-_a-zA-Z0-9.]+ matchgroup=NONE end="\>" contains=dtdParamEntityDPunct
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92 syn match dtdParamEntityDecl +<!ENTITY % [-_a-zA-Z0-9.]*+lc=8 contains=dtdParamEntityDPunct
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93 syn match dtdParamEntityDPunct contained "%\|\."
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
97 " &entities; compare with xml
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98 syn match dtdEntity "&[^; \t]*;" contains=dtdEntityPunct
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99 syn match dtdEntityPunct contained "[&.;]"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
100
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101 " Strings are between quotes
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
102 syn region dtdString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=dtdAttrDef,dtdAttrType,dtdEnum,dtdParamEntityInst,dtdEntity,dtdCard
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
103 syn region dtdString start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=dtdAttrDef,dtdAttrType,dtdEnum,dtdParamEntityInst,dtdEntity,dtdCard
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
104
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
105 " Enumeration of elements or data between parenthesis
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
106 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
107 " PROVIDES: @dtdEnumHook
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
108 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109 syn region dtdEnum matchgroup=dtdType start="(" end=")" matchgroup=NONE contains=dtdEnum,dtdParamEntityInst,dtdCard,@dtdEnumHook
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
111 "Attribute types
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
112 syn keyword dtdAttrType NMTOKEN ENTITIES NMTOKENS ID CDATA
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
113 syn keyword dtdAttrType IDREF IDREFS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
114 " ENTITY has to treated special for not overriding <!ENTITY
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
115 syn match dtdAttrType +[^!]\<ENTITY+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
116
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
117 "Attribute Definitions
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
118 syn match dtdAttrDef "#REQUIRED"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
119 syn match dtdAttrDef "#IMPLIED"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
120 syn match dtdAttrDef "#FIXED"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
121
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
122 syn case match
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
123 " define some common keywords to mark TODO
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
124 " and important sections inside comments.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
125 syn keyword dtdTodo contained TODO FIXME XXX
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
126
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
127 syn sync lines=250
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
128
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
129 " Define the default highlighting.
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 3526
diff changeset
130 " Only when an item doesn't have highlighting yet
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 3526
diff changeset
131
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 3526
diff changeset
132 " The default highlighting.
10051
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
133 hi def link dtdFunction Function
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
134 hi def link dtdTag Normal
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
135 hi def link dtdType Type
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
136 hi def link dtdAttrType dtdType
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
137 hi def link dtdAttrDef dtdType
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
138 hi def link dtdConstant Constant
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
139 hi def link dtdString dtdConstant
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
140 hi def link dtdEnum dtdConstant
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
141 hi def link dtdCard dtdFunction
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
142
10051
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
143 hi def link dtdEntity Statement
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
144 hi def link dtdEntityPunct dtdType
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
145 hi def link dtdParamEntityInst dtdConstant
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
146 hi def link dtdParamEntityPunct dtdType
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
147 hi def link dtdParamEntityDecl dtdType
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
148 hi def link dtdParamEntityDPunct dtdComment
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
149
10051
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
150 hi def link dtdComment Comment
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
151 hi def link dtdTagName Statement
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
152 hi def link dtdError Error
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
153 hi def link dtdTodo Todo
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
154
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
155
3526
dd6c2497c997 Fix more 'cpo' issues in runtime files.
Bram Moolenaar <bram@vim.org>
parents: 826
diff changeset
156 let &cpo = s:dtd_cpo_save
dd6c2497c997 Fix more 'cpo' issues in runtime files.
Bram Moolenaar <bram@vim.org>
parents: 826
diff changeset
157 unlet s:dtd_cpo_save
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
158
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
159 let b:current_syntax = "dtd"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
160
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
161 " vim: ts=8