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