Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enh(scala) add missing enum, export and given keywords #3328

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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][]
- enh(scala) remove symbol syntax and fix quoted code syntax (#3324) [Nicolas Stucki][]

[Austin Schick]: https://github.com/austin-schick
Expand Down
2 changes: 1 addition & 1 deletion src/languages/scala.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,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 = ???