diff --git a/CHANGES.md b/CHANGES.md index b66ef69a0f..4835c14101 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 `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 e9917c5619..6a7e101af3 100644 --- a/src/languages/scala.js +++ b/src/languages/scala.js @@ -117,6 +117,11 @@ export default function(hljs) { contains: [ NAME ] }; + const INLINE = { + className: 'keyword', + begin: /(?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