1/* Python 2.3 syntax contributed by Gheorghe Milas */ 2dp.sh.Brushes.Python = function() 3{ 4 var keywords = 'and assert break class continue def del elif else ' + 5 'except exec finally for from global if import in is ' + 6 'lambda not or pass print raise return try yield while'; 7 8 var special = 'None True False self cls class_' 9 10 this.regexList = [ 11 { regex: dp.sh.RegexLib.SingleLinePerlComments, css: 'comment' }, 12 { regex: new RegExp("^\\s*@\\w+", 'gm'), css: 'decorator' }, 13 { regex: new RegExp("(['\"]{3})([^\\1])*?\\1", 'gm'), css: 'comment' }, 14 { regex: new RegExp('"(?!")(?:\\.|\\\\\\"|[^\\""\\n\\r])*"', 'gm'), css: 'string' }, 15 { regex: new RegExp("'(?!')*(?:\\.|(\\\\\\')|[^\\''\\n\\r])*'", 'gm'), css: 'string' }, 16 { regex: new RegExp("\\b\\d+\\.?\\w*", 'g'), css: 'number' }, 17 { regex: new RegExp(this.GetKeywords(keywords), 'gm'), css: 'keyword' }, 18 { regex: new RegExp(this.GetKeywords(special), 'gm'), css: 'special' } 19 ]; 20 21 this.CssClass = 'dp-py'; 22 this.Style = '.dp-py .builtins { color: #ff1493; }' + 23 '.dp-py .magicmethods { color: #808080; }' + 24 '.dp-py .exceptions { color: brown; }' + 25 '.dp-py .types { color: brown; font-style: italic; }' + 26 '.dp-py .commonlibs { color: #8A2BE2; font-style: italic; }'; 27} 28 29dp.sh.Brushes.Python.prototype = new dp.sh.Highlighter(); 30dp.sh.Brushes.Python.Aliases = ['py', 'python']; 31