Skip to content

Support multiline inline tables (TOML 1.1.0) #374

Description

@gildor

TOML 1.1 allows inline tables to span multiple lines, with optional trailing commas and comments between key-value pairs (spec PR #904).

# This is valid TOML 1.1:
contact = {
    name = "Donald Duck",       # comments allowed
    email = "donald@duck.com",  # trailing comma allowed
}

# Nested multiline inline tables:
config = {
    personal = {
        name = "Donald Duck",
        email = "donald@duckburg.com",
    },
    work = {
        name = "Coin cleaner",
        email = "donald@ScroogeCorp.com",
    },
}

Current behavior

ktoml 0.7.1 crashes with:

Requested character count -1 is less than zero

So what must be supported changes:

  1. Newlines allowed between key-value pairs (via ws-comment-newline)
  2. Trailing comma permitted after the last key-value pair
  3. Comments allowed inside multiline inline tables

References

#360 - could be related, to this work, so will see how it goes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions