A tumblelog CMS built on AJAX, PHP and MySQL.

ruby.php 9.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. <?php
  2. /*************************************************************************************
  3. * ruby.php
  4. * --------
  5. * Author: Moises Deniz
  6. * Copyright: (c) 2007 Moises Deniz
  7. * Release Version: 1.0.7.21
  8. * Date Started: 2007/03/21
  9. *
  10. * Ruby language file for GeSHi
  11. *
  12. *************************************************************************************
  13. *
  14. * This file is part of GeSHi.
  15. *
  16. * GeSHi is free software; you can redistribute it and/or modify
  17. * it under the terms of the GNU General Public License as published by
  18. * the Free Software Foundation; either version 2 of the License, or
  19. * (at your option) any later version.
  20. *
  21. * GeSHi is distributed in the hope that it will be useful,
  22. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  23. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  24. * GNU General Public License for more details.
  25. *
  26. * You should have received a copy of the GNU General Public License
  27. * along with GeSHi; if not, write to the Free Software
  28. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  29. *
  30. ************************************************************************************/
  31. $language_data = array (
  32. 'LANG_NAME' => 'Ruby',
  33. 'COMMENT_SINGLE' => array(1 => "#"),
  34. 'COMMENT_MULTI' => array("=begin" => "=end"),
  35. 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE,
  36. 'QUOTEMARKS' => array('"', '`','\''),
  37. 'ESCAPE_CHAR' => '\\',
  38. 'KEYWORDS' => array(
  39. 1 => array(
  40. 'alias', 'and', 'begin', 'break', 'case', 'class',
  41. 'def', 'defined', 'do', 'else', 'elsif', 'end',
  42. 'ensure', 'for', 'if', 'in', 'module', 'while',
  43. 'next', 'not', 'or', 'redo', 'rescue', 'yield',
  44. 'retry', 'super', 'then', 'undef', 'unless',
  45. 'until', 'when', 'BEGIN', 'END', 'include'
  46. ),
  47. 2 => array(
  48. '__FILE__', '__LINE__', 'false', 'nil', 'self', 'true',
  49. 'return'
  50. ),
  51. 3 => array(
  52. 'Array', 'Float', 'Integer', 'String', 'at_exit',
  53. 'autoload', 'binding', 'caller', 'catch', 'chop', 'chop!',
  54. 'chomp', 'chomp!', 'eval', 'exec', 'exit', 'exit!', 'fail',
  55. 'fork', 'format', 'gets', 'global_variables', 'gsub', 'gsub!',
  56. 'iterator?', 'lambda', 'load', 'local_variables', 'loop',
  57. 'open', 'p', 'print', 'printf', 'proc', 'putc', 'puts',
  58. 'raise', 'rand', 'readline', 'readlines', 'require', 'select',
  59. 'sleep', 'split', 'sprintf', 'srand', 'sub', 'sub!', 'syscall',
  60. 'system', 'trace_var', 'trap', 'untrace_var'
  61. ),
  62. 4 => array(
  63. 'Abbrev', 'ArgumentError', 'Base64', 'Benchmark',
  64. 'Benchmark::Tms', 'Bignum', 'Binding', 'CGI', 'CGI::Cookie',
  65. 'CGI::HtmlExtension', 'CGI::QueryExtension',
  66. 'CGI::Session', 'CGI::Session::FileStore',
  67. 'CGI::Session::MemoryStore', 'Class', 'Comparable', 'Complex',
  68. 'ConditionVariable', 'Continuation', 'Data',
  69. 'Date', 'DateTime', 'Delegator', 'Dir', 'EOFError', 'ERB',
  70. 'ERB::Util', 'Enumerable', 'Enumerable::Enumerator', 'Errno',
  71. 'Exception', 'FalseClass', 'File',
  72. 'File::Constants', 'File::Stat', 'FileTest', 'FileUtils',
  73. 'FileUtils::DryRun', 'FileUtils::NoWrite',
  74. 'FileUtils::StreamUtils_', 'FileUtils::Verbose', 'Find',
  75. 'Fixnum', 'FloatDomainError', 'Forwardable', 'GC', 'Generator',
  76. 'Hash', 'IO', 'IOError', 'Iconv', 'Iconv::BrokenLibrary',
  77. 'Iconv::Failure', 'Iconv::IllegalSequence',
  78. 'Iconv::InvalidCharacter', 'Iconv::InvalidEncoding',
  79. 'Iconv::OutOfRange', 'IndexError', 'Interrupt', 'Kernel',
  80. 'LoadError', 'LocalJumpError', 'Logger', 'Logger::Application',
  81. 'Logger::Error', 'Logger::Formatter', 'Logger::LogDevice',
  82. 'Logger::LogDevice::LogDeviceMutex', 'Logger::Severity',
  83. 'Logger::ShiftingError', 'Marshal', 'MatchData',
  84. 'Math', 'Matrix', 'Method', 'Module', 'Mutex', 'NameError',
  85. 'NameError::message', 'NilClass', 'NoMemoryError',
  86. 'NoMethodError', 'NotImplementedError', 'Numeric', 'Object',
  87. 'ObjectSpace', 'Observable', 'PStore', 'PStore::Error',
  88. 'Pathname', 'Precision', 'Proc', 'Process', 'Process::GID',
  89. 'Process::Status', 'Process::Sys', 'Process::UID', 'Queue',
  90. 'Range', 'RangeError', 'Rational', 'Regexp', 'RegexpError',
  91. 'RuntimeError', 'ScriptError', 'SecurityError', 'Set',
  92. 'Shellwords', 'Signal', 'SignalException', 'SimpleDelegator',
  93. 'SingleForwardable', 'Singleton', 'SingletonClassMethods',
  94. 'SizedQueue', 'SortedSet', 'StandardError', 'StringIO',
  95. 'StringScanner', 'StringScanner::Error', 'Struct', 'Symbol',
  96. 'SyncEnumerator', 'SyntaxError', 'SystemCallError',
  97. 'SystemExit', 'SystemStackError', 'Tempfile',
  98. 'Test::Unit::TestCase', 'Test::Unit', 'Test', 'Thread',
  99. 'ThreadError', 'ThreadGroup',
  100. 'ThreadsWait', 'Time', 'TrueClass', 'TypeError', 'URI',
  101. 'URI::BadURIError', 'URI::Error', 'URI::Escape', 'URI::FTP',
  102. 'URI::Generic', 'URI::HTTP', 'URI::HTTPS',
  103. 'URI::InvalidComponentError', 'URI::InvalidURIError',
  104. 'URI::LDAP', 'URI::MailTo', 'URI::REGEXP',
  105. 'URI::REGEXP::PATTERN', 'UnboundMethod', 'Vector', 'YAML',
  106. 'ZeroDivisionError', 'Zlib',
  107. 'Zlib::BufError', 'Zlib::DataError', 'Zlib::Deflate',
  108. 'Zlib::Error', 'Zlib::GzipFile', 'Zlib::GzipFile::CRCError',
  109. 'Zlib::GzipFile::Error', 'Zlib::GzipFile::LengthError',
  110. 'Zlib::GzipFile::NoFooter', 'Zlib::GzipReader',
  111. 'Zlib::GzipWriter', 'Zlib::Inflate', 'Zlib::MemError',
  112. 'Zlib::NeedDict', 'Zlib::StreamEnd', 'Zlib::StreamError',
  113. 'Zlib::VersionError',
  114. 'Zlib::ZStream',
  115. 'Enumerable',
  116. 'HTML::Selector', 'HashWithIndifferentAccess', 'Inflector',
  117. 'Inflector::Inflections', 'Mime', 'Mime::Type',
  118. 'OCI8AutoRecover', 'Symbol', 'TimeZone', 'XmlSimple'
  119. ),
  120. ),
  121. 'SYMBOLS' => array(
  122. '(', ')', '[', ']', '{', '}', '%', '&', '*', '|', '/', '<', '>',
  123. '+', '-', '=&gt;', '=>', '<<'
  124. ),
  125. 'CASE_SENSITIVE' => array(
  126. GESHI_COMMENTS => false,
  127. 1 => false,
  128. 2 => false,
  129. 3 => false,
  130. 4 => true,
  131. ),
  132. 'STYLES' => array(
  133. 'KEYWORDS' => array(
  134. 1 => 'color:#9966CC; font-weight:bold;',
  135. 2 => 'color:#0000FF; font-weight:bold;',
  136. 3 => 'color:#CC0066; font-weight:bold;',
  137. 4 => 'color:#CC00FF; font-weight:bold;',
  138. ),
  139. 'COMMENTS' => array(
  140. 1 => 'color:#008000; font-style:italic;',
  141. 'MULTI' => 'color:#000080; font-style:italic;'
  142. ),
  143. 'ESCAPE_CHAR' => array(
  144. 0 => 'color:#000099;'
  145. ),
  146. 'BRACKETS' => array(
  147. 0 => 'color:#006600; font-weight:bold;'
  148. ),
  149. 'STRINGS' => array(
  150. 0 => 'color:#996600;'
  151. ),
  152. 'NUMBERS' => array(
  153. 0 => 'color:#006666;'
  154. ),
  155. 'METHODS' => array(
  156. 1 => 'color:#9900CC;'
  157. ),
  158. 'SYMBOLS' => array(
  159. 0 => 'color:#006600; font-weight:bold;'
  160. ),
  161. 'REGEXPS' => array(
  162. 0 => 'color:#ff6633; font-weight:bold;',
  163. 1 => 'color:#0066ff; font-weight:bold;',
  164. 2 => 'color:#6666ff; font-weight:bold;',
  165. 3 => 'color:#ff3333; font-weight:bold;'
  166. ),
  167. 'SCRIPT' => array(
  168. 0 => '',
  169. 1 => '',
  170. 2 => '',
  171. )
  172. ),
  173. 'URLS' => array(
  174. 1 => '',
  175. 2 => '',
  176. 3 => ''
  177. ),
  178. 'OOLANG' => true,
  179. 'OBJECT_SPLITTERS' => array(
  180. 1 => '.'
  181. ),
  182. 'REGEXPS' => array(
  183. 0 => array(
  184. GESHI_SEARCH => "([[:space:]])(\\$[a-zA-Z_][a-zA-Z0-9_]*)",
  185. GESHI_REPLACE => '\\2',
  186. GESHI_MODIFIERS => '',
  187. GESHI_BEFORE => '\\1',
  188. GESHI_AFTER => ''
  189. ),
  190. 1 => array(
  191. GESHI_SEARCH => "([[:space:]])(@[a-zA-Z_][a-zA-Z0-9_]*)",
  192. GESHI_REPLACE => '\\2',
  193. GESHI_MODIFIERS => '',
  194. GESHI_BEFORE => '\\1',
  195. GESHI_AFTER => ''
  196. ),
  197. 2 => "([A-Z][a-zA-Z0-9_]*::)+[A-Z][a-zA-Z0-9_]*",
  198. 3 => array(
  199. GESHI_SEARCH => "([[:space:]]|\[|\()(:[a-zA-Z_][a-zA-Z0-9_]*)",
  200. GESHI_REPLACE => '\\2',
  201. GESHI_MODIFIERS => '',
  202. GESHI_BEFORE => '\\1',
  203. GESHI_AFTER => ''
  204. )
  205. ),
  206. 'STRICT_MODE_APPLIES' => GESHI_MAYBE,
  207. 'SCRIPT_DELIMITERS' => array(
  208. 0 => array(
  209. '<%' => '%>'
  210. )
  211. ),
  212. 'HIGHLIGHT_STRICT_BLOCK' => array(
  213. 0 => true,
  214. ),
  215. 'TAB_WIDTH' => 2
  216. );
  217. ?>