Skip to content

Commit

Permalink
add missing enum, export and given keywords
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasstucki committed Sep 6, 2021
1 parent 3cc0800 commit c63cfe1
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Grammars:
- enh(css/less/stylus/scss) add support for CSS Grid properties [monochromer][]
- enh(java) add support for Java Text Block (#3322) [Teletha][]
- enh(scala) add missing `do` and `then` keyword (#3323) [Nicolas Stucki][]
- enh(scala) add missing `enum`, `export` and `given` keywords (#3328) [Nicolas Stucki][]

[Austin Schick]: https://github.com/austin-schick
[Josh Goebel]: https://github.com/joshgoebel
Expand Down
2 changes: 1 addition & 1 deletion src/languages/scala.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export default function(hljs) {
name: 'Scala',
keywords: {
literal: 'true false null',
keyword: 'type yield lazy override def with val var sealed abstract private trait object if then forSome for while do throw finally protected extends import final return else break new catch super class case package default try this match continue throws implicit'
keyword: 'type yield lazy override def with val var sealed abstract private trait object if then forSome for while do throw finally protected extends import final return else break new catch super class case package default try this match continue throws implicit export enum given'
},
contains: [
hljs.C_LINE_COMMENT_MODE,
Expand Down
6 changes: 6 additions & 0 deletions test/markup/scala/enum.expect.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<span class="hljs-keyword">enum</span> <span class="hljs-type">Color</span>:
<span class="hljs-keyword">case</span> <span class="hljs-type">Red</span>, <span class="hljs-type">Green</span>, <span class="hljs-type">Blue</span>

<span class="hljs-keyword">enum</span> <span class="hljs-type">State</span>:
<span class="hljs-keyword">case</span> <span class="hljs-type">On</span>
<span class="hljs-keyword">case</span> <span class="hljs-type">Off</span>
6 changes: 6 additions & 0 deletions test/markup/scala/enum.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
enum Color:
case Red, Green, Blue

enum State:
case On
case Off
2 changes: 2 additions & 0 deletions test/markup/scala/export.expect.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<span class="hljs-keyword">export</span> scanUnit.scan
<span class="hljs-keyword">export</span> printUnit.{status =&gt; _, *}
2 changes: 2 additions & 0 deletions test/markup/scala/export.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export scanUnit.scan
export printUnit.{status => _, *}
2 changes: 2 additions & 0 deletions test/markup/scala/given.expect.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<span class="hljs-keyword">given</span> <span class="hljs-type">T</span> = ???
<span class="hljs-keyword">given</span> x: <span class="hljs-type">T</span> = ???
2 changes: 2 additions & 0 deletions test/markup/scala/given.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
given T = ???
given x: T = ???

0 comments on commit c63cfe1

Please sign in to comment.