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