PageRenderTime 47ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/vendor/geshi/geshi/bash.php

https://github.com/digitarald/redracer
PHP | 259 lines | 171 code | 26 blank | 62 comment | 0 complexity | d4fe149b80bb99d6ed0295a773118771 MD5 | raw file
Possible License(s): GPL-3.0, LGPL-2.1, GPL-2.0, BSD-3-Clause, Apache-2.0
  1. <?php
  2. /*************************************************************************************
  3. * bash.php
  4. * --------
  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
  8. * Date Started: 2004/08/20
  9. *
  10. * BASH language file for GeSHi.
  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. $language_data = array (
  55. 'LANG_NAME' => 'Bash',
  56. // Bash DOES have single line comments with # markers. But bash also has
  57. // the $# variable, so comments need special handling (see sf.net
  58. // 1564839)
  59. 'COMMENT_SINGLE' => array('#'),
  60. 'COMMENT_MULTI' => array(),
  61. 'COMMENT_REGEXP' => array(
  62. //Variables
  63. 1 => "/\\$\\{[^\\n\\}]*?\\}/i",
  64. //BASH-style Heredoc
  65. 2 => '/<<-?\s*?([\'"]?)([a-zA-Z0-9]+)\1;[^\n]*?\\n.*\\n\\2(?![a-zA-Z0-9])/siU'
  66. ),
  67. 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE,
  68. 'QUOTEMARKS' => array("'", '"'),
  69. 'ESCAPE_CHAR' => '\\',
  70. 'KEYWORDS' => array(
  71. 1 => array(
  72. 'case', 'do', 'done', 'elif', 'else', 'esac', 'fi', 'for', 'function',
  73. 'if', 'in', 'select', 'set', 'then', 'until', 'while', 'time'
  74. ),
  75. 2 => array(
  76. 'aclocal', 'aconnect', 'aplay', 'apm', 'apmsleep', 'apropos',
  77. 'apt-cache', 'apt-get', 'apt-key', 'aptitude',
  78. 'ar', 'arch', 'arecord', 'as', 'as86', 'ash', 'autoconf',
  79. 'autoheader', 'automake', 'awk',
  80. 'basename', 'bash', 'bc', 'bison', 'bunzip2', 'bzcat',
  81. 'bzcmp', 'bzdiff', 'bzegrep', 'bzfgrep', 'bzgrep',
  82. 'bzip2', 'bzip2recover', 'bzless', 'bzmore',
  83. 'c++', 'cal', 'cat', 'chattr', 'cc', 'cdda2wav', 'cdparanoia',
  84. 'cdrdao', 'cd-read', 'cdrecord', 'chfn', 'chgrp', 'chmod',
  85. 'chown', 'chroot', 'chsh', 'chvt', 'clear', 'cmp', 'comm', 'co',
  86. 'col', 'cp', 'cpio', 'cpp', 'csh', 'cut', 'cvs', 'cvs-pserver',
  87. 'dash', 'date', 'dd', 'dc', 'dcop', 'deallocvt', 'df', 'dialog',
  88. 'diff', 'diff3', 'dir', 'dircolors', 'directomatic', 'dirname',
  89. 'dmesg', 'dnsdomainname', 'domainname', 'dpkg', 'dselect', 'du',
  90. 'dumpkeys',
  91. 'ed', 'egrep', 'env', 'expr',
  92. 'false', 'fbset', 'ffmpeg', 'fgconsole','fgrep', 'file', 'find',
  93. 'flex', 'flex++', 'fmt', 'free', 'ftp', 'funzip', 'fuser',
  94. 'g++', 'gawk', 'gc','gcc', 'gdb', 'getent', 'getkeycodes',
  95. 'getopt', 'gettext', 'gettextize', 'gimp', 'gimp-remote',
  96. 'gimptool', 'gmake', 'gocr', 'grep', 'groups', 'gs', 'gunzip',
  97. 'gzexe', 'gzip',
  98. 'head', 'hexdump', 'hostname',
  99. 'id', 'ifconfig', 'igawk', 'install',
  100. 'join',
  101. 'kbd_mode','kbdrate', 'kdialog', 'kfile', 'kill', 'killall',
  102. 'lame', 'last', 'lastb', 'ld', 'ld86', 'ldd', 'less', 'lex', 'link',
  103. 'ln', 'loadkeys', 'loadunimap', 'locate', 'lockfile', 'login',
  104. 'logname', 'lp', 'lpr', 'ls', 'lsattr', 'lsmod', 'lsmod.old',
  105. 'lspci', 'ltrace', 'lynx',
  106. 'm4', 'make', 'man', 'mapscrn', 'mesg', 'mkdir', 'mkfifo',
  107. 'mknod', 'mktemp', 'more', 'mount', 'mplayer', 'msgfmt', 'mv',
  108. 'namei', 'nano', 'nasm', 'nawk', 'netstat', 'nice',
  109. 'nisdomainname', 'nl', 'nm', 'nm86', 'nmap', 'nohup', 'nop',
  110. 'od', 'openvt',
  111. 'passwd', 'patch', 'pcregrep', 'pcretest', 'perl', 'perror',
  112. 'pgawk', 'pidof', 'ping', 'pr', 'procmail', 'prune', 'ps', 'pstree',
  113. 'ps2ascii', 'ps2epsi', 'ps2frag', 'ps2pdf', 'ps2ps', 'psbook',
  114. 'psmerge', 'psnup', 'psresize', 'psselect', 'pstops',
  115. 'rbash', 'rcs', 'rcs2log', 'read', 'readlink', 'red', 'resizecons',
  116. 'rev', 'rm', 'rmdir', 'rsh', 'run-parts',
  117. 'sash', 'scp', 'screen', 'sed', 'seq', 'sendmail', 'setfont',
  118. 'setkeycodes', 'setleds', 'setmetamode', 'setserial', 'setterm',
  119. 'sh', 'showkey', 'shred', 'size', 'size86', 'skill', 'sleep',
  120. 'slogin', 'snice', 'sort', 'sox', 'split', 'ssed', 'ssh', 'ssh-add',
  121. 'ssh-agent', 'ssh-keygen', 'ssh-keyscan', 'stat', 'strace',
  122. 'strings', 'strip', 'stty', 'su', 'sudo', 'suidperl', 'sum', 'svn',
  123. 'svnadmin', 'svndumpfilter', 'svnlook', 'svnmerge', 'svnmucc',
  124. 'svnserve', 'svnshell', 'svnsync', 'svnversion', 'svnwrap', 'sync',
  125. 'tac', 'tail', 'tar', 'tee', 'tempfile', 'touch', 'tr', 'tree',
  126. 'true',
  127. 'umount', 'uname', 'unicode_start', 'unicode_stop', 'uniq',
  128. 'unlink', 'unzip', 'updatedb', 'updmap', 'uptime', 'users',
  129. 'utmpdump', 'uuidgen',
  130. 'valgrind', 'vdir', 'vi', 'vim', 'vmstat',
  131. 'w', 'wall', 'wc', 'wget', 'whatis', 'whereis', 'which', 'whiptail',
  132. 'who', 'whoami', 'write',
  133. 'xargs', 'xhost', 'xmodmap', 'xset',
  134. 'yacc', 'yes', 'ypdomainname',
  135. 'zcat', 'zcmp', 'zdiff', 'zdump', 'zegrep', 'zfgrep', 'zforce',
  136. 'zgrep', 'zip', 'zipgrep', 'zipinfo', 'zless', 'zmore', 'znew',
  137. 'zsh', 'zsoelim'
  138. ),
  139. 3 => array(
  140. 'alias', 'bg', 'bind', 'break', 'builtin', 'cd', 'command',
  141. 'compgen', 'complete', 'continue', 'declare', 'dirs', 'disown',
  142. 'echo', 'enable', 'eval', 'exec', 'exit', 'export', 'fc',
  143. 'fg', 'getopts', 'hash', 'help', 'history', 'jobs', 'let',
  144. 'local', 'logout', 'popd', 'printf', 'pushd', 'pwd', 'readonly',
  145. 'return', 'shift', 'shopt', 'source', 'suspend', 'test', 'times',
  146. 'trap', 'type', 'typeset', 'ulimit', 'umask', 'unalias', 'unset',
  147. 'wait'
  148. )
  149. ),
  150. 'SYMBOLS' => array(
  151. '(', ')', '[', ']', '!', '@', '%', '&', '*', '|', '/', '<', '>', ';;', '`'
  152. ),
  153. 'CASE_SENSITIVE' => array(
  154. GESHI_COMMENTS => false,
  155. 1 => true,
  156. 2 => true,
  157. 3 => true
  158. ),
  159. 'STYLES' => array(
  160. 'KEYWORDS' => array(
  161. 1 => 'color: #000000; font-weight: bold;',
  162. 2 => 'color: #c20cb9; font-weight: bold;',
  163. 3 => 'color: #7a0874; font-weight: bold;'
  164. ),
  165. 'COMMENTS' => array(
  166. 0 => 'color: #666666; font-style: italic;',
  167. 1 => 'color: #800000;',
  168. 2 => 'color: #cc0000; font-style: italic;'
  169. ),
  170. 'ESCAPE_CHAR' => array(
  171. 0 => 'color: #000099; font-weight: bold;'
  172. ),
  173. 'BRACKETS' => array(
  174. 0 => 'color: #7a0874; font-weight: bold;'
  175. ),
  176. 'STRINGS' => array(
  177. 0 => 'color: #ff0000;'
  178. ),
  179. 'NUMBERS' => array(
  180. 0 => 'color: #000000;'
  181. ),
  182. 'METHODS' => array(
  183. ),
  184. 'SYMBOLS' => array(
  185. 0 => 'color: #000000; font-weight: bold;'
  186. ),
  187. 'REGEXPS' => array(
  188. 0 => 'color: #007800;',
  189. 1 => 'color: #007800;',
  190. 2 => 'color: #007800;',
  191. 4 => 'color: #007800;',
  192. 5 => 'color: #660033;'
  193. ),
  194. 'SCRIPT' => array(
  195. )
  196. ),
  197. 'URLS' => array(
  198. 1 => '',
  199. 2 => '',
  200. 3 => ''
  201. ),
  202. 'OOLANG' => false,
  203. 'OBJECT_SPLITTERS' => array(
  204. ),
  205. 'REGEXPS' => array(
  206. //Variables (will be handled by comment_regexps)
  207. 0 => "\\$\\{[a-zA-Z_][a-zA-Z0-9_]*?\\}",
  208. //Variables without braces
  209. 1 => "\\$[a-zA-Z_][a-zA-Z0-9_]*",
  210. //Variable assignment
  211. 2 => "(?<![\.a-zA-Z_\-])([a-zA-Z_][a-zA-Z0-9_]*?)(?==)",
  212. //Shorthand shell variables
  213. 4 => "\\$[*#\$\\-\\?!]",
  214. //Parameters of commands
  215. 5 => "(?<=\s)--?[0-9a-zA-Z\-]+(?=[\s=]|$)"
  216. ),
  217. 'STRICT_MODE_APPLIES' => GESHI_NEVER,
  218. 'SCRIPT_DELIMITERS' => array(
  219. ),
  220. 'HIGHLIGHT_STRICT_BLOCK' => array(
  221. ),
  222. 'TAB_WIDTH' => 4,
  223. 'PARSER_CONTROL' => array(
  224. 'COMMENTS' => array(
  225. 'DISALLOWED_BEFORE' => '$'
  226. ),
  227. 'KEYWORDS' => array(
  228. 'DISALLOWED_BEFORE' => "(?<![\.\-a-zA-Z0-9_\$\#])",
  229. 'DISALLOWED_AFTER' => "(?![\.\-a-zA-Z0-9_%])"
  230. )
  231. )
  232. );
  233. ?>