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>
6 " Last Change: Don, 03 Mai 2001 09:57:15 +0200
7 " URL: http://www.zellner.org/vim/syntax/xdefaults.vim
8 " $Id: xdefaults.vim,v 1.1.1.1 2001/06/07 21:35:13 corinna Exp $
12 " xrdb source: ftp://ftp.x.org/pub/R6.4/xc/programs/xrdb/xrdb.c
14 " For version 5.x: Clear all syntax items
15 " For version 6.x: Quit when a syntax file was already loaded
18 elseif exists("b:current_syntax")
26 if !exists("xdefaults_no_colon_errors")
27 " mark lines which do not contain a colon as errors.
28 " This does not really catch all errors but only lines
29 " which contain at least two WORDS and no colon. This
30 " was done this way so that a line is not marked as
31 " error while typing (which would be annoying).
32 syntax match xdefaultsErrorLine "^\s*[a-zA-Z.*]\+\s\+[^: ]\+"
36 " syn region xdefaultsLabel start=+^[^:]\{-}:+he=e-1 skip=+\\+ end="$"
37 syn match xdefaultsLabel +[^:]\{-}:+he=e-1 contains=xdefaultsPunct,xdefaultsSpecial,xdefaultsLineEnd
38 syn region xdefaultsValue keepend start=+:+lc=1 skip=+\\+ end=+$+ contains=xdefaultsSpecial,xdefaultsLabel,xdefaultsLineEnd
40 syn match xdefaultsSpecial contained +#override+
41 syn match xdefaultsSpecial contained +#augment+
42 syn match xdefaultsPunct contained +[.*:]+
43 syn match xdefaultsLineEnd contained +\\$+
44 syn match xdefaultsLineEnd contained +\\n\\$+
45 syn match xdefaultsLineEnd contained +\\n$+
51 " note, that the '!' must be at the very first position of the line
52 syn match xdefaultsComment "^!.*$" contains=xdefaultsTodo
54 " lines starting with a '#' mark and which are not preprocessor
55 " lines are skipped. This is not part of the xrdb documentation.
56 " It was reported by Bram Moolenaar and could be confirmed by
57 " having a look at xrdb.c:GetEntries()
58 syn match xdefaultsCommentH "^#.*$"
59 "syn region xdefaultsComment start="^#" end="$" keepend contains=ALL
60 syn region xdefaultsComment start="/\*" end="\*/" contains=xdefaultsTodo
62 syntax match xdefaultsCommentError "\*/"
64 syn keyword xdefaultsTodo contained TODO FIXME XXX display
70 syn region xdefaultsPreProc start="^\s*#\s*\(if\|ifdef\|ifndef\|elif\|else\|endif\)\>" skip="\\$" end="$" contains=xdefaultsSymbol
71 if !exists("xdefaults_no_if0")
72 syn region xdefaultsCppOut start="^\s*#\s*if\s\+0\>" end=".\|$" contains=xdefaultsCppOut2
73 syn region xdefaultsCppOut2 contained start="0" end="^\s*#\s*\(endif\>\|else\>\|elif\>\)" contains=xdefaultsCppSkip
74 syn region xdefaultsCppSkip contained start="^\s*#\s*\(if\>\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*#\s*endif\>" contains=xdefaultsCppSkip
76 syn region xdefaultsIncluded contained start=+"+ skip=+\\\\\|\\"+ end=+"+
77 syn match xdefaultsIncluded contained "<[^>]*>"
78 syn match xdefaultsInclude "^\s*#\s*include\>\s*["<]" contains=xdefaultsIncluded
79 syn cluster xdefaultsPreProcGroup contains=xdefaultsPreProc,xdefaultsIncluded,xdefaultsInclude,xdefaultsDefine
80 syn region xdefaultsDefine start="^\s*#\s*\(define\|undef\)\>" skip="\\$" end="$" contains=ALLBUT,@xdefaultsPreProcGroup,xdefaultsCommentH,xdefaultsErrorLine
81 syn region xdefaultsPreProc start="^\s*#\s*\(pragma\>\|line\>\|warning\>\|warn\>\|error\>\)" skip="\\$" end="$" keepend contains=ALLBUT,@xdefaultsPreProcGroup,xdefaultsCommentH,xdefaultsErrorLine
85 " symbols as defined by xrdb
86 syn keyword xdefaultsSymbol contained SERVERHOST
87 syn match xdefaultsSymbol contained "SRVR_[a-zA-Z0-9_]\+"
88 syn keyword xdefaultsSymbol contained HOST
89 syn keyword xdefaultsSymbol contained DISPLAY_NUM
90 syn keyword xdefaultsSymbol contained CLIENTHOST
91 syn match xdefaultsSymbol contained "CLNT_[a-zA-Z0-9_]\+"
92 syn keyword xdefaultsSymbol contained RELEASE
93 syn keyword xdefaultsSymbol contained REVISION
94 syn keyword xdefaultsSymbol contained VERSION
95 syn keyword xdefaultsSymbol contained VENDOR
96 syn match xdefaultsSymbol contained "VNDR_[a-zA-Z0-9_]\+"
97 syn match xdefaultsSymbol contained "EXT_[a-zA-Z0-9_]\+"
98 syn keyword xdefaultsSymbol contained NUM_SCREENS
99 syn keyword xdefaultsSymbol contained SCREEN_NUM
100 syn keyword xdefaultsSymbol contained BITS_PER_RGB
101 syn keyword xdefaultsSymbol contained CLASS
102 syn keyword xdefaultsSymbol contained StaticGray GrayScale StaticColor PseudoColor TrueColor DirectColor
103 syn match xdefaultsSymbol contained "CLASS_\(StaticGray\|GrayScale\|StaticColor\|PseudoColor\|TrueColor\|DirectColor\)"
104 syn keyword xdefaultsSymbol contained COLOR
105 syn match xdefaultsSymbol contained "CLASS_\(StaticGray\|GrayScale\|StaticColor\|PseudoColor\|TrueColor\|DirectColor\)_[0-9]\+"
106 syn keyword xdefaultsSymbol contained HEIGHT
107 syn keyword xdefaultsSymbol contained WIDTH
108 syn keyword xdefaultsSymbol contained PLANES
109 syn keyword xdefaultsSymbol contained X_RESOLUTION
110 syn keyword xdefaultsSymbol contained Y_RESOLUTION
112 " Define the default highlighting.
113 " For version 5.7 and earlier: only when not done already
114 " For version 5.8 and later: only when an item doesn't have highlighting yet
115 if version >= 508 || !exists("did_xdefaults_syntax_inits")
117 let did_xdefaults_syntax_inits = 1
118 command -nargs=+ HiLink hi link <args>
120 command -nargs=+ HiLink hi def link <args>
122 HiLink xdefaultsLabel Type
123 HiLink xdefaultsValue Constant
124 HiLink xdefaultsComment Comment
125 HiLink xdefaultsCommentH xdefaultsComment
126 HiLink xdefaultsPreProc PreProc
127 HiLink xdefaultsInclude xdefaultsPreProc
128 HiLink xdefaultsCppSkip xdefaultsCppOut
129 HiLink xdefaultsCppOut2 xdefaultsCppOut
130 HiLink xdefaultsCppOut Comment
131 HiLink xdefaultsIncluded String
132 HiLink xdefaultsDefine Macro
133 HiLink xdefaultsSymbol Statement
134 HiLink xdefaultsSpecial Statement
135 HiLink xdefaultsErrorLine Error
136 HiLink xdefaultsCommentError Error
137 HiLink xdefaultsPunct Normal
138 HiLink xdefaultsLineEnd Special
143 let b:current_syntax = "xdefaults"