[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/vendor/geshi/geshi/src/geshi/ -> ruby.php (source)

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