main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
1.6 KB
|
Line | |
---|
1 | Prism.languages.scala = Prism.languages.extend('java', {
|
---|
2 | 'triple-quoted-string': {
|
---|
3 | pattern: /"""[\s\S]*?"""/,
|
---|
4 | greedy: true,
|
---|
5 | alias: 'string'
|
---|
6 | },
|
---|
7 | 'string': {
|
---|
8 | pattern: /("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,
|
---|
9 | greedy: true
|
---|
10 | },
|
---|
11 | 'keyword': /<-|=>|\b(?:abstract|case|catch|class|def|derives|do|else|enum|extends|extension|final|finally|for|forSome|given|if|implicit|import|infix|inline|lazy|match|new|null|object|opaque|open|override|package|private|protected|return|sealed|self|super|this|throw|trait|transparent|try|type|using|val|var|while|with|yield)\b/,
|
---|
12 | 'number': /\b0x(?:[\da-f]*\.)?[\da-f]+|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e\d+)?[dfl]?/i,
|
---|
13 | 'builtin': /\b(?:Any|AnyRef|AnyVal|Boolean|Byte|Char|Double|Float|Int|Long|Nothing|Short|String|Unit)\b/,
|
---|
14 | 'symbol': /'[^\d\s\\]\w*/
|
---|
15 | });
|
---|
16 |
|
---|
17 | Prism.languages.insertBefore('scala', 'triple-quoted-string', {
|
---|
18 | 'string-interpolation': {
|
---|
19 | pattern: /\b[a-z]\w*(?:"""(?:[^$]|\$(?:[^{]|\{(?:[^{}]|\{[^{}]*\})*\}))*?"""|"(?:[^$"\r\n]|\$(?:[^{]|\{(?:[^{}]|\{[^{}]*\})*\}))*")/i,
|
---|
20 | greedy: true,
|
---|
21 | inside: {
|
---|
22 | 'id': {
|
---|
23 | pattern: /^\w+/,
|
---|
24 | greedy: true,
|
---|
25 | alias: 'function'
|
---|
26 | },
|
---|
27 | 'escape': {
|
---|
28 | pattern: /\\\$"|\$[$"]/,
|
---|
29 | greedy: true,
|
---|
30 | alias: 'symbol'
|
---|
31 | },
|
---|
32 | 'interpolation': {
|
---|
33 | pattern: /\$(?:\w+|\{(?:[^{}]|\{[^{}]*\})*\})/,
|
---|
34 | greedy: true,
|
---|
35 | inside: {
|
---|
36 | 'punctuation': /^\$\{?|\}$/,
|
---|
37 | 'expression': {
|
---|
38 | pattern: /[\s\S]+/,
|
---|
39 | inside: Prism.languages.scala
|
---|
40 | }
|
---|
41 | }
|
---|
42 | },
|
---|
43 | 'string': /[\s\S]+/
|
---|
44 | }
|
---|
45 | }
|
---|
46 | });
|
---|
47 |
|
---|
48 | delete Prism.languages.scala['class-name'];
|
---|
49 | delete Prism.languages.scala['function'];
|
---|
50 | delete Prism.languages.scala['constant'];
|
---|
Note:
See
TracBrowser
for help on using the repository browser.