KXStudio Website https://kx.studio/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ruby.php 9.5KB

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