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