1/* Ruby 1.8.4 syntax contributed by Erik Peterson */ 2dp.sh.Brushes.Ruby = function() 3{ 4 var keywords = 'alias and BEGIN begin break case class def define_method defined do each else elsif ' + 5 'END end ensure false for if in module new next nil not or raise redo rescue retry return ' + 6 'self super then throw true undef unless until when while yield'; 7 8 var builtins = 'Array Bignum Binding Class Continuation Dir Exception FalseClass File::Stat File Fixnum Fload ' + 9 'Hash Integer IO MatchData Method Module NilClass Numeric Object Proc Range Regexp String Struct::TMS Symbol ' + 10 'ThreadGroup Thread Time TrueClass' 11 12 this.regexList = [ 13 { regex: dp.sh.RegexLib.SingleLinePerlComments, css: 'comment' }, // one line comments 14 { regex: dp.sh.RegexLib.DoubleQuotedString, css: 'string' }, // double quoted strings 15 { regex: dp.sh.RegexLib.SingleQuotedString, css: 'string' }, // single quoted strings 16 { regex: new RegExp(':[a-z][A-Za-z0-9_]*', 'g'), css: 'symbol' }, // symbols 17 { regex: new RegExp('(\\$|@@|@)\\w+', 'g'), css: 'variable' }, // $global, @instance, and @@class variables 18 { regex: new RegExp(this.GetKeywords(keywords), 'gm'), css: 'keyword' }, // keywords 19 { regex: new RegExp(this.GetKeywords(builtins), 'gm'), css: 'builtin' } // builtins 20 ]; 21 22 this.CssClass = 'dp-rb'; 23 this.Style = '.dp-rb .symbol { color: #a70; }' + 24 '.dp-rb .variable { color: #a70; font-weight: bold; }'; 25} 26 27dp.sh.Brushes.Ruby.prototype = new dp.sh.Highlighter(); 28dp.sh.Brushes.Ruby.Aliases = ['ruby', 'rails', 'ror']; 29