Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(826)

Unified Diff: lib/src/prism/components/prism-python.js

Issue 1418513006: update elements and fix some bugs (Closed) Base URL: git@github.com:dart-lang/polymer_elements.git@master
Patch Set: code review updates Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/src/prism/components/prism-pure.min.js ('k') | lib/src/prism/components/prism-python.min.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/prism/components/prism-python.js
diff --git a/lib/src/prism/components/prism-python.js b/lib/src/prism/components/prism-python.js
index b2e031f0a2241e30fd177503ae17b41649332b9a..eb97f48eca193396f0f9221a928d8df1819062fe 100644
--- a/lib/src/prism/components/prism-python.js
+++ b/lib/src/prism/components/prism-python.js
@@ -1,16 +1,20 @@
-Prism.languages.python= {
+Prism.languages.python= {
'comment': {
- pattern: /(^|[^\\])#.*?(\r?\n|$)/,
+ pattern: /(^|[^\\])#.*/,
lookbehind: true
},
- 'string': /"""[\s\S]+?"""|'''[\s\S]+?'''|("|')(\\?.)*?\1/,
+ 'string': /"""[\s\S]+?"""|'''[\s\S]+?'''|("|')(?:\\?.)*?\1/,
'function' : {
- pattern: /((^|\s)def[ \t]+)([a-zA-Z_][a-zA-Z0-9_]*(?=\())/g,
+ pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_][a-zA-Z0-9_]*(?=\()/g,
lookbehind: true
},
- '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/,
- 'boolean' : /\b(True|False)\b/,
- 'number' : /\b-?(0[bo])?(?:(\d|0x[a-f])[\da-f]*\.?\d*|\.\d+)(?:e[+-]?\d+)?j?\b/i,
- 'operator' : /[-+]|<=?|>=?|!|={1,2}|&{1,2}|\|?\||\?|\*|\/|~|\^|%|\b(or|and|not)\b/,
+ 'class-name': {
+ pattern: /(\bclass\s+)[a-z0-9_]+/i,
+ lookbehind: true
+ },
+ 'keyword' : /\b(?:as|assert|async|await|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/,
+ 'boolean' : /\b(?:True|False)\b/,
+ 'number' : /\b-?(?:0[bo])?(?:(?:\d|0x[\da-f])[\da-f]*\.?\d*|\.\d+)(?:e[+-]?\d+)?j?\b/i,
+ 'operator' : /[-+%=]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]|\b(?:or|and|not)\b/,
'punctuation' : /[{}[\];(),.:]/
-};
+};
« no previous file with comments | « lib/src/prism/components/prism-pure.min.js ('k') | lib/src/prism/components/prism-python.min.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698