UNPKG

779 BJavaScriptView Raw
1Prism.languages.clike = {
2 'comment': [
3 {
4 pattern: /(^|[^\\])\/\*[\w\W]*?\*\//,
5 lookbehind: true
6 },
7 {
8 pattern: /(^|[^\\:])\/\/.*/,
9 lookbehind: true
10 }
11 ],
12 'string': /("|')(\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
13 'class-name': {
14 pattern: /((?:(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/i,
15 lookbehind: true,
16 inside: {
17 punctuation: /(\.|\\)/
18 }
19 },
20 'keyword': /\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,
21 'boolean': /\b(true|false)\b/,
22 'function': /[a-z0-9_]+(?=\()/i,
23 'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/,
24 'operator': /[-+]{1,2}|!|<=?|>=?|={1,3}|&{1,2}|\|?\||\?|\*|\/|~|\^|%/,
25 'punctuation': /[{}[\];(),.:]/
26};