Mercurial > vim
annotate runtime/syntax/xdefaults.vim @ 19231:b8fd7364befd v8.2.0174
patch 8.2.0174: various commands not completely tested
Commit: https://github.com/vim/vim/commit/5d98dc2a48156d44139b75c689bd3137ff7fe8bf
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Jan 29 21:57:34 2020 +0100
patch 8.2.0174: various commands not completely tested
Problem: Various commands not completely tested.
Solution: Add more test cases. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/5551)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 29 Jan 2020 22:00:04 +0100 |
parents | 46763b01cd9a |
children |
rev | line source |
---|---|
7 | 1 " Vim syntax file |
2 " Language: X resources files like ~/.Xdefaults (xrdb) | |
3 " Maintainer: Johannes Zellner <johannes@zellner.org> | |
4 " Author and previous maintainer: | |
5 " Gautam H. Mudunuri <gmudunur@informatica.com> | |
1121 | 6 " Last Change: Di, 09 Mai 2006 23:10:23 CEST |
2034 | 7 " $Id: xdefaults.vim,v 1.2 2007/05/05 17:19:40 vimboss Exp $ |
7 | 8 " |
9 " REFERENCES: | |
10 " xrdb manual page | |
11 " xrdb source: ftp://ftp.x.org/pub/R6.4/xc/programs/xrdb/xrdb.c | |
12 | |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
3513
diff
changeset
|
13 " quit when a syntax file was already loaded |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
3513
diff
changeset
|
14 if exists("b:current_syntax") |
7 | 15 finish |
16 endif | |
17 | |
18 " turn case on | |
19 syn case match | |
20 | |
21 | |
22 if !exists("xdefaults_no_colon_errors") | |
23 " mark lines which do not contain a colon as errors. | |
24 " This does not really catch all errors but only lines | |
25 " which contain at least two WORDS and no colon. This | |
26 " was done this way so that a line is not marked as | |
27 " error while typing (which would be annoying). | |
28 syntax match xdefaultsErrorLine "^\s*[a-zA-Z.*]\+\s\+[^: ]\+" | |
29 endif | |
30 | |
31 | |
32 " syn region xdefaultsLabel start=+^[^:]\{-}:+he=e-1 skip=+\\+ end="$" | |
3513 | 33 syn match xdefaultsLabel +^[^:]\{-}:+he=e-1 contains=xdefaultsPunct,xdefaultsSpecial,xdefaultsLineEnd |
7 | 34 syn region xdefaultsValue keepend start=+:+lc=1 skip=+\\+ end=+$+ contains=xdefaultsSpecial,xdefaultsLabel,xdefaultsLineEnd |
35 | |
36 syn match xdefaultsSpecial contained +#override+ | |
37 syn match xdefaultsSpecial contained +#augment+ | |
38 syn match xdefaultsPunct contained +[.*:]+ | |
39 syn match xdefaultsLineEnd contained +\\$+ | |
40 syn match xdefaultsLineEnd contained +\\n\\$+ | |
41 syn match xdefaultsLineEnd contained +\\n$+ | |
42 | |
43 | |
44 | |
45 " COMMENTS | |
46 | |
47 " note, that the '!' must be at the very first position of the line | |
1121 | 48 syn match xdefaultsComment "^!.*$" contains=xdefaultsTodo,@Spell |
7 | 49 |
50 " lines starting with a '#' mark and which are not preprocessor | |
51 " lines are skipped. This is not part of the xrdb documentation. | |
52 " It was reported by Bram Moolenaar and could be confirmed by | |
53 " having a look at xrdb.c:GetEntries() | |
54 syn match xdefaultsCommentH "^#.*$" | |
55 "syn region xdefaultsComment start="^#" end="$" keepend contains=ALL | |
1121 | 56 syn region xdefaultsComment start="/\*" end="\*/" contains=xdefaultsTodo,@Spell |
7 | 57 |
58 syntax match xdefaultsCommentError "\*/" | |
59 | |
60 syn keyword xdefaultsTodo contained TODO FIXME XXX display | |
61 | |
62 | |
63 | |
64 " PREPROCESSOR STUFF | |
65 | |
66 syn region xdefaultsPreProc start="^\s*#\s*\(if\|ifdef\|ifndef\|elif\|else\|endif\)\>" skip="\\$" end="$" contains=xdefaultsSymbol | |
67 if !exists("xdefaults_no_if0") | |
68 syn region xdefaultsCppOut start="^\s*#\s*if\s\+0\>" end=".\|$" contains=xdefaultsCppOut2 | |
69 syn region xdefaultsCppOut2 contained start="0" end="^\s*#\s*\(endif\>\|else\>\|elif\>\)" contains=xdefaultsCppSkip | |
70 syn region xdefaultsCppSkip contained start="^\s*#\s*\(if\>\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*#\s*endif\>" contains=xdefaultsCppSkip | |
71 endif | |
72 syn region xdefaultsIncluded contained start=+"+ skip=+\\\\\|\\"+ end=+"+ | |
73 syn match xdefaultsIncluded contained "<[^>]*>" | |
74 syn match xdefaultsInclude "^\s*#\s*include\>\s*["<]" contains=xdefaultsIncluded | |
3513 | 75 syn cluster xdefaultsPreProcGroup contains=xdefaultsPreProc,xdefaultsIncluded,xdefaultsInclude,xdefaultsDefine,xdefaultsCppOut,xdefaultsCppOut2,xdefaultsCppSkip |
76 syn region xdefaultsDefine start="^\s*#\s*\(define\|undef\)\>" skip="\\$" end="$" contains=ALLBUT,@xdefaultsPreProcGroup,xdefaultsCommentH,xdefaultsErrorLine,xdefaultsLabel,xdefaultsValue | |
77 syn region xdefaultsPreProc start="^\s*#\s*\(pragma\>\|line\>\|warning\>\|warn\>\|error\>\)" skip="\\$" end="$" keepend contains=ALLBUT,@xdefaultsPreProcGroup,xdefaultsCommentH,xdefaultsErrorLine,xdefaultsLabel,xdefaultsValue | |
7 | 78 |
79 | |
80 | |
81 " symbols as defined by xrdb | |
82 syn keyword xdefaultsSymbol contained SERVERHOST | |
83 syn match xdefaultsSymbol contained "SRVR_[a-zA-Z0-9_]\+" | |
84 syn keyword xdefaultsSymbol contained HOST | |
85 syn keyword xdefaultsSymbol contained DISPLAY_NUM | |
86 syn keyword xdefaultsSymbol contained CLIENTHOST | |
87 syn match xdefaultsSymbol contained "CLNT_[a-zA-Z0-9_]\+" | |
88 syn keyword xdefaultsSymbol contained RELEASE | |
89 syn keyword xdefaultsSymbol contained REVISION | |
90 syn keyword xdefaultsSymbol contained VERSION | |
91 syn keyword xdefaultsSymbol contained VENDOR | |
92 syn match xdefaultsSymbol contained "VNDR_[a-zA-Z0-9_]\+" | |
93 syn match xdefaultsSymbol contained "EXT_[a-zA-Z0-9_]\+" | |
94 syn keyword xdefaultsSymbol contained NUM_SCREENS | |
95 syn keyword xdefaultsSymbol contained SCREEN_NUM | |
96 syn keyword xdefaultsSymbol contained BITS_PER_RGB | |
97 syn keyword xdefaultsSymbol contained CLASS | |
98 syn keyword xdefaultsSymbol contained StaticGray GrayScale StaticColor PseudoColor TrueColor DirectColor | |
99 syn match xdefaultsSymbol contained "CLASS_\(StaticGray\|GrayScale\|StaticColor\|PseudoColor\|TrueColor\|DirectColor\)" | |
100 syn keyword xdefaultsSymbol contained COLOR | |
101 syn match xdefaultsSymbol contained "CLASS_\(StaticGray\|GrayScale\|StaticColor\|PseudoColor\|TrueColor\|DirectColor\)_[0-9]\+" | |
102 syn keyword xdefaultsSymbol contained HEIGHT | |
103 syn keyword xdefaultsSymbol contained WIDTH | |
104 syn keyword xdefaultsSymbol contained PLANES | |
105 syn keyword xdefaultsSymbol contained X_RESOLUTION | |
106 syn keyword xdefaultsSymbol contained Y_RESOLUTION | |
107 | |
108 " Define the default highlighting. | |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
3513
diff
changeset
|
109 " Only when an item doesn't have highlighting yet |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
110 hi def link xdefaultsLabel Type |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
111 hi def link xdefaultsValue Constant |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
112 hi def link xdefaultsComment Comment |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
113 hi def link xdefaultsCommentH xdefaultsComment |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
114 hi def link xdefaultsPreProc PreProc |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
115 hi def link xdefaultsInclude xdefaultsPreProc |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
116 hi def link xdefaultsCppSkip xdefaultsCppOut |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
117 hi def link xdefaultsCppOut2 xdefaultsCppOut |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
118 hi def link xdefaultsCppOut Comment |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
119 hi def link xdefaultsIncluded String |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
120 hi def link xdefaultsDefine Macro |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
121 hi def link xdefaultsSymbol Statement |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
122 hi def link xdefaultsSpecial Statement |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
123 hi def link xdefaultsErrorLine Error |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
124 hi def link xdefaultsCommentError Error |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
125 hi def link xdefaultsPunct Normal |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
126 hi def link xdefaultsLineEnd Special |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
127 hi def link xdefaultsTodo Todo |
7 | 128 |
129 | |
130 let b:current_syntax = "xdefaults" | |
131 | |
132 " vim:ts=8 |