shBrushSql.js 3.0 KB

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