aap.vim 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. " Vim syntax file
  2. " Language: A-A-P recipe
  3. " Maintainer: Bram Moolenaar <Bram@vim.org>
  4. " Last Change: 2004 Jun 13
  5. " Quit when a syntax file was already loaded
  6. if exists("b:current_syntax")
  7. finish
  8. endif
  9. let s:cpo_save = &cpo
  10. set cpo&vim
  11. syn include @aapPythonScript syntax/python.vim
  12. syn match aapVariable /$[-+?*="'\\!]*[a-zA-Z0-9_.]*/
  13. syn match aapVariable /$[-+?*="'\\!]*([a-zA-Z0-9_.]*)/
  14. syn keyword aapTodo contained TODO Todo
  15. syn match aapString +'[^']\{-}'+
  16. syn match aapString +"[^"]\{-}"+
  17. syn match aapCommand '^\s*:action\>'
  18. syn match aapCommand '^\s*:add\>'
  19. syn match aapCommand '^\s*:addall\>'
  20. syn match aapCommand '^\s*:asroot\>'
  21. syn match aapCommand '^\s*:assertpkg\>'
  22. syn match aapCommand '^\s*:attr\>'
  23. syn match aapCommand '^\s*:attribute\>'
  24. syn match aapCommand '^\s*:autodepend\>'
  25. syn match aapCommand '^\s*:buildcheck\>'
  26. syn match aapCommand '^\s*:cd\>'
  27. syn match aapCommand '^\s*:chdir\>'
  28. syn match aapCommand '^\s*:checkin\>'
  29. syn match aapCommand '^\s*:checkout\>'
  30. syn match aapCommand '^\s*:child\>'
  31. syn match aapCommand '^\s*:chmod\>'
  32. syn match aapCommand '^\s*:commit\>'
  33. syn match aapCommand '^\s*:commitall\>'
  34. syn match aapCommand '^\s*:conf\>'
  35. syn match aapCommand '^\s*:copy\>'
  36. syn match aapCommand '^\s*:del\>'
  37. syn match aapCommand '^\s*:deldir\>'
  38. syn match aapCommand '^\s*:delete\>'
  39. syn match aapCommand '^\s*:delrule\>'
  40. syn match aapCommand '^\s*:dll\>'
  41. syn match aapCommand '^\s*:do\>'
  42. syn match aapCommand '^\s*:error\>'
  43. syn match aapCommand '^\s*:execute\>'
  44. syn match aapCommand '^\s*:exit\>'
  45. syn match aapCommand '^\s*:export\>'
  46. syn match aapCommand '^\s*:fetch\>'
  47. syn match aapCommand '^\s*:fetchall\>'
  48. syn match aapCommand '^\s*:filetype\>'
  49. syn match aapCommand '^\s*:finish\>'
  50. syn match aapCommand '^\s*:global\>'
  51. syn match aapCommand '^\s*:import\>'
  52. syn match aapCommand '^\s*:include\>'
  53. syn match aapCommand '^\s*:installpkg\>'
  54. syn match aapCommand '^\s*:lib\>'
  55. syn match aapCommand '^\s*:local\>'
  56. syn match aapCommand '^\s*:log\>'
  57. syn match aapCommand '^\s*:ltlib\>'
  58. syn match aapCommand '^\s*:mkdir\>'
  59. syn match aapCommand '^\s*:mkdownload\>'
  60. syn match aapCommand '^\s*:move\>'
  61. syn match aapCommand '^\s*:pass\>'
  62. syn match aapCommand '^\s*:popdir\>'
  63. syn match aapCommand '^\s*:produce\>'
  64. syn match aapCommand '^\s*:program\>'
  65. syn match aapCommand '^\s*:progsearch\>'
  66. syn match aapCommand '^\s*:publish\>'
  67. syn match aapCommand '^\s*:publishall\>'
  68. syn match aapCommand '^\s*:pushdir\>'
  69. syn match aapCommand '^\s*:quit\>'
  70. syn match aapCommand '^\s*:recipe\>'
  71. syn match aapCommand '^\s*:refresh\>'
  72. syn match aapCommand '^\s*:remove\>'
  73. syn match aapCommand '^\s*:removeall\>'
  74. syn match aapCommand '^\s*:require\>'
  75. syn match aapCommand '^\s*:revise\>'
  76. syn match aapCommand '^\s*:reviseall\>'
  77. syn match aapCommand '^\s*:route\>'
  78. syn match aapCommand '^\s*:rule\>'
  79. syn match aapCommand '^\s*:start\>'
  80. syn match aapCommand '^\s*:symlink\>'
  81. syn match aapCommand '^\s*:sys\>'
  82. syn match aapCommand '^\s*:sysdepend\>'
  83. syn match aapCommand '^\s*:syspath\>'
  84. syn match aapCommand '^\s*:system\>'
  85. syn match aapCommand '^\s*:tag\>'
  86. syn match aapCommand '^\s*:tagall\>'
  87. syn match aapCommand '^\s*:toolsearch\>'
  88. syn match aapCommand '^\s*:totype\>'
  89. syn match aapCommand '^\s*:touch\>'
  90. syn match aapCommand '^\s*:tree\>'
  91. syn match aapCommand '^\s*:unlock\>'
  92. syn match aapCommand '^\s*:update\>'
  93. syn match aapCommand '^\s*:usetool\>'
  94. syn match aapCommand '^\s*:variant\>'
  95. syn match aapCommand '^\s*:verscont\>'
  96. syn match aapCommand '^\s*:print\>' nextgroup=aapPipeEnd
  97. syn match aapPipeCmd '\s*:print\>' nextgroup=aapPipeEnd contained
  98. syn match aapCommand '^\s*:cat\>' nextgroup=aapPipeEnd
  99. syn match aapPipeCmd '\s*:cat\>' nextgroup=aapPipeEnd contained
  100. syn match aapCommand '^\s*:syseval\>' nextgroup=aapPipeEnd
  101. syn match aapPipeCmd '\s*:syseval\>' nextgroup=aapPipeEnd contained
  102. syn match aapPipeCmd '\s*:assign\>' contained
  103. syn match aapCommand '^\s*:eval\>' nextgroup=aapPipeEnd
  104. syn match aapPipeCmd '\s*:eval\>' nextgroup=aapPipeEndPy contained
  105. syn match aapPipeCmd '\s*:tee\>' nextgroup=aapPipeEnd contained
  106. syn match aapPipeCmd '\s*:log\>' nextgroup=aapPipeEnd contained
  107. syn match aapPipeEnd '[^|]*|' nextgroup=aapPipeCmd contained skipnl
  108. syn match aapPipeEndPy '[^|]*|' nextgroup=aapPipeCmd contained skipnl contains=@aapPythonScript
  109. syn match aapPipeStart '^\s*|' nextgroup=aapPipeCmd
  110. "
  111. " A Python line starts with @. Can be continued with a trailing backslash.
  112. syn region aapPythonRegion start="\s*@" skip='\\$' end=+$+ contains=@aapPythonScript keepend
  113. "
  114. " A Python block starts with ":python" and continues so long as the indent is
  115. " bigger.
  116. syn region aapPythonRegion matchgroup=aapCommand start="\z(\s*\):python" skip='\n\z1\s\|\n\s*\n' end=+$+ contains=@aapPythonScript
  117. " A Python expression is enclosed in backticks.
  118. syn region aapPythonRegion start="`" skip="``" end="`" contains=@aapPythonScript
  119. " TODO: There is something wrong with line continuation.
  120. syn match aapComment '#.*' contains=aapTodo
  121. syn match aapComment '#.*\(\\\n.*\)' contains=aapTodo
  122. syn match aapSpecial '$#'
  123. syn match aapSpecial '$\$'
  124. syn match aapSpecial '$(.)'
  125. " A heredoc assignment.
  126. syn region aapHeredoc start="^\s*\k\+\s*$\=+\=?\=<<\s*\z(\S*\)"hs=e+1 end="^\s*\z1\s*$"he=s-1
  127. " Syncing is needed for ":python" and "VAR << EOF". Don't use Python syncing
  128. syn sync clear
  129. syn sync fromstart
  130. " The default highlighting.
  131. hi def link aapTodo Todo
  132. hi def link aapString String
  133. hi def link aapComment Comment
  134. hi def link aapSpecial Special
  135. hi def link aapVariable Identifier
  136. hi def link aapPipeCmd aapCommand
  137. hi def link aapCommand Statement
  138. hi def link aapHeredoc Constant
  139. let b:current_syntax = "aap"
  140. let &cpo = s:cpo_save
  141. unlet s:cpo_save
  142. " vim: ts=8