Project

General

Profile

Download (1.4 KB) Statistics
| Branch: | Tag: | Revision:
1
/* Ruby 1.8.4 syntax contributed by Erik Peterson */
2
dp.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
}
24

    
25
dp.sh.Brushes.Ruby.prototype	= new dp.sh.Highlighter();
26
dp.sh.Brushes.Ruby.Aliases	= ['ruby', 'rails'];
(11-11/16)