2 " Filename: cfengine.vim
3 " Language: cfengine configuration file
4 " Maintainer: Lance Albertson <ramereth@gentoo.org>
5 " Orginal Author: Marcus Spading <ms@fragmentum.net>
6 " URL: http://dev.gentoo.org/~ramereth/vim/syntax/cfengine.vim
7 " * The original url appears to be dead
8 " Last Change: 2005 Jan 4
10 " * Previous author's last version was 0.2
17 " For version 5.x: Clear all syntax items
18 " For version 6.x: Quit when a syntax file was already loaded
21 elseif exists("b:current_syntax")
27 syn match cfengineCompoundClass "^\s*.*::\s*$"
28 "syn match cfengineAssignmentOperator "="
29 syn match cfengineLinkOperator "[-+]>[!]\{0,1}"
30 syn match cfengineVariable "$(.\{-})"
31 syn match cfengineVariable "${.\{-}}"
32 syn region cfengineVariableDef matchgroup=cfengineVariable start="(\s*" end="\s*)" contains=cfengineKeyword,cfengineHelpers,cfengineActions,cfengineIPAddress,cfengineVariable
33 syn match cfengineNumber "\<\d\+\|inf\>"
34 syn match cfengineIPAddress "\<\d\{1,3}.\d\{1,3}.\d\{1,3}.\d\{1,3}\>"
35 syn region cfengineBlock start="{" end="}" contains=cfengineBlock,cfengineEditAction,cfengineString,cfengineVariable
36 syn region cfengineString start=+"+ skip=+\\\\\|\\"+ end=+"+ oneline contains=cfengineVariable containedin=cfengineBlock
37 syn region cfengineString start=+'+ skip=+\\\\\|\\'+ end=+'+ oneline contains=cfengineVariable containedin=cfengineBlock
39 syn keyword cfengineBoolean on off true false
41 syn keyword cfengineKeyword access actionsequence addclasses addinstallable binarypaddingchar
42 syn keyword cfengineKeyword checksumdatabase checksumupdates childlibpath copylinks defaultcopytype
43 syn keyword cfengineKeyword deletenonuserfiles deletenonownerfiles deletenonusermail deletenonownermail
44 syn keyword cfengineKeyword domain dryrun editbinaryfilesize editfilesize emptyresolvconf exclamation
45 syn keyword cfengineKeyword excludecopy excludelinks expireafter homepattern ifelapsed inform interfacename
46 syn keyword cfengineKeyword fileextensions linkcopies logdirectory logtidyhomefiles moduledirectory
47 syn keyword cfengineKeyword mountpattern netmask nonalphanumfiles nfstype repchar repository schedule
48 syn keyword cfengineKeyword secureinputs sensiblecount sensiblesize showactions site faculty splaytime split
49 syn keyword cfengineKeyword smtpserver spooldirectories suspiciousnames sysadm syslog timezone timeout
50 syn keyword cfengineKeyword verbose warnings warnnonuserfiles warnnonownerfiles warnnonusermail warnnonownermail
53 syn keyword cfengineKeyword AllowConnectionsFrom AllowMultipleConnectionsFrom AllowUsers AutoExecCommand
54 syn keyword cfengineKeyword AutoExecInterval cfrunCommand DenyBadClocks DenyConnectionsFrom IfElapsed
55 syn keyword cfengineKeyword LogAllConnections MaxConnections TrustKeysFrom DynamicAddresses
58 syn keyword cfengineActions addmounts checktimezone control copy directories disable editfiles groups files links mailcheck module import admit
59 syn keyword cfengineActions mountall mountinfo netconfig required resolve shellcommands tidy unmount processes
61 syn region cfengineHelpers matchgroup=cfengineKeyword start="FileExists(" end=")" contained oneline
62 syn region cfengineHelpers matchgroup=cfengineKeyword start="IsDir(" end=")" contained oneline
63 syn region cfengineHelpers matchgroup=cfengineKeyword start="IsNewerThan(" end=")" contained oneline
64 syn region cfengineHelpers matchgroup=cfengineKeyword start="AccessedBefore(" end=")" contained oneline
65 syn region cfengineHelpers matchgroup=cfengineKeyword start="ChangedBefore(" end=")" contained oneline
66 syn region cfengineHelpers matchgroup=cfengineKeyword start="IPRange(" end=")" contained oneline
67 syn region cfengineHelpers matchgroup=cfengineKeyword start="IsLink(" end=")" contained oneline
68 syn region cfengineHelpers matchgroup=cfengineKeyword start="IsPlain(" end=")" contained oneline
69 syn region cfengineHelpers matchgroup=cfengineKeyword start="ReturnsZero(" end=")" contained oneline
71 syn keyword cfengineOption age acl dest m[ode] o[wner] g[roup] act[ion] silent fix preserve keep backup repository stealth timestamps
72 syn keyword cfengineOption chroot chdir symlink incl[ude] excl[ude] ignore filter r[ecurse] type linktype typecheck define elsedefine
73 syn keyword cfengineOption force forcedirs forceipv4 size server trustkey encrypt verify oldserver purge syslog inform
74 syn keyword cfengineOption pat[tern] rotate flags links stop traverse tidy checksum matches dirlinks rmdirs deletedir deletefstab
76 syn keyword cfengineOptionVal warnall warndirs warnplain
77 syn keyword cfengineOptionVal fixall fixdirs fixplain
78 syn keyword cfengineOptionVal touch linkchildren create compress alert
79 syn keyword cfengineOptionVal stop traverse tidy md5 sha inf
80 syn keyword cfengineOptionVal hard relative absolute checksum ctime kill force
81 syn keyword cfengineOptionVal true false dump signal do warn bymatch
82 syn keyword cfengineOptionVal empty truncate all sub
83 syn keyword cfengineOptionVal ctime mtime atime
85 syn keyword cfengineSigVal hup int quit ill trap iot emt fpe kill bus segv sys pipe alrm term urg stop
86 syn keyword cfengineSigVal tstp cont chld gttin gttou io xcpu xfsz vtalrm prof winch lost usr1 usr2
88 syn keyword cfengineEditAction AbortAtLineMatching Append contained
89 syn keyword cfengineEditAction AppendIfNoSuchLine AppendIfNoLineMatching AppendToLineIfNotContains contained
90 syn keyword cfengineEditAction AutoCreate AutomountDirectResources Backup contained
91 syn keyword cfengineEditAction BeginGroupIfDefined BeginGroupIfNotDefined contained
92 syn keyword cfengineEditAction BeginGroupIfFileExists BeginGroupIfFileIsNewer contained
93 syn keyword cfengineEditAction BeginGroupIfNoLineContaining BeginGroupIfNoLineMatching BeginGroupIfNoMatch BeginGroupIfNoSuchLine contained
94 syn keyword cfengineEditAction BreakIfLineMatches CatchAbort contained
95 syn keyword cfengineEditAction CommentLinesMatching CommentLinesStarting CommentNLines CommentToLineMatching contained
96 syn keyword cfengineEditAction DefineClasses DeleteLinesAfterThisMatching DeleteLinesContaining DeleteLinesMatching contained
97 syn keyword cfengineEditAction DeleteLinesStarting DeleteNLines DeleteToLineMatching contained
98 syn keyword cfengineEditAction EditMode EmptyEntireFilePlease ElseDefineClasses EndGroup EndLoop contained
99 syn keyword cfengineEditAction Filter FixEndOfLines ForEachLineIn GotoLastLine contained
100 syn keyword cfengineEditAction HashCommentLinesContaining HashCommentLinesMatching HashCommentLinesStarting contained
101 syn keyword cfengineEditAction IncrementPointer Inform InsertFile InsertLine LocateLineMatching contained
102 syn keyword cfengineEditAction PercentCommentLinesContaining PercentCommentLinesMatching PercentCommentLinesStarting contained
103 syn keyword cfengineEditAction Prepend PrependIfNoLineMatching PrependifNoSuchLine contained
104 syn keyword cfengineEditAction Recurse ReplaceLineWith ReplaceAll ReplaceLinesMatchingField Repository contained
105 syn keyword cfengineEditAction ResetSearch RunScript RunScriptIfLineMatching RunScriptIfNoLineMatching contained
106 syn keyword cfengineEditAction SetCommentStart SetCommentEnd SetLine SetScript contained
107 syn keyword cfengineEditAction SlashCommentLinesContaining SlashCommentLinesMatching SlashCommentLinesStarting contained
108 syn keyword cfengineEditAction SplitOn Syslog Umask UnCommentLinesContaining UnCommentLinesMatching UnCommentNLines contained
109 syn keyword cfengineEditAction UnsetAbort UseShell WarnIfLineContaining WarnIfLineMatching WarnIfLineStarting contained
110 syn keyword cfengineEditAction WarnIfLineNoLineContaining WarnIfNoLineMatching WarnIfNoLineStarting WarnIfNoSuchLine contained
111 syn keyword cfengineEditAction ReplaceAll WarnIfContainsString WarnIfContainsFile contained
113 syn keyword cfengineFilter Owner Atime Ctime Mtime FromAtime FromCtime FromMtime ToAtime ToCtime ToMtime contained
114 syn keyword cfengineFilter Type reg link dir socket fifo door char block contained
115 syn keyword cfengineFilter ExecRegex NameRegex IsSymLinkTo ExecProgram Result contained
116 syn keyword cfengineFilter PID PPID PGID RSize VSize Status Command FromTTime ToTTime FromSTime ToSTime TTY contained
117 syn keyword cfengineFilter Priority Threads contained
119 syn keyword cfengineActionType control: files: acl: binservers: broadcast: control: copy: defaultroute:
120 syn keyword cfengineActionType disks: directories: disable: editfiles: files: filters: groups: classes:
121 syn keyword cfengineActionType homeservers: ignore: import: interfaces: links: mailserver: miscmounts:
122 syn keyword cfengineActionType mountables: processes: required: resolve: shellcommands: tidy: unmount:
124 " comments last overriding everything else
125 syn match cfengineComment "\s*#.*$" contains=cfengineTodo
126 syn keyword cfengineTodo TODO NOTE FIXME XXX contained
128 " Define the default highlighting.
129 " For version 5.7 and earlier: only when not done already
130 " For version 5.8 and later: only when an item doesn't have highlighting yet
131 if version >= 508 || !exists("did_cfengine_syn_inits")
133 let did_cfengine_syn_inits = 1
134 command -nargs=+ HiLink hi link <args>
136 command -nargs=+ HiLink hi def link <args>
139 "HiLink cfengineAssignmentOperator String
140 HiLink cfengineLinkOperator String
141 HiLink cfengineVariable Special
142 HiLink cfengineVariableDef NONE
143 HiLink cfengineBoolean Boolean
144 HiLink cfengineEditAction Identifier
145 HiLink cfengineFilter Identifier
146 HiLink cfengineKeyword Statement
147 HiLink cfengineOption Statement
148 HiLink cfengineCompoundClass Type
149 HiLink cfengineActionType PreProc
150 HiLink cfengineActions PreProc
151 HiLink cfengineComment Comment
152 HiLink cfengineNumber Number
153 HiLink cfengineIPAddress Number
154 HiLink cfengineQuota Number
155 HiLink cfengineString String
156 HiLink cfengineTodo Todo
157 HiLink cfengineOptionVal Constant
158 HiLink cfengineSigVal Constant
163 let b:current_syntax = "cfengine"