diff --git a/CHANGES.md b/CHANGES.md
index 112ed8561b..96dfc0bd69 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -18,6 +18,7 @@ Grammars:
- 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][]
+- enh(scala) add `inline` soft keyword (#3329) [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 ae84bff1f5..053db9c2e0 100644
--- a/src/languages/scala.js
+++ b/src/languages/scala.js
@@ -112,6 +112,14 @@ export default function(hljs) {
contains: [ NAME ]
};
+ const INLINE_NAME_SELECT = {
+ match: /\.inline\b/
+ };
+ const INLINE = {
+ begin: /\binline(?=\s)/,
+ keywords: 'inline'
+ };
+
return {
name: 'Scala',
keywords: {
@@ -126,6 +134,8 @@ export default function(hljs) {
METHOD,
CLASS,
hljs.C_NUMBER_MODE,
+ INLINE_NAME_SELECT,
+ INLINE,
ANNOTATION
]
};
diff --git a/test/markup/scala/inline.expect.txt b/test/markup/scala/inline.expect.txt
new file mode 100644
index 0000000000..e15b3e0663
--- /dev/null
+++ b/test/markup/scala/inline.expect.txt
@@ -0,0 +1,15 @@
+inline def pow(inline x: Int, inline n: Int) = ???
+transparent inline def f: Int = ???
+inline val a: Int = 9
+inline given Int = 9
+
+notinline given Int = 9
+
+def expressions =
+ inline if true then () else ()
+ inline x match ...
+
+ x.inline
+ x.inline(y)
+ x.inline[T]
+ `inline` + 1
diff --git a/test/markup/scala/inline.txt b/test/markup/scala/inline.txt
new file mode 100644
index 0000000000..857b82ac8c
--- /dev/null
+++ b/test/markup/scala/inline.txt
@@ -0,0 +1,15 @@
+inline def pow(inline x: Int, inline n: Int) = ???
+transparent inline def f: Int = ???
+inline val a: Int = 9
+inline given Int = 9
+
+notinline given Int = 9
+
+def expressions =
+ inline if true then () else ()
+ inline x match ...
+
+ x.inline
+ x.inline(y)
+ x.inline[T]
+ `inline` + 1