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 for quoted keys and values with special symbols

alanv opened this issue · comments

String.validateSymbols() in ktoml-core-jvm:0.5.0 performs an extra trimQuotes(), which prevents assignment to quoted keys containing special symbols.

For example, consider the following line of valid (per language docs) TOML:

"androidx.activity:activity-compose" = {}

This yields the following exception:

ParseException: <...>: Not able to parse the key: ["androidx.activity:activity-compose"] as it contains invalid symbols.

Yes, looks like it needs to be fixed. But have you tried single quotes as a workaround?

+1 to this. Using single quotes succeeds to parse, but the resulting keys have the quotes in the name, i.e.:

'foo:' = 'bar'

Would result to:

mapOf("'foo:'" to "bar")

The quotes are applied inconsistently to the keys and values.