Changeset View
Changeset View
Standalone View
Standalone View
data/syntax/fish.xml
- This file was added.
1 | <?xml version="1.0" encoding="UTF-8"?> | ||||
---|---|---|---|---|---|
2 | <!DOCTYPE language SYSTEM "language.dtd" | ||||
3 | [ | ||||
4 | <!ENTITY white " "> <!-- first is tab --> | ||||
5 | <!ENTITY eocommand "&white;<>^"> <!-- end of command separator --> | ||||
6 | <!ENTITY allchars "[&white;!"#$%&'()*+,-./0-9:;<=>?@A-Z[\]\\^_`a-z{}|~]"> <!--&percent; doesn't work -> % --> | ||||
7 | <!ENTITY separator "&white;|&;<>()'""> <!-- token separator as char list --> | ||||
8 | <!ENTITY commandsep "|&;"> <!-- command separator as char list --> | ||||
9 | <!ENTITY special "{}*/.?\\$&"> <!-- not allowed in function names --> | ||||
10 | <!ENTITY portable_filename "A-Za-z0-9\._-"> | ||||
11 | <!ENTITY funcname_first "a-zA-Z+:=!.@_`"> | ||||
12 | <!ENTITY funcname_last "a-zA-Z0-9+,-:=!.@#%^_`~"> | ||||
13 | <!ENTITY funcname "[&funcname_first;]([&funcname_last;]|\\ )*"> | ||||
14 | <!ENTITY varname "[A-Za-z0-9_]+"> | ||||
15 | <!ENTITY alnumdash "[A-Za-z0-9-]"> <!-- option chars, dashes for GNU long opts --> | ||||
16 | <!ENTITY testoptsfile "[bcdefgGkLOprsStuwx]"> <!-- test operators for file testing --> | ||||
17 | <!ENTITY testoptsother "[nzao]"> <!-- other test operators --> | ||||
18 | <!ENTITY braceelement "[!#%+\-\./0-9:=@A-Z^_`a-z~]"> | ||||
19 | <!ENTITY escapechars "[abefnrtv $\\*?~%#(){}[\]<>\^&;"']"> <!-- escape chars --> | ||||
20 | <!ENTITY white_or_eol "([&white;]|$)"> | ||||
21 | <!ENTITY homedir "~[&portable_filename;]*"> | ||||
22 | <!ENTITY pathdetect "((\.\.|\.|&homedir;)&white_or_eol;|([^$\\{}&separator;/\*\?]|\\&escapechars;)*(/|\*|\*\*|\?))"> | ||||
23 | <!ENTITY pathpart "(([^&separator;/]|\\&escapechars;)*)?(/|(?=")|(?='))"> | ||||
24 | ]> | ||||
25 | | ||||
26 | | ||||
27 | <language name="Fish" version="1" kateversion="5.0" section="Scripts" extensions="*.fish;fishd.*" mimetype="application/x-fish" casesensitive="1" author="Arnd Diestelhorst (adiestelhorst@m-xchg.de)" license="LGPL"> | ||||
28 | | ||||
29 | | ||||
30 | <highlighting> | ||||
31 | | ||||
32 | <list name= "commands"> | ||||
33 | <item>abbr</item> | ||||
34 | <item>alias</item> | ||||
35 | <item>argparse</item> | ||||
36 | <item>bg</item> | ||||
37 | <item>bind</item> | ||||
38 | <item>block</item> | ||||
39 | <item>cd</item> | ||||
40 | <item>cdh</item> | ||||
41 | <item>commandline</item> | ||||
42 | <item>complete</item> | ||||
43 | <item>contains</item> | ||||
44 | <item>count</item> | ||||
45 | <item>dirs</item> | ||||
46 | <item>disown</item> | ||||
47 | <item>echo</item> | ||||
48 | <item>emit</item> | ||||
49 | <item>end</item> | ||||
50 | <item>exit</item> | ||||
51 | <item>fg</item> | ||||
52 | <item>fish</item> | ||||
53 | <item>fish_config</item> | ||||
54 | <item>fish_indent</item> | ||||
55 | <item>fish_key_reader</item> | ||||
56 | <item>fish_mode_prompt</item> | ||||
57 | <item>fish_opt</item> | ||||
58 | <item>fish_prompt</item> | ||||
59 | <item>fish_right_prompt</item> | ||||
60 | <item>fish_update_completions</item> | ||||
61 | <item>fish_vi_mode</item> | ||||
62 | <item>funced</item> | ||||
63 | <item>funcsave</item> | ||||
64 | <item>functions</item> | ||||
65 | <item>help</item> | ||||
66 | <item>history</item> | ||||
67 | <item>isatty</item> | ||||
68 | <item>jobs</item> | ||||
69 | <item>math</item> | ||||
70 | <item>nextd</item> | ||||
71 | <item>open</item> | ||||
72 | <item>prevd</item> | ||||
73 | <item>printf</item> | ||||
74 | <item>psub</item> | ||||
75 | <item>pushd</item> | ||||
76 | <item>random</item> | ||||
77 | <item>realpath</item> | ||||
78 | <item>return</item> | ||||
79 | <item>set_color</item> | ||||
80 | <item>source</item> | ||||
81 | <item>status</item> | ||||
82 | <item>suspend</item> | ||||
83 | <item>trap</item> | ||||
84 | <item>type</item> | ||||
85 | <item>ulimit</item> | ||||
86 | <item>umask</item> | ||||
87 | <item>vared</item> | ||||
88 | </list> | ||||
89 | | ||||
90 | <list name="commandsnoargs"> | ||||
91 | <item>break</item> | ||||
92 | <item>breakpoint</item> | ||||
93 | <item>continue</item> | ||||
94 | <item>dirh</item> | ||||
95 | <item>false</item> | ||||
96 | <item>popd</item> | ||||
97 | <item>prompt_pwd</item> | ||||
98 | <item>pwd</item> | ||||
99 | <item>true</item> | ||||
100 | </list> | ||||
101 | | ||||
102 | <list name="commandsstay"> | ||||
103 | <item>and</item> | ||||
104 | <item>not</item> | ||||
105 | <item>or</item> | ||||
106 | </list> | ||||
107 | | ||||
108 | <list name="stringsubcommands"> | ||||
109 | <item>escape</item> | ||||
110 | <item>join</item> | ||||
111 | <item>length</item> | ||||
112 | <item>lower</item> | ||||
113 | <item>match</item> | ||||
114 | <item>repeat</item> | ||||
115 | <item>replace</item> | ||||
116 | <item>split</item> | ||||
117 | <item>sub</item> | ||||
118 | <item>trim</item> | ||||
119 | <item>unescape</item> | ||||
120 | <item>upper</item> | ||||
121 | </list> | ||||
122 | | ||||
123 | <list name="unixcommands"> | ||||
124 | <item>aclocal</item> | ||||
125 | <item>aconnect</item> | ||||
126 | <item>aplay</item> | ||||
127 | <item>apm</item> | ||||
128 | <item>apmsleep</item> | ||||
129 | <item>apropos</item> | ||||
130 | <item>arch</item> | ||||
131 | <item>arecord</item> | ||||
132 | <item>ar</item> | ||||
133 | <item>as86</item> | ||||
134 | <item>as</item> | ||||
135 | <item>autoconf</item> | ||||
136 | <item>autoheader</item> | ||||
137 | <item>automake</item> | ||||
138 | <item>awk</item> | ||||
139 | <item>basename</item> | ||||
140 | <item>bash</item> | ||||
141 | <item>bc</item> | ||||
142 | <item>bison</item> | ||||
143 | <item>bunzip2</item> | ||||
144 | <item>bzcat</item> | ||||
145 | <item>bzcmp</item> | ||||
146 | <item>bzdiff</item> | ||||
147 | <item>bzegrep</item> | ||||
148 | <item>bzfgrep</item> | ||||
149 | <item>bzgrep</item> | ||||
150 | <item>bzip2</item> | ||||
151 | <item>bzip2recover</item> | ||||
152 | <item>bzless</item> | ||||
153 | <item>bzmore</item> | ||||
154 | <item>cal</item> | ||||
155 | <item>cat</item> | ||||
156 | <item>cc</item> | ||||
157 | <item>cdda2wav</item> | ||||
158 | <item>cdparanoia</item> | ||||
159 | <item>cdrdao</item> | ||||
160 | <item>cd-read</item> | ||||
161 | <item>cdrecord</item> | ||||
162 | <item>chattr</item> | ||||
163 | <item>chfn</item> | ||||
164 | <item>chgrp</item> | ||||
165 | <item>chmod</item> | ||||
166 | <item>chown</item> | ||||
167 | <item>chroot</item> | ||||
168 | <item>chsh</item> | ||||
169 | <item>chvt</item> | ||||
170 | <item>c++</item> | ||||
171 | <item>clang</item> | ||||
172 | <item>clear</item> | ||||
173 | <item>cmake</item> | ||||
174 | <item>cmp</item> | ||||
175 | <item>co</item> | ||||
176 | <item>col</item> | ||||
177 | <item>comm</item> | ||||
178 | <item>cpio</item> | ||||
179 | <item>cp</item> | ||||
180 | <item>cpp</item> | ||||
181 | <item>cut</item> | ||||
182 | <item>date</item> | ||||
183 | <item>dc</item> | ||||
184 | <item>dcop</item> | ||||
185 | <item>dd</item> | ||||
186 | <item>deallocvt</item> | ||||
187 | <item>df</item> | ||||
188 | <item>diff3</item> | ||||
189 | <item>diff</item> | ||||
190 | <item>dircolors</item> | ||||
191 | <item>directomatic</item> | ||||
192 | <item>dir</item> | ||||
193 | <item>dirname</item> | ||||
194 | <item>dmesg</item> | ||||
195 | <item>dnsdomainname</item> | ||||
196 | <item>domainname</item> | ||||
197 | <item>du</item> | ||||
198 | <item>dumpkeys</item> | ||||
199 | <item>echo</item> | ||||
200 | <item>ed</item> | ||||
201 | <item>egrep</item> | ||||
202 | <item>env</item> | ||||
203 | <item>expr</item> | ||||
204 | <item>false</item> | ||||
205 | <item>fbset</item> | ||||
206 | <item>fgconsole</item> | ||||
207 | <item>fgrep</item> | ||||
208 | <item>file</item> | ||||
209 | <item>find</item> | ||||
210 | <item>flex</item> | ||||
211 | <item>flex++</item> | ||||
212 | <item>fmt</item> | ||||
213 | <item>free</item> | ||||
214 | <item>ftp</item> | ||||
215 | <item>funzip</item> | ||||
216 | <item>fuser</item> | ||||
217 | <item>gawk</item> | ||||
218 | <item>gcc</item> | ||||
219 | <item>gc</item> | ||||
220 | <item>gdb</item> | ||||
221 | <item>getent</item> | ||||
222 | <item>getkeycodes</item> | ||||
223 | <item>getopt</item> | ||||
224 | <item>gettext</item> | ||||
225 | <item>gettextize</item> | ||||
226 | <item>gimp</item> | ||||
227 | <item>gimp-remote</item> | ||||
228 | <item>gimptool</item> | ||||
229 | <item>g++</item> | ||||
230 | <item>git</item> | ||||
231 | <item>gmake</item> | ||||
232 | <item>gocr</item> | ||||
233 | <item>grep</item> | ||||
234 | <item>groff</item> | ||||
235 | <item>groups</item> | ||||
236 | <item>gs</item> | ||||
237 | <item>gunzip</item> | ||||
238 | <item>gzexe</item> | ||||
239 | <item>gzip</item> | ||||
240 | <item>head</item> | ||||
241 | <item>hexdump</item> | ||||
242 | <item>hostname</item> | ||||
243 | <item>id</item> | ||||
244 | <item>igawk</item> | ||||
245 | <item>install</item> | ||||
246 | <item>join</item> | ||||
247 | <item>kbd_mode</item> | ||||
248 | <item>kbdrate</item> | ||||
249 | <item>kdialog</item> | ||||
250 | <item>kfile</item> | ||||
251 | <item>killall</item> | ||||
252 | <item>kill</item> | ||||
253 | <item>lastb</item> | ||||
254 | <item>last</item> | ||||
255 | <item>ld86</item> | ||||
256 | <item>ldd</item> | ||||
257 | <item>ld</item> | ||||
258 | <item>less</item> | ||||
259 | <item>lex</item> | ||||
260 | <item>link</item> | ||||
261 | <item>ln</item> | ||||
262 | <item>ln</item> | ||||
263 | <item>loadkeys</item> | ||||
264 | <item>loadunimap</item> | ||||
265 | <item>locate</item> | ||||
266 | <item>lockfile</item> | ||||
267 | <item>login</item> | ||||
268 | <item>logname</item> | ||||
269 | <item>lp</item> | ||||
270 | <item>lpr</item> | ||||
271 | <item>lsattr</item> | ||||
272 | <item>ls</item> | ||||
273 | <item>lsmod</item> | ||||
274 | <item>lsmod.old</item> | ||||
275 | <item>lynx</item> | ||||
276 | <item>lzcat</item> | ||||
277 | <item>lzcmp</item> | ||||
278 | <item>lzdiff</item> | ||||
279 | <item>lzegrep</item> | ||||
280 | <item>lzfgrep</item> | ||||
281 | <item>lzgrep</item> | ||||
282 | <item>lzless</item> | ||||
283 | <item>lzmainfo</item> | ||||
284 | <item>lzma</item> | ||||
285 | <item>lzmore</item> | ||||
286 | <item>m4</item> | ||||
287 | <item>make</item> | ||||
288 | <item>man</item> | ||||
289 | <item>mapscrn</item> | ||||
290 | <item>mesg</item> | ||||
291 | <item>mkdir</item> | ||||
292 | <item>mkfifo</item> | ||||
293 | <item>mknod</item> | ||||
294 | <item>mktemp</item> | ||||
295 | <item>more</item> | ||||
296 | <item>mount</item> | ||||
297 | <item>msgfmt</item> | ||||
298 | <item>mv</item> | ||||
299 | <item>namei</item> | ||||
300 | <item>nano</item> | ||||
301 | <item>nasm</item> | ||||
302 | <item>nawk</item> | ||||
303 | <item>netstat</item> | ||||
304 | <item>nice</item> | ||||
305 | <item>nisdomainname</item> | ||||
306 | <item>nl</item> | ||||
307 | <item>nm86</item> | ||||
308 | <item>nmap</item> | ||||
309 | <item>nm</item> | ||||
310 | <item>nohup</item> | ||||
311 | <item>nop</item> | ||||
312 | <item>nroff</item> | ||||
313 | <item>od</item> | ||||
314 | <item>openvt</item> | ||||
315 | <item>passwd</item> | ||||
316 | <item>patch</item> | ||||
317 | <item>pcregrep</item> | ||||
318 | <item>pcretest</item> | ||||
319 | <item>perl</item> | ||||
320 | <item>perror</item> | ||||
321 | <item>pgawk</item> | ||||
322 | <item>pidof</item> | ||||
323 | <item>ping</item> | ||||
324 | <item>printf</item> | ||||
325 | <item>pr</item> | ||||
326 | <item>procmail</item> | ||||
327 | <item>prune</item> | ||||
328 | <item>ps2ascii</item> | ||||
329 | <item>ps2epsi</item> | ||||
330 | <item>ps2frag</item> | ||||
331 | <item>ps2pdf</item> | ||||
332 | <item>ps2ps</item> | ||||
333 | <item>psbook</item> | ||||
334 | <item>ps</item> | ||||
335 | <item>psmerge</item> | ||||
336 | <item>psnup</item> | ||||
337 | <item>psresize</item> | ||||
338 | <item>psselect</item> | ||||
339 | <item>pstops</item> | ||||
340 | <item>pstree</item> | ||||
341 | <item>pwd</item> | ||||
342 | <item>qmake</item> | ||||
343 | <item>rbash</item> | ||||
344 | <item>rcs</item> | ||||
345 | <item>readlink</item> | ||||
346 | <item>red</item> | ||||
347 | <item>resizecons</item> | ||||
348 | <item>rev</item> | ||||
349 | <item>rmdir</item> | ||||
350 | <item>rm</item> | ||||
351 | <item>rsync</item> | ||||
352 | <item>run-parts</item> | ||||
353 | <item>sash</item> | ||||
354 | <item>scp</item> | ||||
355 | <item>sed</item> | ||||
356 | <item>seq</item> | ||||
357 | <item>setfont</item> | ||||
358 | <item>setkeycodes</item> | ||||
359 | <item>setleds</item> | ||||
360 | <item>setmetamode</item> | ||||
361 | <item>setserial</item> | ||||
362 | <item>setterm</item> | ||||
363 | <item>sh</item> | ||||
364 | <item>showkey</item> | ||||
365 | <item>shred</item> | ||||
366 | <item>size86</item> | ||||
367 | <item>size</item> | ||||
368 | <item>skill</item> | ||||
369 | <item>sleep</item> | ||||
370 | <item>slogin</item> | ||||
371 | <item>snice</item> | ||||
372 | <item>sort</item> | ||||
373 | <item>sox</item> | ||||
374 | <item>split</item> | ||||
375 | <item>ssed</item> | ||||
376 | <item>ssh-add</item> | ||||
377 | <item>ssh-agent</item> | ||||
378 | <item>ssh</item> | ||||
379 | <item>ssh-keygen</item> | ||||
380 | <item>ssh-keyscan</item> | ||||
381 | <item>stat</item> | ||||
382 | <item>strings</item> | ||||
383 | <item>strip</item> | ||||
384 | <item>stty</item> | ||||
385 | <item>sudo</item> | ||||
386 | <item>suidperl</item> | ||||
387 | <item>su</item> | ||||
388 | <item>sum</item> | ||||
389 | <item>svn</item> | ||||
390 | <item>sync</item> | ||||
391 | <item>tac</item> | ||||
392 | <item>tail</item> | ||||
393 | <item>tar</item> | ||||
394 | <item>tee</item> | ||||
395 | <item>tempfile</item> | ||||
396 | <item>test</item> | ||||
397 | <item>touch</item> | ||||
398 | <item>tr</item> | ||||
399 | <item>troff</item> | ||||
400 | <item>true</item> | ||||
401 | <item>truncate</item> | ||||
402 | <item>umount</item> | ||||
403 | <item>uname</item> | ||||
404 | <item>unicode_start</item> | ||||
405 | <item>unicode_stop</item> | ||||
406 | <item>uniq</item> | ||||
407 | <item>unlink</item> | ||||
408 | <item>unlzma</item> | ||||
409 | <item>unxz</item> | ||||
410 | <item>unzip</item> | ||||
411 | <item>updatedb</item> | ||||
412 | <item>updmap</item> | ||||
413 | <item>uptime</item> | ||||
414 | <item>users</item> | ||||
415 | <item>utmpdump</item> | ||||
416 | <item>uuidgen</item> | ||||
417 | <item>valgrind</item> | ||||
418 | <item>vdir</item> | ||||
419 | <item>vmstat</item> | ||||
420 | <item>wall</item> | ||||
421 | <item>wc</item> | ||||
422 | <item>wget</item> | ||||
423 | <item>whatis</item> | ||||
424 | <item>whereis</item> | ||||
425 | <item>which</item> | ||||
426 | <item>whoami</item> | ||||
427 | <item>who</item> | ||||
428 | <item>w</item> | ||||
429 | <item>write</item> | ||||
430 | <item>xargs</item> | ||||
431 | <item>xdg-open</item> | ||||
432 | <item>xhost</item> | ||||
433 | <item>xmodmap</item> | ||||
434 | <item>xset</item> | ||||
435 | <item>xzcat</item> | ||||
436 | <item>xz</item> | ||||
437 | <item>yacc</item> | ||||
438 | <item>yes</item> | ||||
439 | <item>ypdomainname</item> | ||||
440 | <item>zcat</item> | ||||
441 | <item>zcmp</item> | ||||
442 | <item>zdiff</item> | ||||
443 | <item>zegrep</item> | ||||
444 | <item>zfgrep</item> | ||||
445 | <item>zforce</item> | ||||
446 | <item>zgrep</item> | ||||
447 | <item>zip</item> | ||||
448 | <item>zless</item> | ||||
449 | <item>zmore</item> | ||||
450 | <item>znew</item> | ||||
451 | <item>zsh</item> | ||||
452 | <item>zsoelim</item> | ||||
453 | </list> | ||||
454 | | ||||
455 | | ||||
456 | | ||||
457 | <contexts> | ||||
458 | <context name="Start" attribute="Normal Text" lineEndContext="#stay" fallthrough="true" fallthroughContext="Root"> | ||||
459 | <DetectChar attribute="Error" context="DropRestOfLine" char=")"/> | ||||
460 | </context> | ||||
461 | | ||||
462 | <context name="DropRestOfLine" attribute="Normal Text" lineEndContext="#pop"> | ||||
463 | <DetectChar attribute="Comment" context="Comment" char="#"/> | ||||
464 | <RegExpr attribute="Normal Text" String="[^#]*" /> | ||||
465 | </context> | ||||
466 | | ||||
467 | <!-- Root starts at a new line (not continuation) --> | ||||
468 | <context name="Root" attribute="Normal Text" lineEndContext="#pop"> | ||||
469 | <LineContinue attribute="Escape" /> | ||||
470 | <DetectChar attribute="Comment" context="Comment" char="#"/> | ||||
471 | <DetectChar context="#pop" char=")" lookAhead="true" /> | ||||
472 | <IncludeRules context="FindCommands" /> | ||||
473 | </context> | ||||
474 | | ||||
475 | <!-- | ||||
476 | fish interprets closing parenthesis inside comments as end of command substitution, if the comment starts | ||||
477 | inside of a command substitution! | ||||
478 | | ||||
479 | fish does not interpret them this way, when | ||||
480 | they are escaped by a \ or | ||||
481 | they are matched by an earlier opening parenthesis inside the same comment. | ||||
482 | This behaviour is replicated here. | ||||
483 | | ||||
484 | Command substitutions may span several lines, so the closing parenthesis may be on a different line, | ||||
485 | than the opening one. In the interactive shell you need a continuation line for this, not so in scripts. | ||||
486 | Blocks of code with multiline command substitutions may be commented out. This should not lead to visual artifacts. | ||||
487 | | ||||
488 | There is one case, where the following solution fails: a lonely closing ")", which is marked as an error. | ||||
489 | --> | ||||
490 | <context name="Comment" attribute="Comment" lineEndContext="#pop"> | ||||
491 | <Detect2Chars attribute="Comment" char="\" char1="(" /> | ||||
492 | <Detect2Chars attribute="Comment" char="\" char1=")" /> | ||||
493 | <DetectChar context="CommentParenSub" char="(" /> | ||||
494 | <DetectChar context="#pop" char=")" lookAhead="true" /> | ||||
495 | <IncludeRules context="##Alerts" /> | ||||
496 | <IncludeRules context="##Modelines" /> | ||||
497 | </context> | ||||
498 | | ||||
499 | <context name="CommentParenSub" attribute="Comment" lineEndContext="BlockComment"> | ||||
500 | <DetectChar attribute="Comment" context="#pop" char=")" /> | ||||
501 | <IncludeRules context="Comment" /> | ||||
502 | </context> | ||||
503 | | ||||
504 | <context name="BlockComment" attribute="Comment" fallthrough="true" fallthroughContext="#pop#pop#pop" lineEndContext="#stay"> | ||||
505 | <DetectChar attribute="Comment" context="#pop" char="#" firstNonSpace="true"/> | ||||
506 | </context> | ||||
507 | | ||||
508 | <!-- FindCommands matches Fish and Unix commands --> | ||||
509 | <!-- order is important, factor out common rules did'nt work because of order of rules--> | ||||
510 | <context name="FindCommands" attribute="Command" lineEndContext="#stay"> | ||||
511 | <DetectSpaces attribute="Normal Text" /> | ||||
512 | <AnyChar attribute="Error" context="#pop!DropRestOfLine" String="(<>"/> | ||||
513 | <AnyChar attribute="Separator" String="&commandsep;" /> | ||||
514 | <keyword attribute="Builtin" context="Arguments" String="commands" /> <!--simple commands first--> | ||||
515 | <keyword attribute="Builtin" context="ArgumentsNone" String="commandsnoargs" /> | ||||
516 | <keyword attribute="Control Flow" String="commandsstay" /> | ||||
517 | <Detect2Chars attribute="Builtin" context="Arguments" char="." char1=" " /> | ||||
518 | <RegExpr attribute="CommandPath" context="CommandPart" String="&pathdetect;" /> | ||||
519 | <IncludeRules context="FindSpecialCommands" /> <!--before unixcommands, because f test, but after path detection--> | ||||
520 | <keyword attribute="UnixCommand" context="Arguments" String="unixcommands"/> | ||||
521 | <RegExpr attribute="Command" context="CommandPart" String="&funcname;" /> | ||||
522 | <DetectChar context="CommandPart" char=""" lookAhead="true"/> | ||||
523 | </context> | ||||
524 | | ||||
525 | <context name="CommandPart" attribute="Command" lineEndContext="#pop"> | ||||
526 | <LineContinue attribute="Escape" /> | ||||
527 | <AnyChar context="#pop" String=")#" lookAhead="true"/> | ||||
528 | <AnyChar attribute="Separator" context="#pop" String="&commandsep;" /> | ||||
529 | <AnyChar context="#pop!Arguments" String="&eocommand;" lookAhead="true"/> | ||||
530 | <RegExpr attribute="CommandPath" String="&pathpart;" /> | ||||
531 | <keyword attribute="UnixCommand" String="unixcommands"/> | ||||
532 | <RegExpr attribute="Command" String="&funcname;" /> | ||||
533 | <IncludeRules context="FindStrings" /> | ||||
534 | <RegExpr attribute="Error" String="." /> | ||||
535 | </context> | ||||
536 | | ||||
537 | <context name="FindSpecialCommands" attribute="Builtin" lineEndContext="#stay"> | ||||
538 | <WordDetect attribute="Builtin" String="command" context="command_builtin" /> | ||||
539 | <WordDetect attribute="Builtin" String="builtin" context="command_builtin" /> | ||||
540 | <WordDetect attribute="Builtin" String="eval" context="eval_exec" /> | ||||
541 | <WordDetect attribute="Builtin" String="exec" context="eval_exec" /> | ||||
542 | <WordDetect attribute="Builtin" String="set" context="set" /> | ||||
543 | <WordDetect attribute="Builtin" String="string" context="string" /> | ||||
544 | <WordDetect attribute="Builtin" String="read" context="read_vared" /> | ||||
545 | <WordDetect attribute="Builtin" String="vared" context="read_vared" /> | ||||
546 | <WordDetect attribute="Builtin" String="test" context="ArgumentsTest" /> | ||||
547 | <RegExpr attribute="Builtin" String="\[\s" context="ArgumentsTestBrack" /> | ||||
548 | <WordDetect attribute="Control Flow" String="begin" context="begin" beginRegion="begin" /> | ||||
549 | <WordDetect attribute="Control Flow" String="for" context="for" beginRegion="for" /> | ||||
550 | <WordDetect attribute="Control Flow" String="function" context="function" beginRegion="function" /> | ||||
551 | <WordDetect attribute="Control Flow" String="if" context="if" beginRegion="if" /> | ||||
552 | <WordDetect attribute="Control Flow" String="switch" context="switch" beginRegion="switch" /> | ||||
553 | <WordDetect attribute="Control Flow" String="while" context="while" beginRegion="while" /> | ||||
554 | </context> | ||||
555 | | ||||
556 | <context name="command_builtin" attribute="Normal Text" lineEndContext="#pop"> | ||||
557 | <LineContinue attribute="Escape" /> | ||||
558 | <RegExpr attribute="Option" String="-&alnumdash;*" /> | ||||
559 | <AnyChar attribute="Separator" context="#pop" String="&commandsep;" /> | ||||
560 | <IncludeRules context="Root" /> | ||||
561 | </context> | ||||
562 | | ||||
563 | <context name="eval_exec" attribute="Normal Text" lineEndContext="#pop"> | ||||
564 | <DetectChar context="#pop" char=")" lookAhead="true"/> | ||||
565 | <AnyChar attribute="Separator" context="#pop" String="&commandsep;" /> | ||||
566 | <IncludeRules context="FindStrings" /> | ||||
567 | <IncludeRules context="FindVarExpansion" /> | ||||
568 | <IncludeRules context="FindSubstitutions" /> | ||||
569 | <IncludeRules context="FindBraceExpansion" /> | ||||
570 | <IncludeRules context="FindPaths" /> | ||||
571 | <IncludeRules context="FindEscapes" /> | ||||
572 | <IncludeRules context="Root" /> | ||||
573 | </context> | ||||
574 | | ||||
575 | <context name="set" attribute="Normal Text" lineEndContext="#pop"> | ||||
576 | <LineContinue attribute="Escape" /> | ||||
577 | <AnyChar attribute="Separator" context="#pop" String="&commandsep;" /> | ||||
578 | <RegExpr attribute="Option" String="-&alnumdash;*" /> | ||||
579 | <RegExpr attribute="Variable" String="&varname;" context="Arguments" /> | ||||
580 | <IncludeRules context="FindVarExpansion" /> | ||||
581 | </context> | ||||
582 | | ||||
583 | <context name="string" attribute="Normal Text" lineEndContext="#pop"> | ||||
584 | <LineContinue attribute="Escape" /> | ||||
585 | <DetectSpaces attribute="Normal Text" /> | ||||
586 | <keyword attribute="Builtin" context="#pop!Arguments" String="stringsubcommands" /> | ||||
587 | <RegExpr attribute="Error" String="." /> | ||||
588 | </context> | ||||
589 | | ||||
590 | <context name="read_vared" attribute="Normal Text" lineEndContext="#pop"> | ||||
591 | <LineContinue attribute="Escape" /> | ||||
592 | <RegExpr attribute="Option" String="-&alnumdash;*" /> | ||||
593 | <DetectChar attribute="Comment" context="Comment" char="#"/> | ||||
594 | <AnyChar attribute="Separator" context="#pop" String="&commandsep;" /> | ||||
595 | <DetectChar context="#pop" char=")" lookAhead="true"/> | ||||
596 | <IncludeRules context="FindStrings" /> | ||||
597 | <IncludeRules context="FindVarExpansion" /> | ||||
598 | <IncludeRules context="FindSubstitutions" /> | ||||
599 | <IncludeRules context="FindBraceExpansion" /> | ||||
600 | <IncludeRules context="FindEscapes" /> | ||||
601 | <RegExpr attribute="Variable" String="&varname;" /> | ||||
602 | </context> | ||||
603 | | ||||
604 | <context name="ArgumentsTestBrack" attribute="Normal Text" lineEndContext="#pop"> | ||||
605 | <LineContinue attribute="Escape" /> | ||||
606 | <Detect2Chars attribute="Builtin" char=" " char1="]" context="#pop!ArgumentsNonePre" /> | ||||
607 | <AnyChar attribute="Error" context="#pop!DropRestOfLine" String="#&commandsep;&"/> | ||||
608 | <IncludeRules context="ArgumentsTest" /> | ||||
609 | </context> | ||||
610 | | ||||
611 | <context name="ArgumentsTest" attribute="Normal Text" lineEndContext="#pop"> | ||||
612 | <LineContinue attribute="Escape" /> | ||||
613 | <DetectChar context="#pop" char="#" lookAhead="true" /> | ||||
614 | <IncludeRules context="ArgumentsTest_common" /> | ||||
615 | </context> | ||||
616 | | ||||
617 | <context name="ArgumentsTest_common" attribute="Normal Text" lineEndContext="#pop"> | ||||
618 | <RegExpr attribute="Operator" context="DirectPath" String="-&testoptsfile; " /> | ||||
619 | <RegExpr attribute="Operator" String="-&testoptsother; " /> | ||||
620 | <RegExpr attribute="Operator" String="(!|=|!=| -eq | -ne | -gt | -ge | -lt | -le )"/> | ||||
621 | <AnyChar context="#pop" String="&commandsep;" lookAhead="true"/> | ||||
622 | <IncludeRules context="FindArgumentsCommon" /> | ||||
623 | </context> | ||||
624 | | ||||
625 | <context name="begin" attribute="Normal Text" lineEndContext="beginbody"> | ||||
626 | <DetectSpaces attribute="Normal Text" /> | ||||
627 | <DetectChar attribute="Separator" context="beginbody" char=";" /> | ||||
628 | <IncludeRules context="Root" /> | ||||
629 | </context> | ||||
630 | | ||||
631 | <context name="beginbody" attribute="Normal Text" lineEndContext="#stay"> | ||||
632 | <LineContinue attribute="Escape" /> | ||||
633 | <StringDetect attribute="Control Flow" String="end" context="#pop#pop" endRegion="begin" /> | ||||
634 | <IncludeRules context="Root" /> | ||||
635 | </context> | ||||
636 | | ||||
637 | <context name="for" attribute="Normal Text" lineEndContext="#stay"> | ||||
638 | <LineContinue attribute="Escape" /> | ||||
639 | <DetectSpaces attribute="Normal Text" /> | ||||
640 | <Detect2Chars attribute="Control Flow" char="i" char1="n" context="forargs" /> | ||||
641 | <RegExpr attribute="Variable" String="&varname;" /> | ||||
642 | <IncludeRules context="FindVarExpansion" /> | ||||
643 | <RegExpr attribute="Error" String="."/> | ||||
644 | </context> | ||||
645 | | ||||
646 | <context name="forargs" attribute="Normal Text" lineEndContext="forbody"> | ||||
647 | <DetectChar attribute="Separator" context="forbody" char=";" /> | ||||
648 | <DetectChar attribute="Comment" context="Comment" char="#"/> | ||||
649 | <IncludeRules context="FindArgumentsCommon" /> | ||||
650 | </context> | ||||
651 | | ||||
652 | <context name="forbody" attribute="Normal Text" lineEndContext="#stay"> | ||||
653 | <LineContinue attribute="Escape" /> | ||||
654 | <StringDetect attribute="Control Flow" String="end" context="#pop#pop#pop" endRegion="for" /> | ||||
655 | <IncludeRules context="Root" /> | ||||
656 | </context> | ||||
657 | | ||||
658 | <context name="function" attribute="Normal Text" lineEndContext="funcbody"> | ||||
659 | <LineContinue attribute="Escape" /> | ||||
660 | <DetectSpaces attribute="Normal Text" /> | ||||
661 | <DetectChar attribute="Comment" context="func_comment" char="#"/> | ||||
662 | <DetectChar context="funcopts" char="-" lookAhead="true" /> | ||||
663 | <DetectChar attribute="Separator" context="funcbody" char=";" /> | ||||
664 | <RegExpr attribute="Command" String="&funcname;" /> | ||||
665 | <IncludeRules context="FindVarExpansion" /> | ||||
666 | <RegExpr attribute="Error" String="."/> | ||||
667 | </context> | ||||
668 | | ||||
669 | <context name="func_comment" attribute="Comment" lineEndContext="#pop!funcbody"> | ||||
670 | </context> | ||||
671 | | ||||
672 | <context name="funcopts" attribute="Normal Text" lineEndContext="#pop!funcbody"> | ||||
673 | <DetectChar attribute="Comment" context="#pop!func_comment" char="#"/> | ||||
674 | <RegExpr attribute="Option" String="(-d[&white;]*|--description=)(?=('|"))" context="funcdesc" beginRegion="doc"/> | ||||
675 | <RegExpr attribute="Option" String="-&alnumdash;*" /> | ||||
676 | <DetectChar attribute="Separator" context="#pop!funcbody" char=";" /> | ||||
677 | <IncludeRules context="FindArgumentsCommon" /> | ||||
678 | </context> | ||||
679 | | ||||
680 | <context name="funcdesc" attribute="Function Doc" lineEndContext="#stay"> | ||||
681 | <DetectChar context="DocstringSQ" char="'" /> | ||||
682 | <DetectChar context="DocstringDQ" char=""" /> | ||||
683 | </context> | ||||
684 | | ||||
685 | <!-- StringSQ consumes anything till ' --> | ||||
686 | <context name="DocstringSQ" attribute="Function Doc" lineEndContext="#stay"> | ||||
687 | <!--no line continuation here--> | ||||
688 | <Detect2Chars attribute="Escape" char="\" char1="'" /> | ||||
689 | <Detect2Chars attribute="Escape" char="\" char1="\" /> | ||||
690 | <DetectChar attribute="Function Doc" context="#pop#pop" char="'" endRegion="doc"/> | ||||
691 | </context> | ||||
692 | | ||||
693 | <!-- StringDQ consumes anything till ", substitutes vars and expressions --> | ||||
694 | <context name="DocstringDQ" attribute="Function Doc" lineEndContext="#stay"> | ||||
695 | <LineContinue attribute="Escape" /> | ||||
696 | <Detect2Chars attribute="Escape" char="\" char1=""" /> | ||||
697 | <Detect2Chars attribute="Escape" char="\" char1="$" /> | ||||
698 | <Detect2Chars attribute="Escape" char="\" char1="\" /> | ||||
699 | <IncludeRules context="FindVarExpansion" /> | ||||
700 | <DetectChar attribute="Function Doc" context="#pop#pop" char=""" endRegion="doc"/> | ||||
701 | </context> | ||||
702 | | ||||
703 | <context name="funcbody" attribute="Normal Text" lineEndContext="#stay"> | ||||
704 | <LineContinue attribute="Escape" /> | ||||
705 | <StringDetect attribute="Control Flow" String="end" context="#pop#pop" endRegion="function" /> | ||||
706 | <IncludeRules context="Root" /> | ||||
707 | </context> | ||||
708 | | ||||
709 | <context name="if" attribute="Normal Text" lineEndContext="#stay"> | ||||
710 | <LineContinue attribute="Escape" /> | ||||
711 | <RegExpr attribute="Control Flow" String="\s*(else\s*if|else)" /> | ||||
712 | <StringDetect attribute="Control Flow" String="end" context="#pop" endRegion="if"/> | ||||
713 | <IncludeRules context="Root" /> | ||||
714 | </context> | ||||
715 | | ||||
716 | <context name="else" attribute="Normal Text" lineEndContext="#stay"> | ||||
717 | <LineContinue attribute="Escape" /> | ||||
718 | <RegExpr String="\s*(else|end|else\s*if)" context="#pop" lookAhead="true"/> | ||||
719 | <RegExpr attribute="Control Flow" String="\s*(else\s*if|else)" context="else" /> | ||||
720 | <StringDetect attribute="Control Flow" String="end" context="#pop#pop" endRegion="if"/> | ||||
721 | <IncludeRules context="Root" /> | ||||
722 | </context> | ||||
723 | | ||||
724 | <context name="switch" attribute="Normal Text" lineEndContext="switchbody"> | ||||
725 | <DetectChar attribute="Separator" context="switchbody" char=";" /> | ||||
726 | <DetectChar attribute="Comment" context="Comment" char="#"/> | ||||
727 | <IncludeRules context="FindArgumentsCommon" /> | ||||
728 | </context> | ||||
729 | | ||||
730 | <context name="switchbody" attribute="Normal Text" lineEndContext="#stay"> | ||||
731 | <LineContinue attribute="Escape" /> | ||||
732 | <RegExpr attribute="Control Flow" String="\s*case" context="case" beginRegion="case" /> | ||||
733 | <StringDetect attribute="Control Flow" String="end" context="#pop#pop" endRegion="switch"/> | ||||
734 | <IncludeRules context="Root" /> | ||||
735 | </context> | ||||
736 | | ||||
737 | <context name="case" attribute="Normal Text" lineEndContext="casebody"> | ||||
738 | <DetectChar attribute="Separator" context="casebody" char=";" /> | ||||
739 | <DetectChar attribute="Comment" context="Comment" char="#"/> | ||||
740 | <IncludeRules context="FindArgumentsCommon" /> | ||||
741 | </context> | ||||
742 | | ||||
743 | <context name="casebody" attribute="Normal Text" lineEndContext="#stay"> | ||||
744 | <LineContinue attribute="Escape" /> | ||||
745 | <!-- next: don't consume anything, otherwise the end of folding hides the next case --> | ||||
746 | <RegExpr String="^\s*(case|end)" context="#pop#pop" endRegion="case" lookAhead="true"/> | ||||
747 | <IncludeRules context="Root" /> | ||||
748 | </context> | ||||
749 | | ||||
750 | <context name="while" attribute="Normal Text" lineEndContext="#stay"> | ||||
751 | <LineContinue attribute="Escape" /> | ||||
752 | <StringDetect attribute="Control Flow" String="end" context="#pop" endRegion="while"/> | ||||
753 | <IncludeRules context="Root" /> | ||||
754 | </context> | ||||
755 | | ||||
756 | <!--Argument Rules match the items after a command | ||||
757 | this one is a collection with the common part for inclusion--> | ||||
758 | <context name="Arguments" attribute="Normal Text" lineEndContext="#pop"> | ||||
759 | <DetectChar attribute="Comment" context="Comment" char="#"/> | ||||
760 | <AnyChar context="#pop" String="&commandsep;" lookAhead="true"/> | ||||
761 | <DetectChar context="#pop" char=")" lookAhead="true"/> | ||||
762 | <IncludeRules context="FindArgumentsCommon" /> | ||||
763 | </context> | ||||
764 | | ||||
765 | <context name="FindArgumentsCommon" attribute="Normal Text" lineEndContext="#stay"> | ||||
766 | <LineContinue attribute="Escape" /> | ||||
767 | <DetectSpaces attribute="Normal Text" /> | ||||
768 | <RegExpr attribute="Option" String="-&alnumdash;*" /> | ||||
769 | <RegExpr attribute="Redirection" context="Redirect" String="[0-9]*(>{1,2}|<|\^{1,2})" /> | ||||
770 | <DetectChar attribute="Operator" char="="/> | ||||
771 | <DetectChar attribute="Index" context="Subscript" char="["/> | ||||
772 | <IncludeRules context="FindStrings" /> | ||||
773 | <IncludeRules context="FindVarExpansion" /> | ||||
774 | <IncludeRules context="FindSubstitutions" /> | ||||
775 | <IncludeRules context="FindBraceExpansion" /> | ||||
776 | <IncludeRules context="FindProcessExpansion" /> | ||||
777 | <IncludeRules context="FindPaths" /> | ||||
778 | <IncludeRules context="FindEscapes" /> | ||||
779 | <RegExpr attribute="Normal Text" String="[^&separator;&special;]*" /> <!--unknown token--> | ||||
780 | </context> | ||||
781 | | ||||
782 | <context name="ArgumentsNonePre" attribute="Normal Text" lineEndContext="#pop"> | ||||
783 | <LineContinue attribute="Escape" /> | ||||
784 | <DetectSpaces attribute="Normal Text" context="#pop!ArgumentsNone" /> | ||||
785 | <AnyChar context="#pop" String="&commandsep;" lookAhead="true"/> <!--consumed on the "Find"-Level--> | ||||
786 | <RegExpr attribute="Error" String="[^&commandsep;]"/> | ||||
787 | </context> | ||||
788 | | ||||
789 | <context name="ArgumentsNone" attribute="Normal Text" lineEndContext="#pop"> | ||||
790 | <LineContinue attribute="Escape" /> | ||||
791 | <DetectSpaces attribute="Normal Text" /> | ||||
792 | <DetectChar attribute="Comment" context="Comment" char="#"/> | ||||
793 | <RegExpr attribute="Redirection" context="Redirect" String="[0-9]*(>{1,2}|<|\^{1,2})" /> | ||||
794 | <AnyChar context="#pop" String="&commandsep;" lookAhead="true"/> <!--consumed on the "Find"-Level--> | ||||
795 | <DetectChar context="#pop" char=")" lookAhead="true"/> | ||||
796 | <RegExpr attribute="Error" String="[^&commandsep;#]*"/> | ||||
797 | </context> | ||||
798 | | ||||
799 | <context name="TokEnd" attribute="Normal Text" lineEndContext="#pop"> | ||||
800 | <LineContinue attribute="Escape" /> | ||||
801 | <DetectSpaces attribute="Normal Text" context="#pop"/> | ||||
802 | <AnyChar context="#pop" String="&commandsep;" lookAhead="true"/> <!--consumed on the "Find"-Level--> | ||||
803 | <RegExpr attribute="Error" String="." context="#pop"/> | ||||
804 | </context> | ||||
805 | | ||||
806 | <context name="Redirect" attribute="Redirection" fallthrough="true" fallthroughContext="#pop!DirectPath" lineEndContext="#stay"> | ||||
807 | <LineContinue attribute="Escape" /> | ||||
808 | <DetectChar attribute="Redirection" context="#pop!DirectPath" char="?"/> | ||||
809 | <DetectChar attribute="Redirection" context="#pop#pop" char="|"/> | ||||
810 | <RegExpr attribute="Redirection" context="#pop!TokEnd" String="(&[0-9]+|&-)" /> | ||||
811 | </context> | ||||
812 | | ||||
813 | <context name="Subscript" attribute="Index" lineEndContext="#pop"> | ||||
814 | <LineContinue attribute="Escape" /> | ||||
815 | <Detect2Chars char="]" char1="[" /> | ||||
816 | <DetectChar attribute="Index" context="#pop" char="]" /> | ||||
817 | <Detect2Chars char="." char1="." /> | ||||
818 | <RegExpr attribute="Index" String=" *-?\d+" /> | ||||
819 | <IncludeRules context="FindVarExpansion" /> | ||||
820 | <IncludeRules context="FindSubstitutions" /> | ||||
821 | <DetectSpaces attribute="Normal Text" /> | ||||
822 | <RegExpr attribute="Error" String="[^\]]" /> | ||||
823 | </context> | ||||
824 | | ||||
825 | <!-- FindStrings looks for single and double quoted strings --> | ||||
826 | <context name="FindStrings" attribute="Normal Text" lineEndContext="#stay"> | ||||
827 | <DetectChar context="StringSQ" char="'" /> | ||||
828 | <DetectChar context="StringDQ" char=""" /> | ||||
829 | </context> | ||||
830 | | ||||
831 | <!-- StringSQ consumes anything till ' --> | ||||
832 | <context name="StringSQ" attribute="String SingleQ" lineEndContext="#stay"> | ||||
833 | <!--no line continuation here--> | ||||
834 | <Detect2Chars attribute="Escape" char="\" char1="'" /> | ||||
835 | <Detect2Chars attribute="Escape" char="\" char1="\" /> | ||||
836 | <DetectChar attribute="String SingleQ" context="#pop" char="'" /> | ||||
837 | </context> | ||||
838 | | ||||
839 | <!-- StringDQ consumes anything till ", substitutes vars and expressions --> | ||||
840 | <context name="StringDQ" attribute="String DoubleQ" lineEndContext="#stay"> | ||||
841 | <LineContinue attribute="Escape" /> | ||||
842 | <Detect2Chars attribute="Escape" char="\" char1=""" /> | ||||
843 | <Detect2Chars attribute="Escape" char="\" char1="$" /> | ||||
844 | <Detect2Chars attribute="Escape" char="\" char1="\" /> | ||||
845 | <IncludeRules context="FindVarExpansion" /> | ||||
846 | <DetectChar attribute="String DoubleQ" context="#pop" char=""" /> | ||||
847 | </context> | ||||
848 | | ||||
849 | <!-- FindVarExpansion goes after anything starting with $ and and their escapes --> | ||||
850 | <context name="FindVarExpansion" attribute="Normal Text" lineEndContext="#stay"> | ||||
851 | <RegExpr attribute="Variable" context="CheckSubscript" String="\$+&varname;" /> | ||||
852 | </context> | ||||
853 | | ||||
854 | <!-- Subscript consumes anything till ], marks as Variable --> | ||||
855 | <context name="CheckSubscript" attribute="Index" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> | ||||
856 | <LineContinue attribute="Escape" /> | ||||
857 | <DetectChar attribute="Index" context="Subscript" char="["/> | ||||
858 | </context> | ||||
859 | | ||||
860 | <!-- Command Substitution --> | ||||
861 | <context name="FindSubstitutions" attribute="Normal Text" lineEndContext="#stay"> | ||||
862 | <StringDetect attribute="Keychar" context="CommandSubstitution" String="(" /> | ||||
863 | </context> | ||||
864 | | ||||
865 | <context name="CommandSubstitution" attribute="Normal Text" fallthrough="true" fallthroughContext="Root" lineEndContext="#stay"> | ||||
866 | <LineContinue attribute="Escape" /> | ||||
867 | <DetectChar attribute="Keychar" context="#pop" char=")" /> | ||||
868 | </context> | ||||
869 | | ||||
870 | <!-- Brace Expansion consumes anything till } --> | ||||
871 | <context name="FindBraceExpansion" attribute="Normal Text" lineEndContext="#stay"> | ||||
872 | <DetectChar attribute="Keychar" context="BraceList" char="{" /> | ||||
873 | <DetectChar attribute="Error" char="}" /> | ||||
874 | </context> | ||||
875 | | ||||
876 | <context name="BraceList" attribute="Normal Text" lineEndContext="#pop"> | ||||
877 | <LineContinue attribute="Escape" /> | ||||
878 | <DetectChar attribute="Keychar" context="#pop" char="}" /> | ||||
879 | <DetectChar attribute="Separator" char="," /> | ||||
880 | <RegExpr attribute="Normal Text" String="&braceelement;*"/> | ||||
881 | <IncludeRules context="FindStrings" /> | ||||
882 | <IncludeRules context="FindVarExpansion" /> | ||||
883 | <IncludeRules context="FindSubstitutions" /> | ||||
884 | <IncludeRules context="FindBraceExpansion" /> | ||||
885 | <IncludeRules context="FindPaths" /> | ||||
886 | <IncludeRules context="FindEscapes" /> | ||||
887 | <RegExpr attribute="Error" String="."/> | ||||
888 | </context> | ||||
889 | | ||||
890 | <!-- Process Expansion --> | ||||
891 | <context name="FindProcessExpansion" attribute="Normal Text" lineEndContext="#pop"> | ||||
892 | <DetectChar attribute="Keychar" context="ProcessArg" char="%" /> | ||||
893 | </context> | ||||
894 | | ||||
895 | <context name="ProcessArg" attribute="Process" lineEndContext="#pop"> | ||||
896 | <LineContinue attribute="Escape" /> | ||||
897 | <AnyChar context="#pop" String="&white;" /> | ||||
898 | <AnyChar context="#pop" String="&separator;" lookAhead="true" /> | ||||
899 | <DetectChar attribute="Comment" context="Comment" char="#"/> | ||||
900 | <IncludeRules context="FindStrings" /> | ||||
901 | <IncludeRules context="FindVarExpansion" /> | ||||
902 | <IncludeRules context="FindSubstitutions" /> | ||||
903 | <IncludeRules context="FindBraceExpansion" /> | ||||
904 | <IncludeRules context="FindEscapes" /> | ||||
905 | </context> | ||||
906 | | ||||
907 | <!-- FindPaths for parts which might be a path. Uses the matching of a / as heuristic --> | ||||
908 | <!-- Might be fooled with quotes --> | ||||
909 | <context name="FindPaths" attribute="Path" lineEndContext="#stay"> | ||||
910 | <RegExpr context="DirectPath" String="&pathdetect;" lookAhead="true" /> | ||||
911 | </context> | ||||
912 | | ||||
913 | <!-- DirectPath is used at places where the next part is definitely a path --> | ||||
914 | <context name="DirectPath" attribute="Path" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop!PathHead" > | ||||
915 | <LineContinue attribute="Escape" /> | ||||
916 | <DetectSpaces attribute="Normal Text" /> | ||||
917 | <AnyChar attribute="Error" context="#pop" String="#&commandsep;<>^" /> | ||||
918 | </context> | ||||
919 | | ||||
920 | <context name="PathHead" attribute="Path" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop!Path" > | ||||
921 | <LineContinue attribute="Escape" /> | ||||
922 | <RegExpr attribute="HomeDir" context="#pop" String="&homedir;&white_or_eol;" /> | ||||
923 | <RegExpr attribute="HomeDir" context="#pop!Path" String="&homedir;" /> | ||||
924 | </context> | ||||
925 | | ||||
926 | <context name="Path" attribute="Path" lineEndContext="#pop"> | ||||
927 | <LineContinue attribute="Escape" /> | ||||
928 | <DetectSpaces context="#pop" lookAhead="true" /> | ||||
929 | <AnyChar context="#pop" String="#&commandsep;<>^)" lookAhead="true" /> | ||||
930 | <AnyChar attribute="Glob" String="*?" /> | ||||
931 | <DetectChar attribute="Path" char="/" /> | ||||
932 | <DetectChar attribute="Keychar" context="PathBrace" char="{" /> | ||||
933 | <DetectChar attribute="Error" context="#pop" char="}" /> | ||||
934 | <IncludeRules context="FindStrings" /> | ||||
935 | <IncludeRules context="FindVarExpansion" /> | ||||
936 | <IncludeRules context="FindSubstitutions" /> | ||||
937 | <IncludeRules context="FindEscapes" /> | ||||
938 | <RegExpr attribute="Path" String="[^$\*\?\\{}&separator;/]*" /> <!--consume everything until next special--> | ||||
939 | </context> | ||||
940 | | ||||
941 | <context name="PathBrace" attribute="Path" lineEndContext="#pop"> | ||||
942 | <LineContinue attribute="Escape" /> | ||||
943 | <DetectChar attribute="Keychar" context="#pop" char="}" /> | ||||
944 | <DetectChar attribute="Separator" char="," /> | ||||
945 | <AnyChar attribute="Error" String=" #&commandsep;<>^)" /> | ||||
946 | <AnyChar attribute="Glob" String="*?" /> | ||||
947 | <DetectChar attribute="Path" char="/" /> | ||||
948 | <DetectChar attribute="Keychar" context="PathBrace" char="{" /> | ||||
949 | <IncludeRules context="FindStrings" /> | ||||
950 | <IncludeRules context="FindVarExpansion" /> | ||||
951 | <IncludeRules context="FindSubstitutions" /> | ||||
952 | <IncludeRules context="FindEscapes" /> | ||||
953 | <RegExpr attribute="Path" String="[^$\*\?\\,{}&separator;/]*" /> | ||||
954 | </context> | ||||
955 | | ||||
956 | <!-- FindEscapes contains various rules to mark different shell input --> | ||||
957 | <context name="FindEscapes" attribute="Normal Text" lineEndContext="#stay"> | ||||
958 | <RegExpr attribute="Escape" String="\\&escapechars;" /> | ||||
959 | <RegExpr attribute="Escape" String="\\([0-7]{1,3}|[xX][A-Fa-f0-9]{1,2}|u[A-Fa-f0-9]{1,4}|U[A-Fa-f0-9]{1,8}|c.)" /> | ||||
960 | </context> | ||||
961 | | ||||
962 | </contexts> | ||||
963 | | ||||
964 | <itemDatas> | ||||
965 | <itemData name="Normal Text" defStyleNum="dsNormal" /> | ||||
966 | <itemData name="Path" defStyleNum="dsNormal" /> | ||||
967 | <itemData name="Option" defStyleNum="dsNormal" /> | ||||
968 | <itemData name="Escape" defStyleNum="dsKeyword" /> | ||||
969 | <itemData name="Separator" defStyleNum="dsKeyword" /> | ||||
970 | <itemData name="Glob" defStyleNum="dsKeyword" /> | ||||
971 | <itemData name="HomeDir" defStyleNum="dsKeyword" /> | ||||
972 | <itemData name="Keychar" defStyleNum="dsSpecialChar" /> | ||||
973 | <itemData name="Command" defStyleNum="dsFunction" /> | ||||
974 | <itemData name="UnixCommand" defStyleNum="dsFunction" /> | ||||
975 | <itemData name="CommandPath" defStyleNum="dsExtension" /> | ||||
976 | <itemData name="Variable" defStyleNum="dsVariable" /> | ||||
977 | <itemData name="Control Flow" defStyleNum="dsControlFlow" /> | ||||
978 | <itemData name="Operator" defStyleNum="dsOperator" /> | ||||
979 | <itemData name="Redirection" defStyleNum="dsOperator" /> | ||||
980 | <itemData name="Builtin" defStyleNum="dsBuiltIn" /> | ||||
981 | <itemData name="Index" defStyleNum="dsAttribute" /> | ||||
982 | | ||||
983 | <itemData name="String SingleQ" defStyleNum="dsString" /> | ||||
984 | <itemData name="String DoubleQ" defStyleNum="dsString" /> | ||||
985 | <itemData name="Process" defStyleNum="dsImport" /> | ||||
986 | | ||||
987 | | ||||
988 | <itemData name="Comment" defStyleNum="dsComment" /> | ||||
989 | <itemData name="Function Doc" defStyleNum="dsDocumentation" /> | ||||
990 | | ||||
991 | <itemData name="Error" defStyleNum="dsError" /> | ||||
992 | </itemDatas> | ||||
993 | </highlighting> | ||||
994 | <general> | ||||
995 | <!-- no / as weakDeliminator, otherwwise in /usr/bin/ls ls is not recognized as UnixCommand --> | ||||
996 | <keywords casesensitive="1" weakDeliminator="\+,-:=!.@#%^_`~" wordWrapDeliminator="&separator;"/> | ||||
997 | <comments> | ||||
998 | <comment name="singleLine" start="#"/> | ||||
999 | </comments> | ||||
1000 | </general> | ||||
1001 | </language> |