/**
 * TestComplete DelphiScript brush for SyntaxHighlighter
 *
 * Copyright (C) 2009 AutomatedQA
 */
SyntaxHighlighter.brushes.DelphiScript = function()
{
	var keywords =	'and array begin case const div do(?:wnto)? else end except(?:ion)? false finally ' +
			'for(?:ward)? function goto i[fn] label mod nil not o[fr] out procedure repeat ' +
			'result sh[lr] then to true try unassigned until uses var while with xor';

	var functions = 'Abs Append Assigned AssignFile Break ChDir Chr CloseFile Continue Copy Cos ' +
			'Dec Delete EOF Erase Evaluate ExceptionMessage Exit Exp FileSize Flush Frac ' +
			'FreeMem GetDir GetMem Halt Inc Insert Int Length Ln MkDir Ord Pi Pos Raise ' +
			'Read(?:Ln)? Random(?:ize)? ReallocMem Rename Reset Rewrite RmDir Round ' +
			'SetLength Sin Sqrt? Trunc Write(?:Ln)?';

	var TCObjects = 'ActiveXObjects ADO Aliases AQtime AQtime[4-6] AQtimeIntegration aqConvert aqDateTime ' +
			'aqEnvironment aqFile aqFileSystem aqUtils aqObject aqString BDE BuiltIn Consts DB DBTables ' +
			'DbgServices DDT DebugAgent DLL dotNET Events Files HISUtils Indicator IssueTracking ' +
			'KeywordTests LLPlayer LoadTesting Log ManualTestBuilder NameMapping NetworkSuite Objects ' +
			'OCR ODT Options PDA Project ProjectSuite Regions Runner Self slAQtime slPacker Storages ' +
			'Stores Sys Tables TestedApps TestSuites UserForms Utils Win32API Win32Controls ' +
			'WinCELLCollection WinCETestedApps WebTesting WebServices XML';

	var TCFunctions = '(?:Mk|In)Set';

	this.regexList = [
		{ regex: /\(\*[\s\S]*?\*\)/gm,					css: 'comments' },  	// multiline comments (* *)
		{ regex: /{(?!\$)[\s\S]*?}/gm,					css: 'comments' },  	// multiline comments { }
		{ regex: SyntaxHighlighter.regexLib.singleLineCComments,	css: 'comments' },  	// one line comments
		{ regex: SyntaxHighlighter.regexLib.singleQuotedString,		css: 'string' },	// strings
		{ regex: /(?:#\d+)+\b/gi,					css: 'string' },	// special characters #13#10
		{ regex: /\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/gi,			css: 'value' },		// numbers 12345
		{ regex: /\$[a-f\d]+\b/gi,					css: 'value' },		// numbers $F5D3
		{ regex: new RegExp(this.getKeywords(keywords), 'gi'),		css: 'keyword' },	// keywords
		{ regex: new RegExp(this.getKeywords(functions), 'gi'),		css: 'functions' },	// functions & procedures
		{ regex: new RegExp(this.getKeywords(TCObjects), 'g'),		css: 'functions' },	// TestComplete global objects
		{ regex: new RegExp(this.getKeywords(TCFunctions), 'g'),	css: 'functions' }	// TestComplete global functions
	];
};

SyntaxHighlighter.brushes.DelphiScript.prototype	= new SyntaxHighlighter.Highlighter();
SyntaxHighlighter.brushes.DelphiScript.aliases	= ['delphiscript', 'ds'];
