2 /*************************************************************************************
5 * Author: Andreas Gohr (andi@splitbrain.org)
6 * Copyright: (c) 2004 Andreas Gohr, Nigel McNie (http://qbnz.com/highlighter)
7 * Release Version: 1.0.8.4
8 * Date Started: 2004/08/20
10 * BASH language file for GeSHi.
15 * - Added loads of keywords and commands of GNU/Linux
16 * - Added support for parameters starting with a dash
17 * 2008/05/23 (1.0.7.22)
18 * - Added description of extra language features (SF#1970248)
19 * 2007/09/05 (1.0.7.21)
20 * - PARSER_CONTROL patch using SF #1788408 (BenBE)
21 * 2007/06/11 (1.0.7.20)
22 * - Added a lot of keywords (BenBE / Jan G)
24 * - Added support for multiple object splitters
26 * - Added support for URLs
30 * TODO (updated 2004/11/27)
31 * -------------------------
32 * * Get symbols working
33 * * Highlight builtin vars
35 *************************************************************************************
37 * This file is part of GeSHi.
39 * GeSHi is free software; you can redistribute it and/or modify
40 * it under the terms of the GNU General Public License as published by
41 * the Free Software Foundation; either version 2 of the License, or
42 * (at your option) any later version.
44 * GeSHi is distributed in the hope that it will be useful,
45 * but WITHOUT ANY WARRANTY; without even the implied warranty of
46 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
47 * GNU General Public License for more details.
49 * You should have received a copy of the GNU General Public License
50 * along with GeSHi; if not, write to the Free Software
51 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
53 ************************************************************************************/
55 $language_data = array (
56 'LANG_NAME' => 'Bash',
57 // Bash DOES have single line comments with # markers. But bash also has
58 // the $# variable, so comments need special handling (see sf.net
60 'COMMENT_SINGLE' => array('#'),
61 'COMMENT_MULTI' => array(),
62 'COMMENT_REGEXP' => array(
64 1 => "/\\$\\{[^\\n\\}]*?\\}/i",
66 2 => '/<<-?\s*?(\'?)([a-zA-Z0-9]+)\1\\n.*\\n\\2(?![a-zA-Z0-9])/siU',
67 //Escaped String Starters
70 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE
,
71 'QUOTEMARKS' => array('"'),
72 'HARDQUOTE' => array("'", "'"),
73 'HARDESCAPE' => array("\'"),
75 'ESCAPE_REGEXP' => array(
76 //Simple Single Char Escapes
77 1 => "#\\\\[nfrtv\\$\\\"\n]#i",
79 2 => "#\\$[a-z_][a-z0-9_]*#i",
81 3 => "/\\$\\{[^\\n\\}]*?\\}/i",
83 4 => "/\\$\\([^\\n\\)]*?\\)/i",
89 'case', 'do', 'done', 'elif', 'else', 'esac', 'fi', 'for', 'function',
90 'if', 'in', 'select', 'set', 'then', 'until', 'while', 'time'
93 'aclocal', 'aconnect', 'aplay', 'apm', 'apmsleep', 'apropos',
94 'apt-cache', 'apt-get', 'apt-key', 'aptitude',
95 'ar', 'arch', 'arecord', 'as', 'as86', 'ash', 'autoconf',
96 'autoheader', 'automake', 'awk',
98 'basename', 'bash', 'bc', 'bison', 'bunzip2', 'bzcat',
99 'bzcmp', 'bzdiff', 'bzegrep', 'bzfgrep', 'bzgrep',
100 'bzip2', 'bzip2recover', 'bzless', 'bzmore',
102 'c++', 'cal', 'cat', 'chattr', 'cc', 'cdda2wav', 'cdparanoia',
103 'cdrdao', 'cd-read', 'cdrecord', 'chfn', 'chgrp', 'chmod',
104 'chown', 'chroot', 'chsh', 'chvt', 'clear', 'cmp', 'comm', 'co',
105 'col', 'cp', 'cpio', 'cpp', 'csh', 'cut', 'cvs', 'cvs-pserver',
107 'dash', 'date', 'dd', 'dc', 'dcop', 'deallocvt', 'df', 'dialog',
108 'diff', 'diff3', 'dir', 'dircolors', 'directomatic', 'dirname',
109 'dmesg', 'dnsdomainname', 'domainname', 'dpkg', 'dselect', 'du',
112 'ed', 'egrep', 'env', 'expr',
114 'false', 'fbset', 'ffmpeg', 'fgconsole','fgrep', 'file', 'find',
115 'flex', 'flex++', 'fmt', 'free', 'ftp', 'funzip', 'fuser',
117 'g++', 'gawk', 'gc','gcc', 'gdb', 'getent', 'getkeycodes',
118 'getopt', 'gettext', 'gettextize', 'gimp', 'gimp-remote',
119 'gimptool', 'gmake', 'gocr', 'grep', 'groups', 'gs', 'gunzip',
122 'head', 'hexdump', 'hostname',
124 'id', 'ifconfig', 'igawk', 'install',
128 'kbd_mode','kbdrate', 'kdialog', 'kfile', 'kill', 'killall',
130 'lame', 'last', 'lastb', 'ld', 'ld86', 'ldd', 'less', 'lex', 'link',
131 'ln', 'loadkeys', 'loadunimap', 'locate', 'lockfile', 'login',
132 'logname', 'lp', 'lpr', 'ls', 'lsattr', 'lsmod', 'lsmod.old',
133 'lspci', 'ltrace', 'lynx',
135 'm4', 'make', 'man', 'mapscrn', 'mesg', 'mkdir', 'mkfifo',
136 'mknod', 'mktemp', 'more', 'mount', 'mplayer', 'msgfmt', 'mv',
138 'namei', 'nano', 'nasm', 'nawk', 'netstat', 'nice',
139 'nisdomainname', 'nl', 'nm', 'nm86', 'nmap', 'nohup', 'nop',
143 'passwd', 'patch', 'pcregrep', 'pcretest', 'perl', 'perror',
144 'pgawk', 'pidof', 'ping', 'pr', 'procmail', 'prune', 'ps', 'pstree',
145 'ps2ascii', 'ps2epsi', 'ps2frag', 'ps2pdf', 'ps2ps', 'psbook',
146 'psmerge', 'psnup', 'psresize', 'psselect', 'pstops',
148 'rbash', 'rcs', 'rcs2log', 'read', 'readlink', 'red', 'resizecons',
149 'rev', 'rm', 'rmdir', 'rsh', 'run-parts',
151 'sash', 'scp', 'screen', 'sed', 'seq', 'sendmail', 'setfont',
152 'setkeycodes', 'setleds', 'setmetamode', 'setserial', 'setterm',
153 'sh', 'showkey', 'shred', 'size', 'size86', 'skill', 'sleep',
154 'slogin', 'snice', 'sort', 'sox', 'split', 'ssed', 'ssh', 'ssh-add',
155 'ssh-agent', 'ssh-keygen', 'ssh-keyscan', 'stat', 'strace',
156 'strings', 'strip', 'stty', 'su', 'sudo', 'suidperl', 'sum', 'svn',
157 'svnadmin', 'svndumpfilter', 'svnlook', 'svnmerge', 'svnmucc',
158 'svnserve', 'svnshell', 'svnsync', 'svnversion', 'svnwrap', 'sync',
160 'tac', 'tail', 'tar', 'tee', 'tempfile', 'touch', 'tr', 'tree',
163 'umount', 'uname', 'unicode_start', 'unicode_stop', 'uniq',
164 'unlink', 'unzip', 'updatedb', 'updmap', 'uptime', 'users',
165 'utmpdump', 'uuidgen',
167 'valgrind', 'vdir', 'vi', 'vim', 'vmstat',
169 'w', 'wall', 'wc', 'wget', 'whatis', 'whereis', 'which', 'whiptail',
170 'who', 'whoami', 'write',
172 'xargs', 'xhost', 'xmodmap', 'xset',
174 'yacc', 'yes', 'ypdomainname',
176 'zcat', 'zcmp', 'zdiff', 'zdump', 'zegrep', 'zfgrep', 'zforce',
177 'zgrep', 'zip', 'zipgrep', 'zipinfo', 'zless', 'zmore', 'znew',
181 'alias', 'bg', 'bind', 'break', 'builtin', 'cd', 'command',
182 'compgen', 'complete', 'continue', 'declare', 'dirs', 'disown',
183 'echo', 'enable', 'eval', 'exec', 'exit', 'export', 'fc',
184 'fg', 'getopts', 'hash', 'help', 'history', 'jobs', 'let',
185 'local', 'logout', 'popd', 'printf', 'pushd', 'pwd', 'readonly',
186 'return', 'shift', 'shopt', 'source', 'suspend', 'test', 'times',
187 'trap', 'type', 'typeset', 'ulimit', 'umask', 'unalias', 'unset',
192 '(', ')', '[', ']', '!', '@', '%', '&', '*', '|', '/', '<', '>', ';;', '`'
194 'CASE_SENSITIVE' => array(
195 GESHI_COMMENTS
=> false,
202 1 => 'color: #000000; font-weight: bold;',
203 2 => 'color: #c20cb9; font-weight: bold;',
204 3 => 'color: #7a0874; font-weight: bold;'
207 0 => 'color: #666666; font-style: italic;',
208 1 => 'color: #800000;',
209 2 => 'color: #cc0000; font-style: italic;',
210 3 => 'color: #000000; font-weight: bold;'
212 'ESCAPE_CHAR' => array(
213 1 => 'color: #000099; font-weight: bold;',
214 2 => 'color: #007800;',
215 3 => 'color: #007800;',
216 4 => 'color: #007800;',
217 5 => 'color: #780078;',
218 'HARD' => 'color: #000099; font-weight: bold;'
221 0 => 'color: #7a0874; font-weight: bold;'
224 0 => 'color: #ff0000;',
225 'HARD' => 'color: #ff0000;'
228 0 => 'color: #000000;'
233 0 => 'color: #000000; font-weight: bold;'
236 0 => 'color: #007800;',
237 1 => 'color: #007800;',
238 2 => 'color: #007800;',
239 4 => 'color: #007800;',
240 5 => 'color: #660033;'
251 'OBJECT_SPLITTERS' => array(
254 //Variables (will be handled by comment_regexps)
255 0 => "\\$\\{[a-zA-Z_][a-zA-Z0-9_]*?\\}",
256 //Variables without braces
257 1 => "\\$[a-zA-Z_][a-zA-Z0-9_]*",
258 //Variable assignment
259 2 => "(?<![\.a-zA-Z_\-])([a-zA-Z_][a-zA-Z0-9_]*?)(?==)",
260 //Shorthand shell variables
261 4 => "\\$[*#\$\\-\\?!]",
262 //Parameters of commands
263 5 => "(?<=\s)--?[0-9a-zA-Z\-]+(?=[\s=]|$)"
265 'STRICT_MODE_APPLIES' => GESHI_NEVER
,
266 'SCRIPT_DELIMITERS' => array(
268 'HIGHLIGHT_STRICT_BLOCK' => array(
271 'PARSER_CONTROL' => array(
273 'DISALLOWED_BEFORE' => '$'
276 'DISALLOWED_BEFORE' => "(?<![\.\-a-zA-Z0-9_\$\#])",
277 'DISALLOWED_AFTER' => "(?![\.\-a-zA-Z0-9_%\\/])"