akuleshov7 / ktoml

Kotlin Multiplatform parser and compile-time serializer/deserializer for TOML format (Native, JS, JVM) based on KxS

Home Page:https://akuleshov7.github.io/ktoml

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support TomlMultiline and TomlInteger annotations

NightEule5 opened this issue · comments

Currently, when TomlMultiline and TomlInteger are encountered during serialization, an UnsupportedEncodingFeatureException is thrown. This is because the tree doesn't support these yet. TomlMultiline would apply to basic and literal string pairs, and possibly primitive arrays. TomlInteger would apply to integer pairs.

We could add a multiline property to the primary constructor of TomlLiteralString, TomlBasicString, and TomlArray, like this:

public class TomlLiteralString
internal constructor(
    override var content: Any,
    lineNo: Int,
    public val multiline: Boolean,
)

And a representation property to TomlLong:

public class TomlLong
internal constructor(
    override var content: Any,
    lineNo: Int,
    public val representation: IntegerRepresentation
)

Also need to support parsing of multiline strings finally. I started pre-refactoring for it, check #162