Permalink
Browse files

Modified keywords, strings, and value in shBrushPython.js

* Remove operators from keyword.
* Add 'as' and 'with' to keyword.
* Append 'r' and 'u' prefix to strings.
* Fix value for representation float number by exponent.
  • Loading branch information...
1 parent 985329b commit b1ba8f8ee2c28ab109dd5a42c76a3e72133eb472 Kubota Kazutoshi committed Oct 10, 2012
Showing with 10 additions and 11 deletions.
  1. +10 −11 scripts/shBrushPython.js
View
@@ -6,16 +6,16 @@
function Brush()
{
// Contributed by Gheorghe Milas and Ahmad Sherif
-
- var keywords = 'and assert break class continue def del elif else ' +
+
+ var keywords = 'and as 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';
+ 'lambda not or pass print raise return try while with yield';
- var funcs = '__import__ abs all any apply basestring bin bool buffer callable ' +
+ var funcs = '__import__ abs all any apply basestring bin bool buffer bytearray callable ' +
'chr classmethod cmp coerce compile complex delattr dict dir ' +
'divmod enumerate eval execfile file filter float format frozenset ' +
'getattr globals hasattr hash help hex id input int intern ' +
- 'isinstance issubclass iter len list locals long map max min next ' +
+ 'isinstance issubclass iter len list locals long map max memoryview min next ' +
'object oct open ord pow print property range raw_input reduce ' +
'reload repr reversed round set setattr slice sorted staticmethod ' +
'str sum super tuple type type unichr unicode vars xrange zip';
@@ -24,17 +24,16 @@
this.regexList = [
{ regex: SyntaxHighlighter.regexLib.singleLinePerlComments, css: 'comments' },
- { regex: /^\s*@\w+/gm, css: 'decorator' },
+ { regex: /^\s*@\w[\.\w]*/gm, css: 'decorator' },
{ regex: /(['\"]{3})([^\1])*?\1/gm, css: 'comments' },
- { regex: /"(?!")(?:\.|\\\"|[^\""\n])*"/gm, css: 'string' },
- { regex: /'(?!')(?:\.|(\\\')|[^\''\n])*'/gm, css: 'string' },
- { regex: /\+|\-|\*|\/|\%|=|==/gm, css: 'keyword' },
- { regex: /\b\d+\.?\w*/g, css: 'value' },
+ { regex: /[ru]{0,2}"(?!")(?:\.|\\\"|[^\""\n])*"/gmi, css: 'string' },
+ { regex: /[ru]{0,2}'(?!')(?:\.|(\\\')|[^\''\n])*'/gmi, css: 'string' },
+ { regex: /\b\d+\.?[-\w]*/g, css: 'value' },
{ regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'functions' },
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' },
{ regex: new RegExp(this.getKeywords(special), 'gm'), css: 'color1' }
];
-
+
this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags);
};

0 comments on commit b1ba8f8

Please sign in to comment.