Repository: alecthomas/chroma
Pull request #389 (2020-08-11 10:04:19)

Improvements to kotlin lexer
Hi,

I was using a project that uses chroma for code highlighting and noticed that my kotlin code wasn't highlighting a specific keyword: `typealias`. 

I wanted to bring support for it and then I found a bunch of other keywords and operators that were missing too so decided to fix them too.

For reference, I used this page as a source of keywords: https://kotlinlang.org/docs/reference/keyword-reference.html

There are a few gotchas. For example, some of the words are [soft keywods](https://kotlinlang.org/docs/reference/keyword-reference.html)

> tokens act as keywords in the context when they are applicable and can be used as identifiers in other contexts

I could see some of them already listed as keywords so I took the same approach. 

I also found a few other things the lexer could do that doesn't support yet:

* doesn't highlight string templates ("hello $name")
* doesn't highlight `reified` in `inline fun <reified T> method()` (the angle brackets and everything between are marked as text)

I might give a shot at some of these extras but for now I am leaving this hopefully simpler.

Additionally, here are some concerns I have:

* I also noticed that many single-character operators (`% = +`) are marked as punctuation instead of operators. I think I also saw this in other languages.
   * Is this the way this project wants to parse those characters?
* The parsing of some names with backticks is broken (it outputs `"type":"Error"`). In that example, I suspect it is the `+` causing the problem.

```kotlin
// Example of method names with backticks that is broken:
val ` + "with spaces" + ` = "hello"

// but this works fine:
fun ` with spaces`() = Unit
```

With regards to testing:
* Some of the kotlin in kotlin.actual was invalid code, so I fixed that.
* Added a bit more code to exercise some of the new things I added (and verify others that were already implemented). I manually went through the output and it seemed correct to me 🤓 😵 


Patch:
diff --git a/lexers/k/kotlin.go b/lexers/k/kotlin.go
index 56b7966..3e90af7 100644
--- a/lexers/k/kotlin.go
+++ b/lexers/k/kotlin.go
@@ -24,8 +24,9 @@ var Kotlin = internal.Register(MustNewLexer(
 			{`//[^\n]*\n?`, CommentSingle, nil},
 			{`/[*].*?[*]/`, CommentMultiline, nil},
 			{`\n`, Text, nil},
-			{`::|!!|\?[:.]`, Operator, nil},
-			{`[~!%^&*()+=|\[\]:;,.<>/?-]`, Punctuation, nil},
+			{`!==|!in|!is|===`, Operator, nil},
+			{`%=|&&|\*=|\+\+|\+=|--|-=|->|\.\.|\/=|::|<=|==|>=|!!|!=|\|\||\?[:.]`, Operator, nil},
+			{`[~!%^&*()+=|\[\]:;,.<>\/?-]`, Punctuation, nil},
 			{`[{}]`, Punctuation, nil},
 			{`"""[^"]*"""`, LiteralString, nil},
 			{`"(\\\\|\\"|[^"\n])*["\n]`, LiteralString, nil},
@@ -36,7 +37,7 @@ var Kotlin = internal.Register(MustNewLexer(
 			{`(package|import)(\s+)`, ByGroups(Keyword, Text), Push("package")},
 			{`(val|var)(\s+)`, ByGroups(Keyword, Text), Push("property")},
 			{`(fun)(\s+)(<[^>]*>\s+)?`, ByGroups(Keyword, Text, Text), Push("function")},
-			{`(abstract|actual|annotation|as|break|by|catch|class|companion|const|constructor|continue|crossinline|data|do|dynamic|else|enum|expect|external|false|final|finally|for|fun|get|if|import|in|infix|inline|inner|interface|internal|is|lateinit|noinline|null|object|open|operator|out|override|package|private|protected|public|reified|return|sealed|set|super|suspend|tailrec|this|throw|true|try|val|var|vararg|when|where|while)\b`, Keyword, nil},
+			{`(abstract|actual|annotation|as|as\?|break|by|catch|class|companion|const|constructor|continue|crossinline|data|delegate|do|dynamic|else|enum|expect|external|false|field|file|final|finally|for|fun|get|if|import|in|infix|init|inline|inner|interface|internal|is|it|lateinit|noinline|null|object|open|operator|out|override|package|param|private|property|protected|public|receiver|reified|return|sealed|set|setparam|super|suspend|tailrec|this|throw|true|try|typealias|typeof|val|var|vararg|when|where|while)\b`, Keyword, nil},
 			{"(@?[" + kotlinIdentifier + "]*`)", Name, nil},
 		},
 		"package": {


Test patch:
diff --git a/lexers/testdata/kotlin.actual b/lexers/testdata/kotlin.actual
index 7dbd8ea..e28a03a 100644
--- a/lexers/testdata/kotlin.actual
+++ b/lexers/testdata/kotlin.actual
@@ -4,19 +4,70 @@ import A
 import B.*
 
 fun main(args: Array<String>) {
-  val ` + "`with spaces`" + ` = "hello"
-  val multiline = """1
+    val ` + "with spaces" + ` = "hello"
+    val multiline = """1
 2"""
-  StringBuilder().apply {
-    append(multiline)
-  }
-  val unsigned = 0x00UL + 123u + 76.54
+    StringBuilder().apply {
+        append(multiline)
+    }
+    val unsigned = 0x00UL + 123u + 76.54
 }
 /*
 */
 
+fun nullable(nullable: String?): Int = nullable?.length ?: 0
+
+fun nullable2(nullable: String?): Int = nullable?.length ?: run {
+    1 + 2
+}
+
+typealias MySecretAlias<A, B> = (A, B) -> Unit
+
+val impl : MySecretAlias<Int, Int> = { a, _ -> Unit }
+
+fun someOperators(a: Int, b: Int) {
+    var c : Int = 123
+    println("This is an example a = $a and the sum is ${a + b} ${ A.foo() }")
+    println( a % b)
+    println(c in a..b)
+    
+    a %= 2
+	a && b
+	a *= 2
+	a++
+	b+=2
+	b--
+	a-=1
+	a /= 2
+	a <= b
+	b == a
+	a >= b
+	nullable!!
+	a != b
+	a || b
+	a?.foo
+	a ?: b
+}
+
+class B // no braces
+
+data class C(
+    val s: String
+)
+
+fun moreOperators(arg: Any?) {
+    when(arg) {
+        !is Int -> { }
+        is Number -> {}
+        in emptyList<Int>() -> { }
+    }
+
+    if(arg !== Boolean)
+    	println(arg === Unit)
+}
+
 class X {
-  companion object {
-  }
-  suspend inline <reified T> generic(t: T) { print(T::class.name) }
+    companion object {
+    }
+    suspend inline fun <reified T>  generic(t: T) { print(T::class.simpleName) }
 } // eof comment
\ No newline at end of file
diff --git a/lexers/testdata/kotlin.expected b/lexers/testdata/kotlin.expected
index cd7574b..f562eee 100644
--- a/lexers/testdata/kotlin.expected
+++ b/lexers/testdata/kotlin.expected
@@ -24,15 +24,17 @@
   {"type":"Punctuation","value":"\u003e)"},
   {"type":"Text","value":" "},
   {"type":"Punctuation","value":"{"},
-  {"type":"Text","value":"\n  "},
+  {"type":"Text","value":"\n    "},
   {"type":"Keyword","value":"val"},
   {"type":"Text","value":" "},
   {"type":"Error","value":"` + \""},
-  {"type":"NameProperty","value":"`with spaces`"},
+  {"type":"NameProperty","value":"with"},
+  {"type":"Text","value":" "},
+  {"type":"Name","value":"spaces"},
   {"type":"LiteralString","value":"\" + ` = \""},
   {"type":"Name","value":"hello"},
   {"type":"LiteralString","value":"\"\n"},
-  {"type":"Text","value":"  "},
+  {"type":"Text","value":"    "},
   {"type":"Keyword","value":"val"},
   {"type":"Text","value":" "},
   {"type":"NameProperty","value":"multiline"},
@@ -40,20 +42,20 @@
   {"type":"Punctuation","value":"="},
   {"type":"Text","value":" "},
   {"type":"LiteralString","value":"\"\"\"1\n2\"\"\""},
-  {"type":"Text","value":"\n  "},
+  {"type":"Text","value":"\n    "},
   {"type":"Name","value":"StringBuilder"},
   {"type":"Punctuation","value":"()."},
   {"type":"Name","value":"apply"},
   {"type":"Text","value":" "},
   {"type":"Punctuation","value":"{"},
-  {"type":"Text","value":"\n    "},
+  {"type":"Text","value":"\n        "},
   {"type":"Name","value":"append"},
   {"type":"Punctuation","value":"("},
   {"type":"Name","value":"multiline"},
   {"type":"Punctuation","value":")"},
-  {"type":"Text","value":"\n  "},
+  {"type":"Text","value":"\n    "},
   {"type":"Punctuation","value":"}"},
-  {"type":"Text","value":"\n  "},
+  {"type":"Text","value":"\n    "},
   {"type":"Keyword","value":"val"},
   {"type":"Text","value":" "},
   {"type":"NameProperty","value":"unsigned"},
@@ -74,31 +76,366 @@
   {"type":"Text","value":"\n"},
   {"type":"CommentMultiline","value":"/*\n*/"},
   {"type":"Text","value":"\n\n"},
+  {"type":"Keyword","value":"fun"},
+  {"type":"Text","value":" "},
+  {"type":"NameFunction","value":"nullable"},
+  {"type":"Punctuation","value":"("},
+  {"type":"Name","value":"nullable"},
+  {"type":"Punctuation","value":":"},
+  {"type":"Text","value":" "},
+  {"type":"Name","value":"String"},
+  {"type":"Punctuation","value":"?):"},
+  {"type":"Text","value":" "},
+  {"type":"Name","value":"Int"},
+  {"type":"Text","value":" "},
+  {"type":"Punctuation","value":"="},
+  {"type":"Text","value":" "},
+  {"type":"Name","value":"nullable"},
+  {"type":"Operator","value":"?."},
+  {"type":"Name","value":"length"},
+  {"type":"Text","value":" "},
+  {"type":"Operator","value":"?:"},
+  {"type":"Text","value":" "},
+  {"type":"LiteralNumber","value":"0"},
+  {"type":"Text","value":"\n\n"},
+  {"type":"Keyword","value":"fun"},
+  {"type":"Text","value":" "},
+  {"type":"NameFunction","value":"nullable2"},
+  {"type":"Punctuation","value":"("},
+  {"type":"Name","value":"nullable"},
+  {"type":"Punctuation","value":":"},
+  {"type":"Text","value":" "},
+  {"type":"Name","value":"String"},
+  {"type":"Punctuation","value":"?):"},
+  {"type":"Text","value":" "},
+  {"type":"Name","value":"Int"},
+  {"type":"Text","value":" "},
+  {"type":"Punctuation","value":"="},
+  {"type":"Text","value":" "},
+  {"type":"Name","value":"nullable"},
+  {"type":"Operator","value":"?."},
+  {"type":"Name","value":"length"},
+  {"type":"Text","value":" "},
+  {"type":"Operator","value":"?:"},
+  {"type":"Text","value":" "},
+  {"type":"Name","value":"run"},
+  {"type":"Text","value":" "},
+  {"type":"Punctuation","value":"{"},
+  {"type":"Text","value":"\n    "},
+  {"type":"LiteralNumber","value":"1"},
+  {"type":"Text","value":" "},
+  {"type":"Punctuation","value":"+"},
+  {"type":"Text","value":" "},
+  {"type":"LiteralNumber","value":"2"},
+  {"type":"Text","value":"\n"},
+  {"type":"Punctuation","value":"}"},
+  {"type":"Text","value":"\n\n"},
+  {"type":"Keyword","value":"typealias"},
+  {"type":"Text","value":" "},
+  {"type":"Name","value":"MySecretAlias"},
+  {"type":"Punctuation","value":"\u003c"},
+  {"type":"Name","value":"A"},
+  {"type":"Punctuation","value":","},
+  {"type":"Text","value":" "},
+  {"type":"Name","value":"B"},
+  {"type":"Punctuation","value":"\u003e"},
+  {"type":"Text","value":" "},
+  {"type":"Punctuation","value":"="},
+  {"type":"Text","value":" "},
+  {"type":"Punctuation","value":"("},
+  {"type":"Name","value":"A"},
+  {"type":"Punctuation","value":","},
+  {"type":"Text","value":" "},
+  {"type":"Name","value":"B"},
+  {"type":"Punctuation","value":")"},
+  {"type":"Text","value":" "},
+  {"type":"Operator","value":"-\u003e"},
+  {"type":"Text","value":" "},
+  {"type":"Name","value":"Unit"},
+  {"type":"Text","value":"\n\n"},
+  {"type":"Keyword","value":"val"},
+  {"type":"Text","value":" "},
+  {"type":"NameProperty","value":"impl"},
+  {"type":"Text","value":" "},
+  {"type":"Punctuation","value":":"},
+  {"type":"Text","value":" "},
+  {"type":"Name","value":"MySecretAlias"},
+  {"type":"Punctuation","value":"\u003c"},
+  {"type":"Name","value":"Int"},
+  {"type":"Punctuation","value":","},
+  {"type":"Text","value":" "},
+  {"type":"Name","value":"Int"},
+  {"type":"Punctuation","value":"\u003e"},
+  {"type":"Text","value":" "},
+  {"type":"Punctuation","value":"="},
+  {"type":"Text","value":" "},
+  {"type":"Punctuation","value":"{"},
+  {"type":"Text","value":" "},
+  {"type":"Name","value":"a"},
+  {"type":"Punctuation","value":","},
+  {"type":"Text","value":" "},
+  {"type":"Name","value":"_"},
+  {"type":"Text","value":" "},
+  {"type":"Operator","value":"-\u003e"},
+  {"type":"Text","value":" "},
+  {"type":"Name","value":"Unit"},
+  {"type":"Text","value":" "},
+  {"type":"Punctuation","value":"}"},
+  {"type":"Text","value":"\n\n"},
+  {"type":"Keyword","value":"fun"},
+  {"type":"Text","value":" "},
+  {"type":"NameFunction","value":"someOperators"},
+  {"type":"Punctuation","value":"("},
+  {"type":"Name","value":"a"},
+  {"type":"Punctuation","value":":"},
+  {"type":"Text","value":" "},
+  {"type":"Name","value":"Int"},
+  {"type":"Punctuation","value":","},
+  {"type":"Text","value":" "},
+  {"type":"Name","value":"b"},
+  {"type":"Punctuation","value":":"},
+  {"type":"Text","value":" "},
+  {"type":"Name","value":"Int"},
+  {"type":"Punctuation","value":")"},
+  {"type":"Text","value":" "},
+  {"type":"Punctuation","value":"{"},
+  {"type":"Text","value":"\n    "},
+  {"type":"Keyword","value":"var"},
+  {"type":"Text","value":" "},
+  {"type":"NameProperty","value":"c"},
+  {"type":"Text","value":" "},
+  {"type":"Punctuation","value":":"},
+  {"type":"Text","value":" "},
+  {"type":"Name","value":"Int"},
+  {"type":"Text","value":" "},
+  {"type":"Punctuation","value":"="},
+  {"type":"Text","value":" "},
+  {"type":"LiteralNumber","value":"123"},
+  {"type":"Text","value":"\n    "},
+  {"type":"Name","value":"println"},
+  {"type":"Punctuation","value":"("},
+  {"type":"LiteralString","value":"\"This is an example a = $a and the sum is ${a + b} ${ A.foo() }\""},
+  {"type":"Punctuation","value":")"},
+  {"type":"Text","value":"\n    "},
+  {"type":"Name","value":"println"},
+  {"type":"Punctuation","value":"("},
+  {"type":"Text","value":" "},
+  {"type":"Name","value":"a"},
+  {"type":"Text","value":" "},
+  {"type":"Punctuation","value":"%"},
+  {"type":"Text","value":" "},
+  {"type":"Name","value":"b"},
+  {"type":"Punctuation","value":")"},
+  {"type":"Text","value":"\n    "},
+  {"type":"Name","value":"println"},
+  {"type":"Punctuation","value":"("},
+  {"type":"Name","value":"c"},
+  {"type":"Text","value":" "},
+  {"type":"Keyword","value":"in"},
+  {"type":"Text","value":" "},
+  {"type":"Name","value":"a"},
+  {"type":"Operator","value":".."},
+  {"type":"Name","value":"b"},
+  {"type":"Punctuation","value":")"},
+  {"type":"Text","value":"\n    \n    "},
+  {"type":"Name","value":"a"},
+  {"type":"Text","value":" "},
+  {"type":"Operator","value":"%="},
+  {"type":"Text","value":" "},
+  {"type":"LiteralNumber","value":"2"},
+  {"type":"Text","value":"\n\t"},
+  {"type":"Name","value":"a"},
+  {"type":"Text","value":" "},
+  {"type":"Operator","value":"\u0026\u0026"},
+  {"type":"Text","value":" "},
+  {"type":"Name","value":"b"},
+  {"type":"Text","value":"\n\t"},
+  {"type":"Name","value":"a"},
+  {"type":"Text","value":" "},
+  {"type":"Operator","value":"*="},
+  {"type":"Text","value":" "},
+  {"type":"LiteralNumber","value":"2"},
+  {"type":"Text","value":"\n\t"},
+  {"type":"Name","value":"a"},
+  {"type":"Operator","value":"++"},
+  {"type":"Text","value":"\n\t"},
+  {"type":"Name","value":"b"},
+  {"type":"Operator","value":"+="},
+  {"type":"LiteralNumber","value":"2"},
+  {"type":"Text","value":"\n\t"},
+  {"type":"Name","value":"b"},
+  {"type":"Operator","value":"--"},
+  {"type":"Text","value":"\n\t"},
+  {"type":"Name","value":"a"},
+  {"type":"Operator","value":"-="},
+  {"type":"LiteralNumber","value":"1"},
+  {"type":"Text","value":"\n\t"},
+  {"type":"Name","value":"a"},
+  {"type":"Text","value":" "},
+  {"type":"Operator","value":"/="},
+  {"type":"Text","value":" "},
+  {"type":"LiteralNumber","value":"2"},
+  {"type":"Text","value":"\n\t"},
+  {"type":"Name","value":"a"},
+  {"type":"Text","value":" "},
+  {"type":"Operator","value":"\u003c="},
+  {"type":"Text","value":" "},
+  {"type":"Name","value":"b"},
+  {"type":"Text","value":"\n\t"},
+  {"type":"Name","value":"b"},
+  {"type":"Text","value":" "},
+  {"type":"Operator","value":"=="},
+  {"type":"Text","value":" "},
+  {"type":"Name","value":"a"},
+  {"type":"Text","value":"\n\t"},
+  {"type":"Name","value":"a"},
+  {"type":"Text","value":" "},
+  {"type":"Operator","value":"\u003e="},
+  {"type":"Text","value":" "},
+  {"type":"Name","value":"b"},
+  {"type":"Text","value":"\n\t"},
+  {"type":"Name","value":"nullable"},
+  {"type":"Operator","value":"!!"},
+  {"type":"Text","value":"\n\t"},
+  {"type":"Name","value":"a"},
+  {"type":"Text","value":" "},
+  {"type":"Operator","value":"!="},
+  {"type":"Text","value":" "},
+  {"type":"Name","value":"b"},
+  {"type":"Text","value":"\n\t"},
+  {"type":"Name","value":"a"},
+  {"type":"Text","value":" "},
+  {"type":"Operator","value":"||"},
+  {"type":"Text","value":" "},
+  {"type":"Name","value":"b"},
+  {"type":"Text","value":"\n\t"},
+  {"type":"Name","value":"a"},
+  {"type":"Operator","value":"?."},
+  {"type":"Name","value":"foo"},
+  {"type":"Text","value":"\n\t"},
+  {"type":"Name","value":"a"},
+  {"type":"Text","value":" "},
+  {"type":"Operator","value":"?:"},
+  {"type":"Text","value":" "},
+  {"type":"Name","value":"b"},
+  {"type":"Text","value":"\n"},
+  {"type":"Punctuation","value":"}"},
+  {"type":"Text","value":"\n\n"},
+  {"type":"Keyword","value":"class"},
+  {"type":"Text","value":" "},
+  {"type":"NameClass","value":"B"},
+  {"type":"Text","value":" "},
+  {"type":"CommentSingle","value":"// no braces\n"},
+  {"type":"Text","value":"\n"},
+  {"type":"Keyword","value":"data"},
+  {"type":"Text","value":" "},
+  {"type":"Keyword","value":"class"},
+  {"type":"Text","value":" "},
+  {"type":"NameClass","value":"C"},
+  {"type":"Punctuation","value":"("},
+  {"type":"Text","value":"\n    "},
+  {"type":"Keyword","value":"val"},
+  {"type":"Text","value":" "},
+  {"type":"NameProperty","value":"s"},
+  {"type":"Punctuation","value":":"},
+  {"type":"Text","value":" "},
+  {"type":"Name","value":"String"},
+  {"type":"Text","value":"\n"},
+  {"type":"Punctuation","value":")"},
+  {"type":"Text","value":"\n\n"},
+  {"type":"Keyword","value":"fun"},
+  {"type":"Text","value":" "},
+  {"type":"NameFunction","value":"moreOperators"},
+  {"type":"Punctuation","value":"("},
+  {"type":"Name","value":"arg"},
+  {"type":"Punctuation","value":":"},
+  {"type":"Text","value":" "},
+  {"type":"Name","value":"Any"},
+  {"type":"Punctuation","value":"?)"},
+  {"type":"Text","value":" "},
+  {"type":"Punctuation","value":"{"},
+  {"type":"Text","value":"\n    "},
+  {"type":"Keyword","value":"when"},
+  {"type":"Punctuation","value":"("},
+  {"type":"Name","value":"arg"},
+  {"type":"Punctuation","value":")"},
+  {"type":"Text","value":" "},
+  {"type":"Punctuation","value":"{"},
+  {"type":"Text","value":"\n        "},
+  {"type":"Operator","value":"!is"},
+  {"type":"Text","value":" "},
+  {"type":"Name","value":"Int"},
+  {"type":"Text","value":" "},
+  {"type":"Operator","value":"-\u003e"},
+  {"type":"Text","value":" "},
+  {"type":"Punctuation","value":"{"},
+  {"type":"Text","value":" "},
+  {"type":"Punctuation","value":"}"},
+  {"type":"Text","value":"\n        "},
+  {"type":"Keyword","value":"is"},
+  {"type":"Text","value":" "},
+  {"type":"Name","value":"Number"},
+  {"type":"Text","value":" "},
+  {"type":"Operator","value":"-\u003e"},
+  {"type":"Text","value":" "},
+  {"type":"Punctuation","value":"{}"},
+  {"type":"Text","value":"\n        "},
+  {"type":"Keyword","value":"in"},
+  {"type":"Text","value":" "},
+  {"type":"Name","value":"emptyList"},
+  {"type":"Punctuation","value":"\u003c"},
+  {"type":"Name","value":"Int"},
+  {"type":"Punctuation","value":"\u003e()"},
+  {"type":"Text","value":" "},
+  {"type":"Operator","value":"-\u003e"},
+  {"type":"Text","value":" "},
+  {"type":"Punctuation","value":"{"},
+  {"type":"Text","value":" "},
+  {"type":"Punctuation","value":"}"},
+  {"type":"Text","value":"\n    "},
+  {"type":"Punctuation","value":"}"},
+  {"type":"Text","value":"\n\n    "},
+  {"type":"Keyword","value":"if"},
+  {"type":"Punctuation","value":"("},
+  {"type":"Name","value":"arg"},
+  {"type":"Text","value":" "},
+  {"type":"Operator","value":"!=="},
+  {"type":"Text","value":" "},
+  {"type":"Name","value":"Boolean"},
+  {"type":"Punctuation","value":")"},
+  {"type":"Text","value":"\n    \t"},
+  {"type":"Name","value":"println"},
+  {"type":"Punctuation","value":"("},
+  {"type":"Name","value":"arg"},
+  {"type":"Text","value":" "},
+  {"type":"Operator","value":"==="},
+  {"type":"Text","value":" "},
+  {"type":"Name","value":"Unit"},
+  {"type":"Punctuation","value":")"},
+  {"type":"Text","value":"\n"},
+  {"type":"Punctuation","value":"}"},
+  {"type":"Text","value":"\n\n"},
   {"type":"Keyword","value":"class"},
   {"type":"Text","value":" "},
   {"type":"NameClass","value":"X"},
   {"type":"Text","value":" "},
   {"type":"Punctuation","value":"{"},
-  {"type":"Text","value":"\n  "},
+  {"type":"Text","value":"\n    "},
   {"type":"Keyword","value":"companion"},
   {"type":"Text","value":" "},
   {"type":"Keyword","value":"object"},
   {"type":"Text","value":" "},
   {"type":"Punctuation","value":"{"},
-  {"type":"Text","value":"\n  "},
+  {"type":"Text","value":"\n    "},
   {"type":"Punctuation","value":"}"},
-  {"type":"Text","value":"\n  "},
+  {"type":"Text","value":"\n    "},
   {"type":"Keyword","value":"suspend"},
   {"type":"Text","value":" "},
   {"type":"Keyword","value":"inline"},
   {"type":"Text","value":" "},
-  {"type":"Punctuation","value":"\u003c"},
-  {"type":"Keyword","value":"reified"},
-  {"type":"Text","value":" "},
-  {"type":"Name","value":"T"},
-  {"type":"Punctuation","value":"\u003e"},
-  {"type":"Text","value":" "},
-  {"type":"Name","value":"generic"},
+  {"type":"Keyword","value":"fun"},
+  {"type":"Text","value":" \u003creified T\u003e  "},
+  {"type":"NameFunction","value":"generic"},
   {"type":"Punctuation","value":"("},
   {"type":"Name","value":"t"},
   {"type":"Punctuation","value":":"},
@@ -114,7 +451,7 @@
   {"type":"Operator","value":"::"},
   {"type":"Keyword","value":"class"},
   {"type":"Punctuation","value":"."},
-  {"type":"Name","value":"name"},
+  {"type":"Name","value":"simpleName"},
   {"type":"Punctuation","value":")"},
   {"type":"Text","value":" "},
   {"type":"Punctuation","value":"}"},