1 | Prism.languages.nim = {
|
2 | 'comment': {
|
3 | pattern: /#.*/,
|
4 | greedy: true
|
5 | },
|
6 | 'string': {
|
7 |
|
8 | pattern: /(?:\b(?!\d)(?:\w|\\x[89a-fA-F][0-9a-fA-F])+)?(?:"""[\s\S]*?"""(?!")|"(?:\\[\s\S]|""|[^"\\])*")/,
|
9 | greedy: true
|
10 | },
|
11 | 'char': {
|
12 |
|
13 | pattern: /'(?:\\(?:\d+|x[\da-fA-F]{0,2}|.)|[^'])'/,
|
14 | greedy: true
|
15 | },
|
16 |
|
17 | 'function': {
|
18 | pattern: /(?:(?!\d)(?:\w|\\x[89a-fA-F][0-9a-fA-F])+|`[^`\r\n]+`)\*?(?:\[[^\]]+\])?(?=\s*\()/,
|
19 | greedy: true,
|
20 | inside: {
|
21 | 'operator': /\*$/
|
22 | }
|
23 | },
|
24 |
|
25 | 'identifier': {
|
26 | pattern: /`[^`\r\n]+`/,
|
27 | greedy: true,
|
28 | inside: {
|
29 | 'punctuation': /`/
|
30 | }
|
31 | },
|
32 |
|
33 |
|
34 | 'number': /\b(?:0[xXoObB][\da-fA-F_]+|\d[\d_]*(?:(?!\.\.)\.[\d_]*)?(?:[eE][+-]?\d[\d_]*)?)(?:'?[iuf]\d*)?/,
|
35 | 'keyword': /\b(?:addr|as|asm|atomic|bind|block|break|case|cast|concept|const|continue|converter|defer|discard|distinct|do|elif|else|end|enum|except|export|finally|for|from|func|generic|if|import|include|interface|iterator|let|macro|method|mixin|nil|object|out|proc|ptr|raise|ref|return|static|template|try|tuple|type|using|var|when|while|with|without|yield)\b/,
|
36 | 'operator': {
|
37 |
|
38 |
|
39 |
|
40 | pattern: /(^|[({\[](?=\.\.)|(?![({\[]\.).)(?:(?:[=+\-*\/<>@$~&%|!?^:\\]|\.\.|\.(?![)}\]]))+|\b(?:and|div|in|is|isnot|mod|not|notin|of|or|shl|shr|xor)\b)/m,
|
41 | lookbehind: true
|
42 | },
|
43 | 'punctuation': /[({\[]\.|\.[)}\]]|[`(){}\[\],:]/
|
44 | };
|