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