Skip to content

Commit b1b0815

Browse files
authored
enh(scala) fix triple quoted string (#2987)
* enh(scala) fix triple quoted string * add initial string tests
1 parent 16c2224 commit b1b0815

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

CHANGES.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ New Languages:
66

77
Language grammar improvements:
88

9-
- env(perl) Much improved regex detection (#2960) [Josh Goebel][]
9+
- enh(scala) fix triple quoted strings (#2987) [Josh Goebel][]
10+
- enh(perl) Much improved regex detection (#2960) [Josh Goebel][]
1011
- enh(swift) Improved highlighting for operator and precedencegroup declarations. (#2938) [Steven Van Impe][]
1112
- fix(xml) Support single-character namespaces. (#2957) [Jan Pilzer][]
1213
- enh(ruby) Support for character literals (#2950) [Vaibhav Chanana][]

src/languages/scala.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,24 @@ export default function(hljs) {
2929
const STRING = {
3030
className: 'string',
3131
variants: [
32+
{
33+
begin: '"""',
34+
end: '"""'
35+
},
3236
{
3337
begin: '"',
3438
end: '"',
3539
illegal: '\\n',
3640
contains: [ hljs.BACKSLASH_ESCAPE ]
3741
},
38-
{
39-
begin: '"""',
40-
end: '"""',
41-
relevance: 10
42-
},
4342
{
4443
begin: '[a-z]+"',
4544
end: '"',
4645
illegal: '\\n',
47-
contains: [ hljs.BACKSLASH_ESCAPE,
48-
SUBST ]
46+
contains: [
47+
hljs.BACKSLASH_ESCAPE,
48+
SUBST
49+
]
4950
},
5051
{
5152
className: 'string',
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<span class="hljs-keyword">val</span> s = <span class="hljs-string">&quot;&quot;&quot; this is a string &quot;this is still a string&quot; another quote: &quot; after the quote &quot;&quot;&quot;</span>

test/markup/scala/strings.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
val s = """ this is a string "this is still a string" another quote: " after the quote """

0 commit comments

Comments
 (0)