1;(function() 2{ 3 // CommonJS 4 SyntaxHighlighter = SyntaxHighlighter || (typeof require !== 'undefined'? require('shCore').SyntaxHighlighter : null); 5 6 function Brush() 7 { 8 // Contributed by Gheorghe Milas and Ahmad Sherif 9 10 var keywords = 'and assert break class continue def del elif else ' + 11 'except exec finally for from global if import in is ' + 12 'lambda not or pass raise return try yield while'; 13 14 var funcs = '__import__ abs all any apply basestring bin bool buffer callable ' + 15 'chr classmethod cmp coerce compile complex delattr dict dir ' + 16 'divmod enumerate eval execfile file filter float format frozenset ' + 17 'getattr globals hasattr hash help hex id input int intern ' + 18 'isinstance issubclass iter len list locals long map max min next ' + 19 'object oct open ord pow print property range raw_input reduce ' + 20 'reload repr reversed round set setattr slice sorted staticmethod ' + 21 'str sum super tuple type type unichr unicode vars xrange zip'; 22 23 var special = 'None True False self cls class_'; 24 25 this.regexList = [ 26 { regex: SyntaxHighlighter.regexLib.singleLinePerlComments, css: 'comments' }, 27 { regex: /^\s*@\w+/gm, css: 'decorator' }, 28 { regex: /(['\"]{3})([^\1])*?\1/gm, css: 'comments' }, 29 { regex: /"(?!")(?:\.|\\\"|[^\""\n])*"/gm, css: 'string' }, 30 { regex: /'(?!')(?:\.|(\\\')|[^\''\n])*'/gm, css: 'string' }, 31 { regex: /\+|\-|\*|\/|\%|=|==/gm, css: 'keyword' }, 32 { regex: /\b\d+\.?\w*/g, css: 'value' }, 33 { regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'functions' }, 34 { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, 35 { regex: new RegExp(this.getKeywords(special), 'gm'), css: 'color1' } 36 ]; 37 38 this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags); 39 }; 40 41 Brush.prototype = new SyntaxHighlighter.Highlighter(); 42 Brush.aliases = ['py', 'python']; 43 44 SyntaxHighlighter.brushes.Python = Brush; 45 46 // CommonJS 47 typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 48})(); 49