annotate runtime/syntax/jproperties.vim @ 10229:19ced29f773a v8.0.0013

commit https://github.com/vim/vim/commit/c79d6aa01d86cd98cffddc80825c1c600e833bbf Author: Bram Moolenaar <Bram@vim.org> Date: Sun Sep 25 22:27:37 2016 +0200 patch 8.0.0013 Problem: Missing comma in list. Solution: Add the comma.
author Christian Brabandt <cb@256bit.org>
date Sun, 25 Sep 2016 22:30:04 +0200
parents 46763b01cd9a
children
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
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 " Language: Java Properties resource file (*.properties[_*])
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3 " Maintainer: Simon Baldwin <simonb@sco.com>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4 " Last change: 26th Mar 2000
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6 " =============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 " Optional and tuning variables:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 " jproperties_lines
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 " -----------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 " Set a value for the sync block that we use to find long continuation lines
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 " in properties; the value is already large - if you have larger continuation
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 " sets you may need to increase it further - if not, and you find editing is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 " slow, reduce the value of jproperties_lines.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 if !exists("jproperties_lines")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 let jproperties_lines = 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 " jproperties_strict_syntax
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 " -------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 " Most properties files assign values with "id=value" or "id:value". But,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 " strictly, the Java properties parser also allows "id value", "id", and
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 " even more bizarrely "=value", ":value", " value", and so on. These latter
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 " ones, however, are rarely used, if ever, and handling them in the high-
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 " lighting can obscure errors in the more normal forms. So, in practice
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 " we take special efforts to pick out only "id=value" and "id:value" forms
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 " by default. If you want strict compliance, set jproperties_strict_syntax
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 " to non-zero (and good luck).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 if !exists("jproperties_strict_syntax")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 let jproperties_strict_syntax = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 " jproperties_show_messages
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 " -------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 " If this properties file contains messages for use with MessageFormat,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 " setting a non-zero value will highlight them. Messages are of the form
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 " "{...}". Highlighting doesn't go to the pains of picking apart what is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39 " in the format itself - just the basics for now.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 if !exists("jproperties_show_messages")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 let jproperties_show_messages = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 " =============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 7
diff changeset
46 " quit when a syntax file was already loaded
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 7
diff changeset
47 if exists("b:current_syntax")
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 " switch case sensitivity off
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 syn case ignore
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 " set the block
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55 exec "syn sync lines=" . jproperties_lines
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57 " switch between 'normal' and 'strict' syntax
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58 if jproperties_strict_syntax != 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60 " an assignment is pretty much any non-empty line at this point,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61 " trying to not think about continuation lines
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62 syn match jpropertiesAssignment "^\s*[^[:space:]]\+.*$" contains=jpropertiesIdentifier
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 " an identifier is anything not a space character, pretty much; it's
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65 " followed by = or :, or space or tab. Or end-of-line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 syn match jpropertiesIdentifier "[^=:[:space:]]*" contained nextgroup=jpropertiesDelimiter
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68 " treat the delimiter specially to get colours right
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69 syn match jpropertiesDelimiter "\s*[=:[:space:]]\s*" contained nextgroup=jpropertiesString
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71 " catch the bizarre case of no identifier; a special case of delimiter
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 syn match jpropertiesEmptyIdentifier "^\s*[=:]\s*" nextgroup=jpropertiesString
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75 " here an assignment is id=value or id:value, and we conveniently
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76 " ignore continuation lines for the present
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77 syn match jpropertiesAssignment "^\s*[^=:[:space:]]\+\s*[=:].*$" contains=jpropertiesIdentifier
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 " an identifier is anything not a space character, pretty much; it's
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80 " always followed by = or :, and we find it in an assignment
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81 syn match jpropertiesIdentifier "[^=:[:space:]]\+" contained nextgroup=jpropertiesDelimiter
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83 " treat the delimiter specially to get colours right; this time the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84 " delimiter must contain = or :
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85 syn match jpropertiesDelimiter "\s*[=:]\s*" contained nextgroup=jpropertiesString
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88 " a definition is all up to the last non-\-terminated line; strictly, Java
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89 " properties tend to ignore leading whitespace on all lines of a multi-line
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90 " definition, but we don't look for that here (because it's a major hassle)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91 syn region jpropertiesString start="" skip="\\$" end="$" contained contains=jpropertiesSpecialChar,jpropertiesError,jpropertiesSpecial
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93 " {...} is a Java Message formatter - add a minimal recognition of these
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94 " if required
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95 if jproperties_show_messages != 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96 syn match jpropertiesSpecial "{[^}]*}\{-1,\}" contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
97 syn match jpropertiesSpecial "'{" contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98 syn match jpropertiesSpecial "''" contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
100
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101 " \uABCD are unicode special characters
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
102 syn match jpropertiesSpecialChar "\\u\x\{1,4}" contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
103
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
104 " ...and \u not followed by a hex digit is an error, though the properties
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
105 " file parser won't issue an error on it, just set something wacky like zero
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
106 syn match jpropertiesError "\\u\X\{1,4}" contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
107 syn match jpropertiesError "\\u$"me=e-1 contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
108
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109 " other things of note are the \t,r,n,\, and the \ preceding line end
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110 syn match jpropertiesSpecial "\\[trn\\]" contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
111 syn match jpropertiesSpecial "\\\s" contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
112 syn match jpropertiesSpecial "\\$" contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
113
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
114 " comments begin with # or !, and persist to end of line; put here since
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
115 " they may have been caught by patterns above us
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
116 syn match jpropertiesComment "^\s*[#!].*$" contains=jpropertiesTODO
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
117 syn keyword jpropertiesTodo TODO FIXME XXX contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
118
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
119 " Define the default highlighting.
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 7
diff changeset
120 " Only when an item doesn't have highlighting yet
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
121
10051
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
122 hi def link jpropertiesComment Comment
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
123 hi def link jpropertiesTodo Todo
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
124 hi def link jpropertiesIdentifier Identifier
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
125 hi def link jpropertiesString String
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
126 hi def link jpropertiesExtendString String
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
127 hi def link jpropertiesCharacter Character
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
128 hi def link jpropertiesSpecial Special
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
129 hi def link jpropertiesSpecialChar SpecialChar
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
130 hi def link jpropertiesError Error
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
131
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
132
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
133 let b:current_syntax = "jproperties"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
134
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
135 " vim:ts=8