missed file
This commit is contained in:
parent
d2c732ceef
commit
86d59abfbc
19
library/src/commonMain/kotlin/net/sergeych/ling/ObjChar.kt
Normal file
19
library/src/commonMain/kotlin/net/sergeych/ling/ObjChar.kt
Normal file
@ -0,0 +1,19 @@
|
||||
package net.sergeych.ling
|
||||
|
||||
class ObjChar(val value: Char): Obj() {
|
||||
|
||||
override val objClass: ObjClass = type
|
||||
|
||||
override suspend fun compareTo(context: Context, other: Obj): Int =
|
||||
(other as? ObjChar)?.let { value.compareTo(it.value) } ?: -1
|
||||
|
||||
override fun toString(): String = value.toString()
|
||||
|
||||
override fun inspect(): String = "'$value'"
|
||||
|
||||
companion object {
|
||||
val type = ObjClass("Char").apply {
|
||||
addFn("code") { ObjInt(thisAs<ObjChar>().value.code.toLong()) }
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user