shBrushAS3.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. // Created by Peter Atoria @ http://iAtoria.com
  24. var inits = 'class interface function package';
  25. var keywords = '-Infinity ...rest Array as AS3 Boolean break case catch const continue Date decodeURI ' +
  26. 'decodeURIComponent default delete do dynamic each else encodeURI encodeURIComponent escape ' +
  27. 'extends false final finally flash_proxy for get if implements import in include Infinity ' +
  28. 'instanceof int internal is isFinite isNaN isXMLName label namespace NaN native new null ' +
  29. 'Null Number Object object_proxy override parseFloat parseInt private protected public ' +
  30. 'return set static String super switch this throw true try typeof uint undefined unescape ' +
  31. 'use void while with'
  32. ;
  33. this.regexList = [
  34. { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments
  35. { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments
  36. { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings
  37. { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings
  38. { regex: /\b([\d]+(\.[\d]+)?|0x[a-f0-9]+)\b/gi, css: 'value' }, // numbers
  39. { regex: new RegExp(this.getKeywords(inits), 'gm'), css: 'color3' }, // initializations
  40. { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keywords
  41. { regex: new RegExp('var', 'gm'), css: 'variable' }, // variable
  42. { regex: new RegExp('trace', 'gm'), css: 'color1' } // trace
  43. ];
  44. this.forHtmlScript(SyntaxHighlighter.regexLib.scriptScriptTags);
  45. };
  46. Brush.prototype = new SyntaxHighlighter.Highlighter();
  47. Brush.aliases = ['actionscript3', 'as3'];
  48. SyntaxHighlighter.brushes.AS3 = Brush;
  49. // CommonJS
  50. typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
  51. })();