1 | Prism.languages.squirrel = Prism.languages.extend('clike', {
|
2 | 'comment': [
|
3 | Prism.languages.clike['comment'][0],
|
4 | {
|
5 | pattern: /(^|[^\\:])(?:\/\/|#).*/,
|
6 | lookbehind: true,
|
7 | greedy: true
|
8 | }
|
9 | ],
|
10 | 'string': [
|
11 | {
|
12 | pattern: /(^|[^\\"'@])(?:@"(?:[^"]|"")*"(?!")|"(?:[^\\\r\n"]|\\.)*")/,
|
13 | lookbehind: true,
|
14 | greedy: true
|
15 | },
|
16 | {
|
17 | pattern: /(^|[^\\"'])'(?:[^\\']|\\(?:[xuU][0-9a-fA-F]{0,8}|[\s\S]))'/,
|
18 | lookbehind: true,
|
19 | greedy: true
|
20 | }
|
21 | ],
|
22 |
|
23 | 'class-name': {
|
24 | pattern: /(\b(?:class|enum|extends|instanceof)\s+)\w+(?:\.\w+)*/,
|
25 | lookbehind: true,
|
26 | inside: {
|
27 | 'punctuation': /\./
|
28 | }
|
29 | },
|
30 | 'keyword': /\b(?:base|break|case|catch|class|clone|const|constructor|continue|default|delete|else|enum|extends|for|foreach|function|if|in|instanceof|local|null|resume|return|static|switch|this|throw|try|typeof|while|yield|__LINE__|__FILE__)\b/,
|
31 |
|
32 | 'number': /\b(?:0x[0-9a-fA-F]+|\d+(?:\.(?:\d+|[eE][+-]?\d+))?)\b/,
|
33 | 'operator': /\+\+|--|<=>|<[-<]|>>>?|&&?|\|\|?|[-+*/%!=<>]=?|[~^]|::?/,
|
34 | 'punctuation': /[(){}\[\],;.]/
|
35 | });
|
36 |
|
37 | Prism.languages.insertBefore('squirrel', 'operator', {
|
38 | 'attribute-punctuation': {
|
39 | pattern: /<\/|\/>/,
|
40 | alias: 'important'
|
41 | },
|
42 | 'lambda': {
|
43 | pattern: /@(?=\()/,
|
44 | alias: 'operator'
|
45 | }
|
46 | });
|