Dark Tango-Like for Geshi


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <?php
  2. /*************************************************************************************
  3.  * bash.php
  4.  * --------
  5.  * Author: Andreas Gohr ([email protected])
  6.  * Copyright: (c) 2004 Andreas Gohr, Nigel McNie (http://qbnz.com/highlighter)
  7.  * Release Version: 1.0.8.8
  8.  * Date Started: 2004/08/20
  9.  *
  10.  * BASH language file for GeSHi modified by a Newbie.
  11.  *
  12.  * CHANGES
  13.  * -------
  14.  * 2008/06/21 (1.0.8)
  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)
  23.  * 2004/11/27 (1.0.2)
  24.  * - Added support for multiple object splitters
  25.  * 2004/10/27 (1.0.1)
  26.  * - Added support for URLs
  27.  * 2004/08/20 (1.0.0)
  28.  * - First Release
  29.  *
  30.  * TODO (updated 2004/11/27)
  31.  * -------------------------
  32.  * * Get symbols working
  33.  * * Highlight builtin vars
  34.  *
  35.  *************************************************************************************
  36.  *
  37.  * This file is part of GeSHi.
  38.  *
  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.
  43.  *
  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.
  48.  *
  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
  52.  *
  53.  ************************************************************************************/
  54.  
  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
  59. // 1564839)
  60. 'COMMENT_SINGLE' => array('#'),
  61. 'COMMENT_MULTI' => array(),
  62. 'COMMENT_REGEXP' => array(
  63. //Variables
  64. 1 => "/\\$\\{[^\\n\\}]*?\\}/i",
  65. //BASH-style Heredoc
  66. 2 => '/<<-?\s*?(\'?)([a-zA-Z0-9]+)\1\\n.*\\n\\2(?![a-zA-Z0-9])/siU',
  67. //Escaped String Starters
  68. 3 => "/\\\\['\"]/siU"
  69. ),
  70. 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE,
  71. 'QUOTEMARKS' => array('"'),
  72. 'HARDQUOTE' => array("'", "'"),
  73. 'HARDESCAPE' => array("\'"),
  74. 'ESCAPE_CHAR' => '',
  75. 'ESCAPE_REGEXP' => array(
  76. //Simple Single Char Escapes
  77. 1 => "#\\\\[nfrtv\\$\\\"\n]#i",
  78. // $var
  79. 2 => "#\\$[a-z_][a-z0-9_]*#i",
  80. // ${...}
  81. 3 => "/\\$\\{[^\\n\\}]*?\\}/i",
  82. // $(...)
  83. 4 => "/\\$\\([^\\n\\)]*?\\)/i",
  84. // `...`
  85. 5 => "/`[^`]*`/"
  86. ),
  87. 'KEYWORDS' => array(
  88. 1 => array(
  89. 'case', 'do', 'done', 'elif', 'else', 'esac', 'fi', 'for', 'function',
  90. 'if', 'in', 'select', 'set', 'then', 'until', 'while', 'time'
  91. ),
  92. 2 => array(
  93. 'aclocal', 'aconnect', 'aplay', 'apm', 'apmsleep', 'apropos',
  94. 'apt-cache', 'apt-file', 'apt-get', 'apt-key', 'apt-src', 'aptitude',
  95. 'ar', 'arch', 'arecord', 'as', 'as86', 'ash', 'autoconf',
  96. 'autoheader', 'automake', 'awk',
  97.  
  98. 'basename', 'bash', 'bc', 'bison', 'bunzip2', 'bzcat',
  99. 'bzcmp', 'bzdiff', 'bzegrep', 'bzfgrep', 'bzgrep',
  100. 'bzip2', 'bzip2recover', 'bzless', 'bzmore',
  101.  
  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',
  106.  
  107. 'dash', 'date', 'dc', 'dch', 'dcop', 'dd', 'ddate', 'ddd',
  108. 'deallocvt', 'debconf', 'defoma', 'depmod', 'df', 'dh',
  109. 'dialog', 'diff', 'diff3', 'dig', 'dir', 'dircolors', 'directomatic',
  110. 'dirname', 'dmesg', 'dnsdomainname', 'domainname', 'dpkg',
  111. 'dselect', 'du', 'dumpkeys',
  112.  
  113. 'ed', 'egrep', 'env', 'expr',
  114.  
  115. 'false', 'fbset', 'ffmpeg', 'fgconsole','fgrep', 'file', 'find',
  116. 'flex', 'flex++', 'fmt', 'free', 'ftp', 'funzip', 'fuser',
  117.  
  118. 'g++', 'gawk', 'gc','gcc', 'gdb', 'getent', 'getkeycodes',
  119. 'getopt', 'gettext', 'gettextize', 'gimp', 'gimp-remote',
  120. 'gimptool', 'gmake', 'gocr', 'grep', 'groups', 'gs', 'gunzip',
  121. 'gzexe', 'gzip',
  122.  
  123. 'git', 'gitaction', 'git-add', 'git-add--interactive', 'git-am',
  124. 'git-annotate', 'git-apply', 'git-archive', 'git-bisect',
  125. 'git-bisect--helper', 'git-blame', 'git-branch', 'git-bundle',
  126. 'git-cat-file', 'git-check-attr', 'git-checkout',
  127. 'git-checkout-index', 'git-check-ref-format', 'git-cherry',
  128. 'git-cherry-pick', 'git-clean', 'git-clone', 'git-commit',
  129. 'git-commit-tree', 'git-config', 'git-count-objects', 'git-daemon',
  130. 'git-describe', 'git-diff', 'git-diff-files', 'git-diff-index',
  131. 'git-difftool', 'git-difftool--helper', 'git-diff-tree',
  132. 'gitdpkgname', 'git-fast-export', 'git-fast-import', 'git-fetch',
  133. 'git-fetch-pack', 'git-fetch--tool', 'git-filter-branch', 'gitfm',
  134. 'git-fmt-merge-msg', 'git-for-each-ref', 'git-format-patch',
  135. 'git-fsck', 'git-fsck-objects', 'git-gc', 'git-get-tar-commit-id',
  136. 'git-grep', 'git-hash-object', 'git-help', 'git-http-fetch',
  137. 'git-http-push', 'git-imap-send', 'git-index-pack', 'git-init',
  138. 'git-init-db', 'git-instaweb', 'gitkeys', 'git-log',
  139. 'git-lost-found', 'git-ls-files', 'git-ls-remote', 'git-ls-tree',
  140. 'git-mailinfo', 'git-mailsplit', 'git-merge', 'git-merge-base',
  141. 'git-merge-file', 'git-merge-index', 'git-merge-octopus',
  142. 'git-merge-one-file', 'git-merge-ours', 'git-merge-recursive',
  143. 'git-merge-resolve', 'git-merge-subtree', 'git-mergetool',
  144. 'git-mergetool--lib', 'git-merge-tree', 'gitmkdirs', 'git-mktag',
  145. 'git-mktree', 'gitmount', 'git-mv', 'git-name-rev',
  146. 'git-pack-objects', 'git-pack-redundant', 'git-pack-refs',
  147. 'git-parse-remote', 'git-patch-id', 'git-peek-remote', 'git-prune',
  148. 'git-prune-packed', 'gitps', 'git-pull', 'git-push',
  149. 'git-quiltimport', 'git-read-tree', 'git-rebase',
  150. 'git-rebase--interactive', 'git-receive-pack', 'git-reflog',
  151. 'gitregrep', 'git-relink', 'git-remote', 'git-repack',
  152. 'git-repo-config', 'git-request-pull', 'git-rerere', 'git-reset',
  153. 'git-revert', 'git-rev-list', 'git-rev-parse', 'gitrfgrep',
  154. 'gitrgrep', 'git-rm', 'git-send-pack', 'git-shell', 'git-shortlog',
  155. 'git-show', 'git-show-branch', 'git-show-index', 'git-show-ref',
  156. 'git-sh-setup', 'git-stage', 'git-stash', 'git-status',
  157. 'git-stripspace', 'git-submodule', 'git-svn', 'git-symbolic-ref',
  158. 'git-tag', 'git-tar-tree', 'gitunpack', 'git-unpack-file',
  159. 'git-unpack-objects', 'git-update-index', 'git-update-ref',
  160. 'git-update-server-info', 'git-upload-archive', 'git-upload-pack',
  161. 'git-var', 'git-verify-pack', 'git-verify-tag', 'gitview',
  162. 'git-web--browse', 'git-whatchanged', 'gitwhich', 'gitwipe',
  163. 'git-write-tree', 'gitxgrep',
  164.  
  165. 'head', 'hexdump', 'hostname',
  166.  
  167. 'id', 'ifconfig', 'ifdown', 'ifup', 'igawk', 'install',
  168.  
  169. 'join',
  170.  
  171. 'kbd_mode','kbdrate', 'kdialog', 'kfile', 'kill', 'killall',
  172.  
  173. 'lame', 'last', 'lastb', 'ld', 'ld86', 'ldd', 'less', 'lex', 'link',
  174. 'ln', 'loadkeys', 'loadunimap', 'locate', 'lockfile', 'login',
  175. 'logname', 'lp', 'lpr', 'ls', 'lsattr', 'lsmod', 'lsmod.old',
  176. 'lspci', 'ltrace', 'lynx',
  177.  
  178. 'm4', 'make', 'man', 'mapscrn', 'mesg', 'mkdir', 'mkfifo',
  179. 'mknod', 'mktemp', 'more', 'mount', 'mplayer', 'msgfmt', 'mv',
  180.  
  181. 'namei', 'nano', 'nasm', 'nawk', 'netstat', 'nice',
  182. 'nisdomainname', 'nl', 'nm', 'nm86', 'nmap', 'nohup', 'nop',
  183.  
  184. 'od', 'openvt',
  185.  
  186. 'passwd', 'patch', 'pcregrep', 'pcretest', 'perl', 'perror',
  187. 'pgawk', 'pidof', 'ping', 'pr', 'procmail', 'prune', 'ps', 'pstree',
  188. 'ps2ascii', 'ps2epsi', 'ps2frag', 'ps2pdf', 'ps2ps', 'psbook',
  189. 'psmerge', 'psnup', 'psresize', 'psselect', 'pstops',
  190.  
  191. 'rbash', 'rcs', 'rcs2log', 'read', 'readlink', 'red', 'resizecons',
  192. 'rev', 'rm', 'rmdir', 'rsh', 'run-parts',
  193.  
  194. 'sash', 'scp', 'screen', 'sed', 'seq', 'sendmail', 'setfont',
  195. 'setkeycodes', 'setleds', 'setmetamode', 'setserial', 'setterm',
  196. 'sh', 'showkey', 'shred', 'size', 'size86', 'skill', 'sleep',
  197. 'slogin', 'snice', 'sort', 'sox', 'split', 'ssed', 'ssh', 'ssh-add',
  198. 'ssh-agent', 'ssh-keygen', 'ssh-keyscan', 'stat', 'strace',
  199. 'strings', 'strip', 'stty', 'su', 'sudo', 'suidperl', 'sum', 'svn',
  200. 'svnadmin', 'svndumpfilter', 'svnlook', 'svnmerge', 'svnmucc',
  201. 'svnserve', 'svnshell', 'svnsync', 'svnversion', 'svnwrap', 'sync',
  202.  
  203. 'tac', 'tail', 'tar', 'tee', 'tempfile', 'touch', 'tr', 'tree',
  204. 'true',
  205.  
  206. 'umount', 'uname', 'unicode_start', 'unicode_stop', 'uniq',
  207. 'unlink', 'unzip', 'updatedb', 'updmap', 'uptime', 'users',
  208. 'utmpdump', 'uuidgen',
  209.  
  210. 'valgrind', 'vdir', 'vi', 'vim', 'vmstat',
  211.  
  212. 'w', 'wall', 'watch', 'wc', 'wget', 'whatis', 'whereis',
  213. 'which', 'whiptail', 'who', 'whoami', 'whois', 'wine', 'wineboot',
  214. 'winebuild', 'winecfg', 'wineconsole', 'winedbg', 'winedump',
  215. 'winefile', 'wodim', 'write',
  216.  
  217. 'xargs', 'xhost', 'xmodmap', 'xset',
  218.  
  219. 'yacc', 'yes', 'ypdomainname',
  220.  
  221. 'zcat', 'zcmp', 'zdiff', 'zdump', 'zegrep', 'zfgrep', 'zforce',
  222. 'zgrep', 'zip', 'zipgrep', 'zipinfo', 'zless', 'zmore', 'znew',
  223. 'zsh', 'zsoelim'
  224. ),
  225. 3 => array(
  226. 'alias', 'bg', 'bind', 'break', 'builtin', 'cd', 'command',
  227. 'compgen', 'complete', 'continue', 'declare', 'dirs', 'disown',
  228. 'echo', 'enable', 'eval', 'exec', 'exit', 'export', 'fc',
  229. 'fg', 'getopts', 'hash', 'help', 'history', 'jobs', 'let',
  230. 'local', 'logout', 'popd', 'printf', 'pushd', 'pwd', 'readonly',
  231. 'return', 'shift', 'shopt', 'source', 'suspend', 'test', 'times',
  232. 'trap', 'type', 'typeset', 'ulimit', 'umask', 'unalias', 'unset',
  233. 'wait'
  234. )
  235. ),
  236. 'SYMBOLS' => array(
  237. '(', ')', '[', ']', '!', '@', '%', '&', '*', '|', '/', '<', '>', ';;', '`'
  238. ),
  239. 'CASE_SENSITIVE' => array(
  240. GESHI_COMMENTS => false,
  241. 1 => true,
  242. 2 => true,
  243. 3 => true
  244. ),
  245. 'STYLES' => array(
  246. 'KEYWORDS' => array(
  247. 1 => 'color: #fce94f;',
  248. 2 => 'color: #fce94f;',
  249. 3 => 'color: #e92929;'
  250. ),
  251. 'COMMENTS' => array(
  252. 0 => 'color: #33dfe2;',
  253. 1 => 'color: #6c9ecf;',
  254. 2 => 'color: #cc0000;',
  255. 3 => 'color: #000000;'
  256. ),
  257. 'ESCAPE_CHAR' => array(
  258. 1 => 'color: #ad7b9b;',
  259. 2 => 'color: #6c9ecf;',
  260. 3 => 'color: #6c9ecf;',
  261. 4 => 'color: #6c9ecf;',
  262. 5 => 'color: #780078;',
  263. 'HARD' => 'color: #ad7b9b;'
  264. ),
  265. 'BRACKETS' => array(
  266. 0 => 'color: #fce94f;'
  267. ),
  268. 'STRINGS' => array(
  269. 0 => 'color: #ad7b9b;',
  270. 'HARD' => 'color: #ffffff;'
  271. ),
  272. 'NUMBERS' => array(
  273. 0 => 'color: #ad7b9b;'
  274. ),
  275. 'METHODS' => array(
  276. ),
  277. 'SYMBOLS' => array(
  278. 0 => 'color: #fce94f;'
  279. ),
  280. 'REGEXPS' => array(
  281. 0 => 'color: #6c9ecf;',
  282. 1 => 'color: #6c9ecf;',
  283. 2 => 'color: #33dfe2;',
  284. 4 => 'color: #6c9ecf;',
  285. 5 => 'color: #fce94f;'
  286. ),
  287. 'SCRIPT' => array(
  288. )
  289. ),
  290. 'URLS' => array(
  291. 1 => '',
  292. 2 => '',
  293. 3 => ''
  294. ),
  295. 'OOLANG' => false,
  296. 'OBJECT_SPLITTERS' => array(
  297. ),
  298. 'REGEXPS' => array(
  299. //Variables (will be handled by comment_regexps)
  300. 0 => "\\$\\{[a-zA-Z_][a-zA-Z0-9_]*?\\}",
  301. //Variables without braces
  302. 1 => "\\$[a-zA-Z_][a-zA-Z0-9_]*",
  303. //Variable assignment
  304. 2 => "(?<![\.a-zA-Z_\-])([a-zA-Z_][a-zA-Z0-9_]*?)(?==)",
  305. //Shorthand shell variables
  306. 4 => "\\$[*#\$\\-\\?!\d]",
  307. //Parameters of commands
  308. 5 => "(?<=\s)--?[0-9a-zA-Z\-]+(?=[\s=]|<(?:SEMI|PIPE)>|$)"
  309. ),
  310. 'STRICT_MODE_APPLIES' => GESHI_NEVER,
  311. 'SCRIPT_DELIMITERS' => array(
  312. ),
  313. 'HIGHLIGHT_STRICT_BLOCK' => array(
  314. ),
  315. 'TAB_WIDTH' => 4,
  316. 'PARSER_CONTROL' => array(
  317. 'COMMENTS' => array(
  318. 'DISALLOWED_BEFORE' => '$'
  319. ),
  320. 'KEYWORDS' => array(
  321. 'DISALLOWED_BEFORE' => "(?<![\.\-a-zA-Z0-9_\$\#])",
  322. 'DISALLOWED_AFTER' => "(?![\.\-a-zA-Z0-9_%=\\/])"
  323. )
  324. )
  325. );
  326.  
  327. ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.