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