ael.vim 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. " Vim syntax file
  2. " Language: Asterisk Extension Language
  3. " Maintainer: tilghman
  4. " Last Change: 2009 Mar 04
  5. " version 0.1
  6. "
  7. if version < 600
  8. syntax clear
  9. elseif exists("b:current_syntax")
  10. finish
  11. endif
  12. syn sync clear
  13. syn sync fromstart
  14. syn keyword aelTodo TODO contained
  15. syn keyword aelKeyword context includes macro globals if else switch case default catch return switches includes for ignorepat
  16. syn match aelComment "//.*" contains=aelTodo
  17. syn match aelContext "\s+\zs[[:alpha:]][[:alnum:]\-_]*\ze\s*{"
  18. " Macro declaration
  19. syn match aelMacro "[[:alpha:]][[:alnum:]\-_]*(.\{-})\ze\s*{" contains=aelVar,aelFunction,aelExp,aelArgs
  20. " Macro reference
  21. syn match aelMacro "&[[:alpha:]][[:alnum:]\-_]*(.\{-});" contains=aelVar,aelFunction,aelExp,aelArgs
  22. " Ranges or other pattern characters
  23. syn match aelExten "\zs_\(\[[[:alnum:]#*\-]\+\]\|[[:alnum:]#*\-]\)\+[\.!]\?\ze\s+=>"
  24. syn match aelExten "\zs[[:alnum:]#*]\+\ze\s*=>"
  25. syn match aelApp "\s\+\zs[[:alpha:]][[:alpha:]_]\+\ze[; ]"
  26. syn match aelApp "\s\+\zs[[:alpha:]][[:alpha:]_]\+\ze(.\{-});"
  27. syn match aelLabel "[[:alpha:]][[:alnum:]]*\ze:"
  28. syn region aelVar matchgroup=aelVarStart start="\${" end="}" contains=aelVar,aelFunction,aelExp
  29. syn match aelVar "\zs[[:alpha:]][[:alnum:]_]*\ze=" contains=aelVar,aelFunction,aelExp
  30. " Retrieving the value of a function
  31. syn match aelFunction "\${_\{0,2}[[:alpha:]][[:alnum:]_]*(.\{-})}" contains=aelVar,aelFunction,aelExp
  32. " Setting a function
  33. syn match aelFunction "(\zs[[:alpha:]][[:alnum:]_]*(.\{-})\ze=" contains=aelVar,aelFunction,aelExp
  34. syn region aelExp matchgroup=aelExpStart start="\$\[" end="]" contains=aelVar,aelFunction,aelExp
  35. syn match aelArgs "([[:alnum:]_, ]*)" contains=aelArgsElement contained
  36. syn match aelArgsElement "[[:alpha:]][[:alnum:]_]*" contained
  37. " Define the default highlighting.
  38. " For version 5.7 and earlier: only when not done already
  39. " For version 5.8 and later: only when an item doesn't have highlighting yet
  40. if version >= 508 || !exists("did_conf_syntax_inits")
  41. if version < 508
  42. let did_conf_syntax_inits = 1
  43. command -nargs=+ HiLink hi link <args>
  44. else
  45. command -nargs=+ HiLink hi def link <args>
  46. endif
  47. HiLink aelComment Comment
  48. HiLink aelContext Preproc
  49. HiLink aelMacro Preproc
  50. HiLink aelExten Type
  51. HiLink aelLabel Type
  52. HiLink aelApp Preproc
  53. HiLink aelVar String
  54. HiLink aelVarStart String
  55. HiLink aelArgsElement String
  56. HiLink aelFunction Function
  57. HiLink aelExp Type
  58. HiLink aelExpStart Type
  59. HiLink aelKeyword Statement
  60. HiLink aelError Error
  61. delcommand HiLink
  62. endif
  63. let b:current_syntax = "ael"
  64. " vim: ts=8 sw=2