shBrushDelphi.js 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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 keywords = 'abs addr and ansichar ansistring array as asm begin boolean byte cardinal ' +
  24. 'case char class comp const constructor currency destructor div do double ' +
  25. 'downto else end except exports extended false file finalization finally ' +
  26. 'for function goto if implementation in inherited int64 initialization ' +
  27. 'integer interface is label library longint longword mod nil not object ' +
  28. 'of on or packed pansichar pansistring pchar pcurrency pdatetime pextended ' +
  29. 'pint64 pointer private procedure program property pshortstring pstring ' +
  30. 'pvariant pwidechar pwidestring protected public published raise real real48 ' +
  31. 'record repeat set shl shortint shortstring shr single smallint string then ' +
  32. 'threadvar to true try type unit until uses val var varirnt while widechar ' +
  33. 'widestring with word write writeln xor';
  34. this.regexList = [
  35. { regex: /\(\*[\s\S]*?\*\)/gm, css: 'comments' }, // multiline comments (* *)
  36. { regex: /{(?!\$)[\s\S]*?}/gm, css: 'comments' }, // multiline comments { }
  37. { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line
  38. { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings
  39. { regex: /\{\$[a-zA-Z]+ .+\}/g, css: 'color1' }, // compiler Directives and Region tags
  40. { regex: /\b[\d\.]+\b/g, css: 'value' }, // numbers 12345
  41. { regex: /\$[a-zA-Z0-9]+\b/g, css: 'value' }, // numbers $F5D3
  42. { regex: new RegExp(this.getKeywords(keywords), 'gmi'), css: 'keyword' } // keyword
  43. ];
  44. };
  45. Brush.prototype = new SyntaxHighlighter.Highlighter();
  46. Brush.aliases = ['delphi', 'pascal', 'pas'];
  47. SyntaxHighlighter.brushes.Delphi = Brush;
  48. // CommonJS
  49. typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
  50. })();