updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / gedit-pkgbuild-highlight / pkgbuild.lang
blob5faf2cfccf7305e5d34f1eaaa09d27bf40a4d7bd
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
4 A copy of SH Language-Specs
6 -->
7 <language id="pkgbuild" _name="PKGBUILD" version="2.0" _section="Scripts">
8 <metadata>
9 <property name="mimetypes">text/x-pkgbuild;</property>
10 <property name="globs">PKGBUILD</property>
11 <property name="line-comment-start">#</property>
12 </metadata>
14 <styles>
15 <style id="comment" _name="Comment" map-to="def:comment"/>
16 <style id="shebang" _name="Shebang" map-to="def:shebang"/>
17 <style id="function" _name="Function" map-to="def:function"/>
18 <style id="string" _name="String" map-to="def:string"/>
19 <style id="keyword" _name="Keyword" map-to="def:keyword"/>
20 <style id="variable" _name="Variable" map-to="def:type"/> <!-- FIXME: need to sort out proper styles for variables -->
21 <style id="variable-definition" _name="Variable Definition" map-to="sh:variable"/>
22 <style id="others" _name="Others" map-to="def:keyword"/>
23 <style id="common-command" _name="Common Commands" map-to="def:keyword"/>
24 <style id="here-doc-bound" _name="Heredoc Bound" map-to="def:keyword"/>
25 <style id="subshell" _name="Subshell" map-to="def:preprocessor"/>
26 </styles>
28 <definitions>
30 <!-- we cannot use def:shell-like-comment, because
31 m4.lang needs to replace this context -->
32 <context id="line-comment" style-ref="comment" end-at-line-end="true">
33 <start>(?&lt;!\S)#</start>
34 <include>
35 <context ref="def:in-comment"/>
36 </include>
37 </context>
39 <context id="double-quoted-string" style-ref="string">
40 <start>"</start>
41 <end>"</end>
42 <include>
43 <!-- highlight escaped chars -->
44 <context style-ref="def:special-char">
45 <match>\\[$`"\\]</match>
46 </context>
47 <!-- skip backslash where it's not an escaping char -->
48 <context>
49 <match>\\</match>
50 </context>
51 <context ref="def:line-continue"/>
52 <context ref="variable"/>
53 <context ref="backtick-subshell"/>
54 </include>
55 </context>
57 <context id="single-quoted-string" style-ref="string">
58 <start>'</start>
59 <end>'</end>
60 </context>
62 <context id="subshell">
63 <start>\(</start>
64 <end>\)</end>
65 <include>
66 <context sub-pattern="0" where="start" style-ref="keyword"/>
67 <context sub-pattern="0" where="end" style-ref="keyword"/>
68 <context ref="pkgbuild"/>
69 </include>
70 </context>
72 <context id="backtick-subshell" style-ref="subshell">
73 <start>`</start>
74 <end>`</end>
75 <include>
76 <context ref="def:escape"/>
77 <context ref="def:line-continue"/>
78 <context ref="variable"/>
79 <context ref="built-in-command"/>
80 <context ref="common-command"/>
81 <context ref="single-quoted-string"/>
82 <context ref="double-quoted-string"/>
83 </include>
84 </context>
86 <context id="punctuator" style-ref="others">
87 <match>[;\|&amp;/]</match>
88 </context>
90 <context id="function" style-ref="function">
91 <match>\b[a-zA-Z_][a-zA-Z0-9_]+[ \t]*\(\)</match>
92 </context>
94 <context id="redirection" style-ref="others">
95 <keyword>&gt;&amp;+[0-9]</keyword>
96 <keyword>\b[0-9]+&gt;&amp;</keyword>
97 <keyword>\b[0-9]+&gt;&amp;+[0-9]</keyword>
98 <keyword>\b[0-9]+&gt;</keyword>
99 <keyword>&gt;&gt;</keyword>
100 <keyword>\b[0-9]+&gt;&gt;</keyword>
101 <keyword>&lt;&amp;[0-9]</keyword>
102 <keyword>\b[0-9]+&lt;&amp;</keyword>
103 <keyword>\b[0-9]+&lt;&amp;[0-9]</keyword>
104 <keyword>\b[0-9]+&lt;</keyword>
105 <keyword>&lt;&lt;+[0-9]</keyword>
106 <keyword>\b[0-9]+&lt;&lt;</keyword>
107 </context>
109 <context id="here-doc">
110 <start extended="true" dupnames="true">
111 # (?&lt;!&lt;) and [^\s&lt;] are for not matching
112 # here-word (&lt;&lt;&lt;)
113 (?&lt;!&lt;)
114 &lt;&lt;-?\s*\\?(
115 \"(?P&lt;HDB&gt;[^\s&lt;]+)\" | # "EOF"
116 \'(?P&lt;HDB&gt;[^\s&lt;]+)\' | # 'EOF'
117 (?P&lt;HDB&gt;[^\s&lt;]+) # EOF
119 </start>
120 <end>^\t*\%{HDB@start}$</end>
121 <include>
122 <context sub-pattern="0" where="start" style-ref="here-doc-bound"/>
123 <context sub-pattern="0" where="end" style-ref="here-doc-bound"/>
124 </include>
125 </context>
127 <context id="operator" style-ref="function">
128 <keyword>\-a\b</keyword>
129 <keyword>\-b\b</keyword>
130 <keyword>\-c\b</keyword>
131 <keyword>\-d\b</keyword>
132 <keyword>\-e\b</keyword>
133 <keyword>\-f\b</keyword>
134 <keyword>\-g\b</keyword>
135 <keyword>\-h\b</keyword>
136 <keyword>\-k\b</keyword>
137 <keyword>\-p\b</keyword>
138 <keyword>\-r\b</keyword>
139 <keyword>\-s\b</keyword>
140 <keyword>\-t\b</keyword>
141 <keyword>\-u\b</keyword>
142 <keyword>\-w\b</keyword>
143 <keyword>\-x\b</keyword>
144 <keyword>\-O\b</keyword>
145 <keyword>\-G\b</keyword>
146 <keyword>\-L\b</keyword>
147 <keyword>\-S\b</keyword>
148 <keyword>\-N\b</keyword>
149 <keyword>\-nt\b</keyword>
150 <keyword>\-ot\b</keyword>
151 <keyword>\-ef\b</keyword>
152 <keyword>\-o\b</keyword>
153 <keyword>\-z\b</keyword>
154 <keyword>\-n\b</keyword>
155 <keyword>&lt;</keyword>
156 <keyword>&gt;</keyword>
157 <keyword>\!=</keyword>
158 <keyword>\-eq\b</keyword>
159 <keyword>\-ne\b</keyword>
160 <keyword>\-lt\b</keyword>
161 <keyword>\-le\b</keyword>
162 <keyword>\-gt\b</keyword>
163 <keyword>\-ge\b</keyword>
164 </context>
166 <context id="variable" style-ref="variable">
167 <match>\$+[!@?*#\${a-zA-Z0-9_][}a-zA-Z0-9_]*</match>
168 </context>
170 <context id="variable-definition">
171 <match>(^|(?&lt;=then|else|do|export))\s*([a-zA-Z_][a-zA-Z0-9_]*)\=</match>
172 <include>
173 <context sub-pattern="2" style-ref="variable-definition"/>
174 </include>
175 </context>
177 <context id="built-in-command-1" style-ref="keyword">
178 <prefix></prefix>
179 <suffix></suffix>
180 <keyword>\!</keyword>
181 <keyword>\{</keyword>
182 <keyword>\}</keyword>
183 <keyword>\:</keyword>
184 <keyword>(?&lt;=\s)\.(?=\s)</keyword>
185 </context>
187 <context id="for-command">
188 <start>\bfor\b</start>
189 <end>\b(in|do)\b</end>
190 <include>
191 <context sub-pattern="0" where="start" style-ref="keyword"/>
192 <context sub-pattern="0" where="end" style-ref="keyword"/>
193 <context style-ref="variable-definition" once-only="true">
194 <match>\w+</match>
195 </context>
196 </include>
197 </context>
199 <context id="built-in-command-2" style-ref="keyword">
200 <prefix>(?&lt;![^\s;\(\)])</prefix>
201 <suffix>(?![^\s;\(\)])</suffix>
202 <keyword>do</keyword>
203 <keyword>done</keyword>
204 <keyword>elif</keyword>
205 <keyword>else</keyword>
206 <keyword>else</keyword>
207 <keyword>fi</keyword>
208 <keyword>for</keyword>
209 <keyword>function</keyword>
210 <keyword>if</keyword>
211 <keyword>in</keyword>
212 <keyword>select</keyword>
213 <keyword>then</keyword>
214 <keyword>until</keyword>
215 <keyword>while</keyword>
216 <keyword>bash</keyword>
217 <keyword>alias</keyword>
218 <keyword>bg</keyword>
219 <keyword>bind</keyword>
220 <keyword>break</keyword>
221 <keyword>builtin</keyword>
222 <keyword>cd</keyword>
223 <keyword>command</keyword>
224 <keyword>compgen</keyword>
225 <keyword>complete</keyword>
226 <keyword>continue</keyword>
227 <keyword>declare</keyword>
228 <keyword>dirs</keyword>
229 <keyword>disown</keyword>
230 <keyword>echo</keyword>
231 <keyword>enable</keyword>
232 <keyword>eval</keyword>
233 <keyword>exec</keyword>
234 <keyword>exit</keyword>
235 <keyword>export</keyword>
236 <keyword>fc</keyword>
237 <keyword>fg</keyword>
238 <keyword>getopts</keyword>
239 <keyword>hash</keyword>
240 <keyword>help</keyword>
241 <keyword>history</keyword>
242 <keyword>jobs</keyword>
243 <keyword>kill</keyword>
244 <keyword>let</keyword>
245 <keyword>local</keyword>
246 <keyword>logout</keyword>
247 <keyword>popd</keyword>
248 <keyword>printf</keyword>
249 <keyword>pushd</keyword>
250 <keyword>pwd</keyword>
251 <keyword>read</keyword>
252 <keyword>readonly</keyword>
253 <keyword>return</keyword>
254 <keyword>set</keyword>
255 <keyword>shift</keyword>
256 <keyword>shopt</keyword>
257 <keyword>source</keyword>
258 <keyword>suspend</keyword>
259 <keyword>test</keyword>
260 <keyword>times</keyword>
261 <keyword>trap</keyword>
262 <keyword>type</keyword>
263 <keyword>typeset</keyword>
264 <keyword>ulimit</keyword>
265 <keyword>umask</keyword>
266 <keyword>unalias</keyword>
267 <keyword>unset</keyword>
268 <keyword>wait</keyword>
269 </context>
271 <context id="built-in-command">
272 <include>
273 <context ref="built-in-command-1"/>
274 <context ref="for-command"/>
275 <context ref="built-in-command-2"/>
276 </include>
277 </context>
279 <context id="common-command" style-ref="common-command">
280 <prefix>(?&lt;![\w\-\.])</prefix>
281 <suffix>(?![\w\-\.])</suffix>
282 <keyword>awk</keyword>
283 <keyword>beep</keyword>
284 <keyword>bunzip2</keyword>
285 <keyword>bzip2</keyword>
286 <keyword>cat</keyword>
287 <keyword>chmod</keyword>
288 <keyword>chown</keyword>
289 <keyword>clear</keyword>
290 <keyword>cp</keyword>
291 <keyword>date</keyword>
292 <keyword>dd</keyword>
293 <keyword>df</keyword>
294 <keyword>dialog</keyword>
295 <keyword>diff</keyword>
296 <keyword>dir</keyword>
297 <keyword>du</keyword>
298 <keyword>eject</keyword>
299 <keyword>expr</keyword>
300 <keyword>file</keyword>
301 <keyword>find</keyword>
302 <keyword>gcc</keyword>
303 <keyword>grep</keyword>
304 <keyword>gunzip</keyword>
305 <keyword>gzip</keyword>
306 <keyword>head</keyword>
307 <keyword>id</keyword>
308 <keyword>ifconfig</keyword>
309 <keyword>info</keyword>
310 <keyword>insmod</keyword>
311 <keyword>killall</keyword>
312 <keyword>ld</keyword>
313 <keyword>less</keyword>
314 <keyword>ln</keyword>
315 <keyword>locate</keyword>
316 <keyword>ls</keyword>
317 <keyword>lsmod</keyword>
318 <keyword>make</keyword>
319 <keyword>man</keyword>
320 <keyword>mkdir</keyword>
321 <keyword>modprobe</keyword>
322 <keyword>more</keyword>
323 <keyword>mount</keyword>
324 <keyword>mv</keyword>
325 <keyword>nice</keyword>
326 <keyword>passwd</keyword>
327 <keyword>patch</keyword>
328 <keyword>pidof</keyword>
329 <keyword>ping</keyword>
330 <keyword>pkg-config</keyword>
331 <keyword>ps</keyword>
332 <keyword>renice</keyword>
333 <keyword>rmdir</keyword>
334 <keyword>rm</keyword>
335 <keyword>sed</keyword>
336 <keyword>sh</keyword>
337 <keyword>sleep</keyword>
338 <keyword>sort</keyword>
339 <keyword>sudo</keyword>
340 <keyword>su</keyword>
341 <keyword>tail</keyword>
342 <keyword>tar</keyword>
343 <keyword>tempfile</keyword>
344 <keyword>touch</keyword>
345 <keyword>tr</keyword>
346 <keyword>umount</keyword>
347 <keyword>uname</keyword>
348 <keyword>uniq</keyword>
349 <keyword>unzip</keyword>
350 <keyword>uptime</keyword>
351 <keyword>wget</keyword>
352 <keyword>whereis</keyword>
353 <keyword>which</keyword>
354 <keyword>whoami</keyword>
355 <keyword>who</keyword>
356 <keyword>xdialog</keyword>
357 <keyword>zenity</keyword>
358 <keyword>zip</keyword>
359 </context>
361 <context id="case">
362 <start>\bcase\b</start>
363 <end>\besac\b</end>
364 <include>
365 <context sub-pattern="0" where="start" style-ref="keyword"/>
366 <context sub-pattern="0" where="end" style-ref="keyword"/>
367 <context ref="double-quoted-string"/>
368 <context ref="single-quoted-string"/>
369 <context style-ref="others">
370 <match>[^\)\s]+\s*\)|;;</match>
371 </context>
372 <context ref="pkgbuild"/>
373 </include>
374 </context>
376 <context id="pkgbuild">
377 <include>
378 <context ref="def:shebang" style-ref="shebang"/>
379 <context ref="line-comment"/>
380 <context ref="def:escape"/>
381 <context ref="single-quoted-string"/>
382 <context ref="double-quoted-string"/>
383 <context ref="subshell"/>
384 <context ref="backtick-subshell"/>
385 <context ref="case"/>
386 <context ref="punctuator"/>
387 <context ref="function"/>
388 <context ref="here-doc"/>
389 <context ref="redirection"/>
390 <context ref="operator"/>
391 <context ref="variable"/>
392 <context ref="variable-definition"/>
393 <context ref="built-in-command"/>
394 <context ref="common-command"/>
395 </include>
396 </context>
398 </definitions>
399 </language>