" Vim syntax file " Language: AEL (Asterisk Extension Language) " Maintainer: C. Chad Wallace " Last Change: 2010 January 27 " Version: 0.3 " Quit when a (custom) syntax file was already loaded if exists("b:current_syntax") finish endif " Top-level blocks " globals block syn match aelGlobalsKeyword "\" nextgroup=aelGlobalsBlock skipwhite syn region aelGlobalsBlock start="{" end="};\=" contained contains=aelGlobalVar,aelComment syn match aelGlobalVar "\<\h*\ze=" contained nextgroup=aelGlobalVarExpression syn match aelGlobalVarExpression ".*;" contained contains=aelInterpol,aelExpr,aelString " macro blocks syn match aelMacroKeyword "\" nextgroup=aelMacroName skipwhite syn match aelMacroName "\<\h*" contained nextgroup=aelMacroParms skipwhite syn match aelMacroParms "(\(\s*\h\w*\(\s*,\s*\h\w*\)*\)\=\s*)" contained contains=aelMacroParm nextgroup=aelMacroBlock skipwhite syn match aelMacroParm "\<\h\w*\>" contained syn region aelMacroBlock start="{" end="};\=" contained contains=@aelStatement,aelCatch,aelLabel,aelComment " Things you'll find inside a macro syn match aelCatch "\" nextgroup=aelCatchName skipwhite syn match aelCatchName "\<\w\+\>" contained nextgroup=aelCatchBlock skipwhite syn region aelCatchBlock start="{" end="};\=" contained contains=@aelStatement,aelLabel,aelComment " context blocks syn match aelContextKeyword "\" nextgroup=aelContextName skipwhite syn match aelContextName "\<\h*\>" contained nextgroup=aelContextBlock skipwhite syn region aelContextBlock start="{" end="};\=" contained contains=aelIncludes,aelIgnorepat,aelExtension,aelComment " Things you'll find inside a context syn match aelIncludes "\" contained nextgroup=aelIncludesBlock skipwhite syn region aelIncludesBlock start="{" end="};\=" contained contains=aelIncludeContext,aelComment syn match aelIncludeContext "\<\h*\ze;" contained contains=aelComment syn match aelIgnorepat "\\s*\)\@=" contained nextgroup=aelIgnorepatNeck skipwhite syn match aelIgnorepatNeck "=>" contained nextgroup=aelIgnorepatPattern skipwhite syn match aelIgnorepatPattern "\<*[.!]\=" contained contains=aelComment syn match aelExtension "\(ignorepat\)\@!\(_*[.!]\=\|\+\)\(/\(_*[.!]\=\|\+\)\)\=\(\s*=>\s*\)\@=" contained nextgroup=aelExtensionNeck skipwhite syn match aelExtensionNeck "=>" contained nextgroup=aelExtensionBlock,aelExtensionSingle skipwhite syn region aelExtensionBlock start="{" end="};\=" contained contains=@aelStatement,aelLabel,aelComment syn match aelExtensionSingle ".*;" contained contains=@aelStatement skipwhite " Dialplan Statements (priorities) syn cluster aelStatement contains=aelSet,aelApplication,aelIfWhile,aelFor,aelElse,aelSwitch,aelGoto,aelMacroCall syn match aelSet "\" contained nextgroup=aelIfWhileCond skipwhite syn match aelIfWhileCond "(.*)" contained contains=aelInterpol,aelExpr,aelString,aelOperator nextgroup=aelIfWhileBlock,aelIfElseBlock skipwhite syn region aelIfWhileBlock start="{" end="};\=" contained contains=@aelStatement,aelLabel,aelComment syn region aelIfElseBlock start="{" end="}" contained contains=@aelStatement,aelLabel,aelComment nextgroup=aelElse skipwhite skipnl syn match aelElse "\" contained nextgroup=aelElseBlock skipwhite syn region aelElseBlock start="{" end="};\=" contained contains=@aelStatement,aelLabel,aelComment syn match aelFor "\" contained nextgroup=aelForInit skipwhite syn match aelForInit "(.\{-};" contained contains=aelInterpol,aelExpr,aelString,aelOperator nextgroup=aelForCond skipwhite syn match aelForCond ".\{-};" contained contains=aelInterpol,aelExpr,aelString,aelOperator nextgroup=aelForAction skipwhite syn match aelForAction ".*)" contained contains=aelInterpol,aelExpr,aelString,aelOperator nextgroup=aelForBlock skipwhite syn region aelForBlock start="{" end="};\=" contained contains=@aelStatement,aelLabel,aelComment syn match aelSwitch "\" contained nextgroup=aelSwitchCond skipwhite syn match aelSwitchCond "(.*)" contained contains=aelInterpol,aelExpr,aelString nextgroup=aelSwitchBlock skipwhite syn region aelSwitchBlock start="{" end="};\=" contained contains=@aelStatement,aelSwitchBreak,aelSwitchCase,aelSwitchDefault,aelComment syn match aelSwitchCase "\" contained nextgroup=aelSwitchCaseVal skipwhite syn match aelSwitchCaseVal "\s*\zs.*\ze:" contained contains=aelInterpol,aelExpr syn match aelSwitchDefault "\" contained nextgroup=aelGotoTarget skipwhite syn match aelGotoTarget "\(\(\+|\)\=\+|\)\=\+" contained contains=aelInterpol,aelGotoPipe syn match aelGotoPipe "|" contained syn match aelMacroCall "&\h*\>" contained nextgroup=aelMacroCallParms skipwhite syn match aelMacroCallParms "(.*)" contained contains=aelInterpol,aelString,aelExpr skipwhite " Generic syn match aelLabel "\<\h*\ze:" contained syn match aelComment "//.*$" syn region aelMlComment start=/\/\*/ end=/\*\// syn region aelString start=/"/ skip=/\\"/ end=/"/ contained contains=aelInterpol,aelExpr syn region aelInterpol start="${" end="}" contained contains=aelInterpol,aelExpr syn region aelExpr matchgroup=aelOperator start="$\[" end="\]" contained contains=aelInterpol,aelString,aelOperator syn match aelOperator "=\~\|" contained " Synchronization syn sync minlines=150 syn sync match aelMacroSync grouphere aelMacroBlock "\\s*\<\h*\>\s*(\(\s*\h\w*\(\s*,\s*\h\w*\)*\)\=\s*)\s*{" syn sync match aelContextSync grouphere aelContextBlock "\\s*\<\h*\>\s*{" syn sync match aelGlobalsSync grouphere aelGlobalsBlock "\\s*{" " Highlighting " Keywords hi def link aelGoto aelStatement hi def link aelStatement Statement hi def link aelIfWhile aelConditional hi def link aelElse aelConditional hi def link aelFor aelConditional hi def link aelSwitch aelConditional hi def link aelConditional Conditional hi def link aelSwitchCase aelLabel hi def link aelSwitchDefault aelLabel hi def link aelCase aelLabel hi def link aelLabel Label hi def link aelCatch aelException hi def link aelException Exception hi def link aelIncludes aelKeyword hi def link aelIgnorepat aelKeyword hi def link aelGlobalsKeyword aelKeyword hi def link aelMacroKeyword aelKeyword hi def link aelContextKeyword aelKeyword hi def link aelSwitchBreak aelKeyword hi def link aelKeyword Keyword hi def link aelIgnorepatNeck Operator hi def link aelExtensionNeck Operator hi def link aelGotoPipe Operator hi def link aelOperator Operator " Literals hi def link aelSwitchCaseVal String hi def link aelIgnorepatPattern String hi def link aelExtension String hi def link aelString String " Identifiers hi def link aelGotoTarget aelIdentifier hi def link aelIncludeContext aelIdentifier hi def link aelGlobalVar aelIdentifier hi def link aelContextName aelIdentifier hi def link aelMacroParm aelIdentifier hi def link aelSetVariable aelIdentifier hi def link aelInterpol aelIdentifier hi def link aelIdentifier Identifier hi def link aelMacroCall aelFunction hi def link aelMacroName aelFunction hi def link aelApplication aelFunction hi def link aelSet aelFunction hi def link aelFunction Function hi def link aelComment Comment hi def link aelMlComment Comment