UNPKG

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