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.8 KB
|
Line | |
---|
1 | 'use strict'
|
---|
2 | var refractorJava = require('./java.js')
|
---|
3 | module.exports = scala
|
---|
4 | scala.displayName = 'scala'
|
---|
5 | scala.aliases = []
|
---|
6 | function scala(Prism) {
|
---|
7 | Prism.register(refractorJava)
|
---|
8 | Prism.languages.scala = Prism.languages.extend('java', {
|
---|
9 | 'triple-quoted-string': {
|
---|
10 | pattern: /"""[\s\S]*?"""/,
|
---|
11 | greedy: true,
|
---|
12 | alias: 'string'
|
---|
13 | },
|
---|
14 | string: {
|
---|
15 | pattern: /("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,
|
---|
16 | greedy: true
|
---|
17 | },
|
---|
18 | keyword:
|
---|
19 | /<-|=>|\b(?:abstract|case|catch|class|def|do|else|extends|final|finally|for|forSome|if|implicit|import|lazy|match|new|null|object|override|package|private|protected|return|sealed|self|super|this|throw|trait|try|type|val|var|while|with|yield)\b/,
|
---|
20 | number:
|
---|
21 | /\b0x(?:[\da-f]*\.)?[\da-f]+|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e\d+)?[dfl]?/i,
|
---|
22 | builtin:
|
---|
23 | /\b(?:Any|AnyRef|AnyVal|Boolean|Byte|Char|Double|Float|Int|Long|Nothing|Short|String|Unit)\b/,
|
---|
24 | symbol: /'[^\d\s\\]\w*/
|
---|
25 | })
|
---|
26 | Prism.languages.insertBefore('scala', 'triple-quoted-string', {
|
---|
27 | 'string-interpolation': {
|
---|
28 | pattern:
|
---|
29 | /\b[a-z]\w*(?:"""(?:[^$]|\$(?:[^{]|\{(?:[^{}]|\{[^{}]*\})*\}))*?"""|"(?:[^$"\r\n]|\$(?:[^{]|\{(?:[^{}]|\{[^{}]*\})*\}))*")/i,
|
---|
30 | greedy: true,
|
---|
31 | inside: {
|
---|
32 | id: {
|
---|
33 | pattern: /^\w+/,
|
---|
34 | greedy: true,
|
---|
35 | alias: 'function'
|
---|
36 | },
|
---|
37 | escape: {
|
---|
38 | pattern: /\\\$"|\$[$"]/,
|
---|
39 | greedy: true,
|
---|
40 | alias: 'symbol'
|
---|
41 | },
|
---|
42 | interpolation: {
|
---|
43 | pattern: /\$(?:\w+|\{(?:[^{}]|\{[^{}]*\})*\})/,
|
---|
44 | greedy: true,
|
---|
45 | inside: {
|
---|
46 | punctuation: /^\$\{?|\}$/,
|
---|
47 | expression: {
|
---|
48 | pattern: /[\s\S]+/,
|
---|
49 | inside: Prism.languages.scala
|
---|
50 | }
|
---|
51 | }
|
---|
52 | },
|
---|
53 | string: /[\s\S]+/
|
---|
54 | }
|
---|
55 | }
|
---|
56 | })
|
---|
57 | delete Prism.languages.scala['class-name']
|
---|
58 | delete Prism.languages.scala['function']
|
---|
59 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.