UNPKG

674 BJavaScriptView Raw
1Prism.languages.python= {
2 'comment': {
3 pattern: /(^|[^\\])#.*?(\r?\n|$)/,
4 lookbehind: true
5 },
6 'string': /"""[\s\S]+?"""|'''[\s\S]+?'''|("|')(\\?.)*?\1/,
7 'function' : {
8 pattern: /((^|\s)def[ \t]+)([a-zA-Z_][a-zA-Z0-9_]*(?=\())/g,
9 lookbehind: true
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/,
12 'boolean' : /\b(True|False)\b/,
13 'number' : /\b-?(0[bo])?(?:(\d|0x[a-f])[\da-f]*\.?\d*|\.\d+)(?:e[+-]?\d+)?j?\b/i,
14 'operator' : /[-+]|<=?|>=?|!|={1,2}|&{1,2}|\|?\||\?|\*|\/|~|\^|%|\b(or|and|not)\b/,
15 'punctuation' : /[{}[\];(),.:]/
16};
\No newline at end of file