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