OLD | NEW |
1 Prism.languages.python= { | 1 Prism.languages.python= { |
2 'comment': { | 2 'comment': { |
3 » » pattern: /(^|[^\\])#.*?(\r?\n|$)/, | 3 » » pattern: /(^|[^\\])#.*/, |
4 lookbehind: true | 4 lookbehind: true |
5 }, | 5 }, |
6 » 'string': /"""[\s\S]+?"""|'''[\s\S]+?'''|("|')(\\?.)*?\1/, | 6 » 'string': /"""[\s\S]+?"""|'''[\s\S]+?'''|("|')(?:\\?.)*?\1/, |
7 'function' : { | 7 'function' : { |
8 » » pattern: /((^|\s)def[ \t]+)([a-zA-Z_][a-zA-Z0-9_]*(?=\())/g, | 8 » » pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_][a-zA-Z0-9_]*(?=\()/g, |
9 lookbehind: true | 9 lookbehind: true |
10 }, | 10 }, |
11 » 'keyword' : /\b(as|assert|break|class|continue|def|del|elif|else|except|
exec|finally|for|from|global|if|import|in|is|lambda|pass|print|raise|return|try|
while|with|yield)\b/, | 11 » 'class-name': { |
12 » 'boolean' : /\b(True|False)\b/, | 12 » » pattern: /(\bclass\s+)[a-z0-9_]+/i, |
13 » 'number' : /\b-?(0[bo])?(?:(\d|0x[a-f])[\da-f]*\.?\d*|\.\d+)(?:e[+-]?\d+
)?j?\b/i, | 13 » » lookbehind: true |
14 » 'operator' : /[-+]|<=?|>=?|!|={1,2}|&{1,2}|\|?\||\?|\*|\/|~|\^|%|\b(or|a
nd|not)\b/, | 14 » }, |
| 15 » 'keyword' : /\b(?:as|assert|async|await|break|class|continue|def|del|eli
f|else|except|exec|finally|for|from|global|if|import|in|is|lambda|pass|print|rai
se|return|try|while|with|yield)\b/, |
| 16 » 'boolean' : /\b(?:True|False)\b/, |
| 17 » 'number' : /\b-?(?:0[bo])?(?:(?:\d|0x[\da-f])[\da-f]*\.?\d*|\.\d+)(?:e[+
-]?\d+)?j?\b/i, |
| 18 » 'operator' : /[-+%=]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]|\b(?:or|
and|not)\b/, |
15 'punctuation' : /[{}[\];(),.:]/ | 19 'punctuation' : /[{}[\];(),.:]/ |
16 }; | 20 }; |
OLD | NEW |