From 0aabfbfa45abbf21f536a2c3b3f64d61b4e9af19 Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Mon, 6 Sep 2021 11:59:47 +0200 Subject: [PATCH] enh(scala) add missing `enum`, `export` and `given` keywords These keywords were added in Scala 3. See https://docs.scala-lang.org/scala3/reference/syntax.html#regular-keywords --- CHANGES.md | 1 + src/languages/scala.js | 2 +- test/markup/scala/enum.expect.txt | 6 ++++++ test/markup/scala/enum.txt | 6 ++++++ test/markup/scala/export.expect.txt | 2 ++ test/markup/scala/export.txt | 2 ++ test/markup/scala/given.expect.txt | 2 ++ test/markup/scala/given.txt | 2 ++ 8 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 test/markup/scala/enum.expect.txt create mode 100644 test/markup/scala/enum.txt create mode 100644 test/markup/scala/export.expect.txt create mode 100644 test/markup/scala/export.txt create mode 100644 test/markup/scala/given.expect.txt create mode 100644 test/markup/scala/given.txt diff --git a/CHANGES.md b/CHANGES.md index b66ef69a0f..2c7a9ce3e2 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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 diff --git a/src/languages/scala.js b/src/languages/scala.js index e9917c5619..6d8152e251 100644 --- a/src/languages/scala.js +++ b/src/languages/scala.js @@ -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, diff --git a/test/markup/scala/enum.expect.txt b/test/markup/scala/enum.expect.txt new file mode 100644 index 0000000000..1e95396f8e --- /dev/null +++ b/test/markup/scala/enum.expect.txt @@ -0,0 +1,6 @@ +enum Color: + case Red, Green, Blue + +enum State: + case On + case Off diff --git a/test/markup/scala/enum.txt b/test/markup/scala/enum.txt new file mode 100644 index 0000000000..24a17922ca --- /dev/null +++ b/test/markup/scala/enum.txt @@ -0,0 +1,6 @@ +enum Color: + case Red, Green, Blue + +enum State: + case On + case Off diff --git a/test/markup/scala/export.expect.txt b/test/markup/scala/export.expect.txt new file mode 100644 index 0000000000..8621c31270 --- /dev/null +++ b/test/markup/scala/export.expect.txt @@ -0,0 +1,2 @@ +export scanUnit.scan +export printUnit.{status => _, *} diff --git a/test/markup/scala/export.txt b/test/markup/scala/export.txt new file mode 100644 index 0000000000..7716ecead0 --- /dev/null +++ b/test/markup/scala/export.txt @@ -0,0 +1,2 @@ +export scanUnit.scan +export printUnit.{status => _, *} diff --git a/test/markup/scala/given.expect.txt b/test/markup/scala/given.expect.txt new file mode 100644 index 0000000000..81cef461ea --- /dev/null +++ b/test/markup/scala/given.expect.txt @@ -0,0 +1,2 @@ +given T = ??? +given x: T = ??? diff --git a/test/markup/scala/given.txt b/test/markup/scala/given.txt new file mode 100644 index 0000000000..c8b27a1b5d --- /dev/null +++ b/test/markup/scala/given.txt @@ -0,0 +1,2 @@ +given T = ??? +given x: T = ???