ktoml icon indicating copy to clipboard operation
ktoml copied to clipboard

Support for quoted keys and values with special symbols

Open alanv opened this issue 1 year ago • 2 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.

alanv avatar Jul 17 '23 22:07 alanv

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

orchestr7 avatar Aug 09 '23 16:08 orchestr7

+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.

mhozza avatar Apr 28 '24 19:04 mhozza