" Vim syntax file " Language: Netcool Probe Rules File " Maintainer: Scott R. Keszler " Info: $Id$ " URL: http://srkconsulting.com/netcool_vim " Anon SVN: $HeadURL$ " Release Coordinator: Scott R. Keszler " ---------------------------------------------------------------------------- " " TODO registertarget statements, if present, must precede everything " " TODO table, lookup, and array statements must come before any processing " statements, and after any registertarget statments " " TODO syn check table. valid are: " table tablename={{"key","value},{"key","value"},...} " table tablename="absolute_or_relative/path/to/file" " " TODO table default statement: " default = {"defval1","defval2",...} " must immediately follow table statement if used. " detect difference between default as in table and default as in switch " Remove any old syntax stuff that was loaded (5.x) or quit when a syntax file " was already loaded (6.x). if version < 600 syntax clear elseif exists("b:current_syntax") finish endif setlocal iskeyword+=- syntax case ignore " strings (double-quotes only, not single) syn region rulesString matchgroup=rulesDQuote start=/"/ skip=/\\"/ end=/"/ hi def link rulesString String hi def link rulesDQuote SpecialChar " element variables syn match rulesElement /$\k\+/ syn match rulesElement /$([^()]\+)/ hi def link rulesElement Identifier " property variables syn match rulesProperty /%\w\+/ hi def link rulesProperty Identifier " objectserver fields syn match rulesOField /@\a\w\{0,39\}/ hi def link rulesOField Identifier for s:Item in ["add","after","all","alter","and","any","apr\\%[il]","arguments","array","as","asc","assign","aug\\%[ust]","authori[sz]e","average","avg","backup","before","begin","between","bidirectional","binary","bind","bool\\%[ean]","break","by","cache","call","cancel","case","char\\%[acter]","check","checkpointing","column","comment","commit","conn\\%[ection]","count","create","current","database","date\\%[time]","debug","dec\\%[ember]","declare","deferred","delayed","delete","desc","descent","describe","detached","disable","dist","distinct","do","double","drop","each","edge","else","elseif","empty","end","encrypted","evaluate","event","every","executable","exec\\%[ute]","extension","external","false","fanp","feb\\%[ruary]","file","filter","flush","for","format","fri\\%[day]","from","full","get","grant","group","hard","having","hidden","host","hours","id","iduc","if","immediate","in","including","incr","increment","initial","insert","int\\%[eger]","integer64","int64","into","isql","jan\\%[uary]","join","july\\=","june\\=","leave","like","limit","link","load","lock\\%[ph]","login","mar\\%[ch]","max","maxfiles","maxsize","may","memstore","message","metric","min","minutes","mon\\%[day]","naming","next","no","nodefault","nomodify","not","notify","nov\\%[ember]","oct\\%[ober]","of","on","once","only","option","or","order","out","pam","password","persistent","primary","priority","privilege","procedure","props\\=","protect","publish","query","raise","real","register","reinsert","remove","replace","restriction","resync","retry","revoke","role","row","rowof","sat\\%[urday]","save","seconds","select","self","send","sep\\%[tember]","session","set","short","show","signal","skip","soft","sql","statement","store","subscribe","sum","sun\\%[day]","svc","sync","system","table","temporal","temp\\%[orary]","then","thu\\%[rsday]","time","to","token","top","trans\\%[action]","transient","trigger","true","truncate","tue\\%[sday]","typeof","unidirectional","union","unique","unload","unregister","unsigned","unsigned64","unsubscribe","until","update","updating","use","user","utc","values","varchar\\%[acter]","verbose","via","view","virtual","wait","wed\\%[nesday]","when","where","with","work","write","yes","xst"] execute "syntax match rulesOFieldReserved /@" . s:Item . "\\>/ containedin=ALL" endfor hi def link rulesOFieldReserved Error " array variables syn match rulesArray /^\s*array\s\+\zs\w\+/ syn match rulesArray /\w\+\ze\[/ hi def link rulesArray Identifier syn keyword rulesConditional if else switch case default hi def link rulesConditional Conditional syn keyword rulesStatement charcount clear datetotime discard exists extract getdate getenv geteventcount getload getpid getplatform hostname include int length lookup lower ltrim match nmatch printable real recover registertarget regmatch remove rtrim service setdefaulttarget settarget split substr timetodate toBase update updateload upper hi def link rulesStatement Statement syn keyword rulesLookup lookup table hi def link rulesLookup Keyword syn keyword rulesOperator NOT AND OR XOR " * / - + & | ^ >> << == != <> < > <= >= ! && || hi def link rulesOperator Operator " underline 'details($*)' to make it stand out syn match rulesStatement /details/ syn match rulesAllDetails /details($\*)/ hi def link rulesAllDetails Underlined " log must be 'log(DEBUG|INFO|WARNING|ERROR|FATAL,"string"&|variable)' syn keyword rulesLog skipwhite log nextgroup=rulesLogParen,rulesLogParenError syn match rulesLogParenError contained /[^(]/ syn match rulesLogParen contained /(/ nextgroup=rulesLogLevel,rulesLogLevelError syn match rulesLogLevelError contained /.*/ syn match rulesLogLevel contained /\s*\c\%(DEBUG\|INFO\|WARNING\|ERROR\|FATAL\)\s*/ nextgroup=rulesComma,rulesCommaError syn match rulesCommaError contained /[^,]/ syn match rulesComma contained /,/ nextgroup=rulesLogMsg,rulesLogMsgError hi def link rulesLog Statement hi def link rulesLogParenError Error hi def link rulesLogLevelError Error hi def link rulesCommaError Error hi def link rulesLogLevel PreProc " setlog must be 'setlog(DEBUG|INFO|WARNING|ERROR|FATAL)' syn keyword rulesSetLog skipwhite setlog nextgroup=rulesSetlogParen,rulesSetlogParenError syn match rulesSetlogParenError contained /[^(]/ syn match rulesSetlogParen contained /(/ nextgroup=rulesSetlogLevel,rulesSetlogLevelError syn match rulesSetlogLevelError contained /.*/ syn match rulesSetlogLevel contained /\s*\c\%(DEBUG\|INFO\|WARNING\|ERROR\|FATAL\)\s*/ hi def link rulesSetLog Statement hi def link rulesSetlogParenError Error hi def link rulesSetlogLevelError Error hi def link rulesSetlogLevel PreProc " service syntax: 'service("string"&|variable,BAD|MARGINAL|GOOD|"")' syn keyword rulesService skipwhite service nextgroup=rulesSrvcParen,rulesSrvcParenError syn match rulesSrvcParenError contained /[^(]/ syn match rulesSrvcParen contained /(/ nextgroup=rulesSrvcIDStr,rulesSrvcIDVar,rulesSrvcIDError syn match rulesSrvcIDError contained /.*/ syn match rulesSrvcIDStr contained /\s*"[^"]*"\s*/ nextgroup=rulesSrvcComma,rulesSrvcCommaError syn match rulesSrvcIDVar contained /\s*\%($\w\+\|@\a\w\{0,39}\|%\w\+\|\w\+\[[^\[\]]*\]\)\s*/ nextgroup=rulesSrvcComma,rulesSrvcCommaError syn match rulesSrvcCommaError contained /[^,]/ syn match rulesSrvcComma contained /,/ nextgroup=rulesSrvcStat,rulesSrvcStatError syn match rulesSrvcStatError contained /.*/ syn match rulesSrvcStat contained /\s*\c\%(BAD\|MARGINAL\|GOOD\s*\)\s*/ hi def link rulesService Statement hi def link rulesSrvcParenError Error hi def link rulesSrvcIDError Error hi def link rulesSrvcIDStr String hi def link rulesSrvcIDVar Identifier hi def link rulesSrvcCommaError Error hi def link rulesSrvcStatError Error hi def link rulesSrvcStat PreProc " specially highlight escaped chars in the required string of expand: " \" \nnn \\ \a \b \e \f \n \r \t \v syn keyword rulesExpand skipwhite expand nextgroup=rulesExpnOParen,rulesExpnOParenError syn match rulesExpnOParenError contained /[^(]/ syn match rulesExpnOParen contained /(\s*/ nextgroup=rulesExpnString,rulesExpnStringError syn match rulesExpnStringError contained /[^"]/ syn match rulesExpnStr contained /./ syn match rulesExpnStrSpec contained /\\\%("\|\d\d\d\|\\\|[abefnrtv]\)/ syn region rulesExpnString contained matchgroup=rulesDQuote start=/"/ end=/"/ contains=rulesExpnStr,rulesExpnStrSpec nextgroup=rulesExpnCParen,rulesExpnCParenError syn match rulesExpnCParenError contained /[^)]/ syn match rulesExpnCParen contained /\s*)/ hi def link rulesExpand Statement hi def link rulesExpnOParenError Error hi def link rulesExpnStringError Error hi def link rulesExpnStr String hi def link rulesExpnStrSpec SpecialChar hi def link rulesExpnCParenError Error " specially highlight format chars in scanformat: " %% %d %u %o %x %i %e %f %g %s " scanformat(expression, "string") where expression is any variable type, and " string contains one or more format chars (else what's the point of using " scanformat?) syn keyword rulesScan skipwhite scanformat nextgroup=rulesScanOParen,rulesScanOParenError syn match rulesScanOParenError contained /[^(]/ syn match rulesScanOParen contained /(\s*/ nextgroup=rulesScanElem,rulesScanElemError syn match rulesScanElemError contained /.*/ syn match rulesScanElem contained /\s*\%($\w\+\|@\a\w\{0,39}\|%\w\+\|\w\+\[[^\[\]]*\]\)\s*/ nextgroup=rulesScanComma,rulesScanCommaError syn match rulesScanCommaError contained /[^,]/ syn match rulesScanComma contained /\s*,\s*/ nextgroup=rulesScanString,rulesScanStringError syn match rulesScanStringError contained /.*/ syn match rulesScanStr contained /./ syn match rulesScanStrSpec contained /%[%duoxiefgs]/ syn region rulesScanString contained matchgroup=rulesDQuote start=/"/ end=/"/ contains=rulesScanStr,rulesScanStrSpec nextgroup=rulesScanCParen,rulesScanCParenError syn match rulesScanCParenError contained /[^)]/ syn match rulesScanCParen contained /\s*)/ hi def link rulesScan Statement hi def link rulesScanOParenError Error hi def link rulesScanElemError Error hi def link rulesScanElem Identifier hi def link rulesScanCommaError Error hi def link rulesScanStringError Error hi def link rulesScanStr String hi def link rulesScanStrSpec SpecialChar hi def link rulesScanCParenError Error " nice to highlight these in comments syn keyword rulesTodo TODO TBD FIX FIXME CHECK CHECKTHIS TEST TEMP XXX contained " Comments syn match rulesComment /#.*$/ contains=rulesTodo hi def link rulesTodo Todo hi def link rulesComment Comment let b:current_syntax = "rules" " vim:ts=8 sw=3 et