UNPKG

1.27 kBJavaScriptView Raw
1Prism.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 pattern: /(^|[^\\"'@])(?:@"(?:[^"]|"")*"(?!")|"(?:[^\\\r\n"]|\\.)*")/,
12 lookbehind: true,
13 greedy: true
14 },
15
16 'class-name': {
17 pattern: /(\b(?:class|enum|extends|instanceof)\s+)\w+(?:\.\w+)*/,
18 lookbehind: true,
19 inside: {
20 'punctuation': /\./
21 }
22 },
23 'keyword': /\b(?:__FILE__|__LINE__|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)\b/,
24
25 'number': /\b(?:0x[0-9a-fA-F]+|\d+(?:\.(?:\d+|[eE][+-]?\d+))?)\b/,
26 'operator': /\+\+|--|<=>|<[-<]|>>>?|&&?|\|\|?|[-+*/%!=<>]=?|[~^]|::?/,
27 'punctuation': /[(){}\[\],;.]/
28});
29
30Prism.languages.insertBefore('squirrel', 'string', {
31 'char': {
32 pattern: /(^|[^\\"'])'(?:[^\\']|\\(?:[xuU][0-9a-fA-F]{0,8}|[\s\S]))'/,
33 lookbehind: true,
34 greedy: true
35 }
36});
37
38Prism.languages.insertBefore('squirrel', 'operator', {
39 'attribute-punctuation': {
40 pattern: /<\/|\/>/,
41 alias: 'important'
42 },
43 'lambda': {
44 pattern: /@(?=\()/,
45 alias: 'operator'
46 }
47});