PageRenderTime 6ms CodeModel.GetById 1ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/lib/syntaxhighlighter_3.0.83/scripts/shBrushSql.js

#
JavaScript | 66 lines | 40 code | 8 blank | 18 comment | 4 complexity | 3de8eb19c0c7a60c1c3e0680c18709ab MD5 | raw file
 1/**
 2 * SyntaxHighlighter
 3 * http://alexgorbatchev.com/SyntaxHighlighter
 4 *
 5 * SyntaxHighlighter is donationware. If you are using it, please donate.
 6 * http://alexgorbatchev.com/SyntaxHighlighter/donate.html
 7 *
 8 * @version
 9 * 3.0.83 (July 02 2010)
10 * 
11 * @copyright
12 * Copyright (C) 2004-2010 Alex Gorbatchev.
13 *
14 * @license
15 * Dual licensed under the MIT and GPL licenses.
16 */
17;(function()
18{
19	// CommonJS
20	typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
21
22	function Brush()
23	{
24		var funcs	=	'abs avg case cast coalesce convert count current_timestamp ' +
25						'current_user day isnull left lower month nullif replace right ' +
26						'session_user space substring sum system_user upper user year';
27
28		var keywords =	'absolute action add after alter as asc at authorization begin bigint ' +
29						'binary bit by cascade char character check checkpoint close collate ' +
30						'column commit committed connect connection constraint contains continue ' +
31						'create cube current current_date current_time cursor database date ' +
32						'deallocate dec decimal declare default delete desc distinct double drop ' +
33						'dynamic else end end-exec escape except exec execute false fetch first ' +
34						'float for force foreign forward free from full function global goto grant ' +
35						'group grouping having hour ignore index inner insensitive insert instead ' +
36						'int integer intersect into is isolation key last level load local max min ' +
37						'minute modify move name national nchar next no numeric of off on only ' +
38						'open option order out output partial password precision prepare primary ' +
39						'prior privileges procedure public read real references relative repeatable ' +
40						'restrict return returns revoke rollback rollup rows rule schema scroll ' +
41						'second section select sequence serializable set size smallint static ' +
42						'statistics table temp temporary then time timestamp to top transaction ' +
43						'translation trigger true truncate uncommitted union unique update values ' +
44						'varchar varying view when where with work';
45
46		var operators =	'all and any between cross in join like not null or outer some';
47
48		this.regexList = [
49			{ regex: /--(.*)$/gm,												css: 'comments' },			// one line and multiline comments
50			{ regex: SyntaxHighlighter.regexLib.multiLineDoubleQuotedString,	css: 'string' },			// double quoted strings
51			{ regex: SyntaxHighlighter.regexLib.multiLineSingleQuotedString,	css: 'string' },			// single quoted strings
52			{ regex: new RegExp(this.getKeywords(funcs), 'gmi'),				css: 'color2' },			// functions
53			{ regex: new RegExp(this.getKeywords(operators), 'gmi'),			css: 'color1' },			// operators and such
54			{ regex: new RegExp(this.getKeywords(keywords), 'gmi'),				css: 'keyword' }			// keyword
55			];
56	};
57
58	Brush.prototype	= new SyntaxHighlighter.Highlighter();
59	Brush.aliases	= ['sql'];
60
61	SyntaxHighlighter.brushes.Sql = Brush;
62
63	// CommonJS
64	typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
65})();
66