/* Python 2.3 syntax contributed by Gheorghe Milas */
dp.sh.Brushes.Python = function()
{
    var keywords =  'and assert break class continue def del elif else ' +
                    'except exec finally for from global if import in is ' +
                    'lambda not or pass print raise return try yield while';

    var special =  'None True False self cls class_'

    var operators = '== != <> <= >= \\+= %= -= \\*= /= = \\+ - \\* / % < > ' + 
                    ': , \\. \\( \\) \\[ \\] \\\\';

    //var defname = "[A-Za-z0-9_]+(?=\\(.*?\\):)"

    //var classname = "^\s*(?=class[ ]+)([A-Za-z0-9_]+)";
    
    var number = "\\b\\d+\\.?\\w*";

    var string = "[ru]?(['\"])(?!\\1)(.|[\\\\\\1])+?\\1";

    var docstring = "[ru]?(['\"]{3})([^\\1])*?\\1";
    
    var comment = "#.*$";

    var decorator = "^\\s*@\\w+";

    this.regexList = [
        { regex: new RegExp(comment, 'gm'), css: 'comment' },
        { regex: new RegExp(decorator, 'gm'), css: 'decorator' },
        { regex: new RegExp(docstring, 'gm'), css: 'docstring' },
        { regex: new RegExp(string, 'gm'), css: 'string' },
        { regex: new RegExp(number, 'g'), css: 'number' },
        { regex: new RegExp(this.GetKeywords(keywords), 'gm'), css: 'keyword' },
        { regex: new RegExp(this.GetKeywords(special), 'gm'), css: 'special' },
        //{ regex: new RegExp(defname, 'g'), css: 'defname' }, // Busted
        //{ regex: new RegExp(classname, 'g'), css: 'classname' }, // Busted
        // Finding operators slows it down significantly.
        { regex: new RegExp(operators.replace(/ /g, '|'), 'g'), css: 'operator' }
        ];

    this.CssClass = 'dp-py';
}

dp.sh.Brushes.Python.prototype  = new dp.sh.Highlighter();
dp.sh.Brushes.Python.Aliases    = ['py', 'python'];

