Skip to content

Support Nested Inline Tables#297

Merged
BOOMeranGG merged 1 commit into
mainfrom
support-nested-inline-tables
Mar 22, 2025
Merged

Support Nested Inline Tables#297
BOOMeranGG merged 1 commit into
mainfrom
support-nested-inline-tables

Conversation

@BOOMeranGG

@BOOMeranGG BOOMeranGG commented Mar 16, 2025

Copy link
Copy Markdown
Collaborator

Fixes #107

  • Support Nested Inline Tables
  • Support arrays in inline tables

First problem was in TomlInlineTable::parseInlineTableValue, when we called .split(","). It doesn't work with arrays (cause they also have comma) and with nested inline tables. Now we do the same split, but ignore all commas inside arrays/nested inline.

Second problem was in TomlInlineTable::returnTable, in test case we had this TomlTable fullTableKey:
image

@BOOMeranGG
BOOMeranGG requested a review from orchestr7 March 16, 2025 15:13
val table2: Table2,
)

val test =

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, it looks like deserialization should go in a little bit different way: toml-lang/toml#879

table2 = { table2."akuleshov7.com" = { name = "test" }, i = 1 }

is equal to the following one:

[table2]
    i = 1
[table2.table2."akuleshov7.com"]
    name = "test"

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So in Table2 class there should be another one table2 field

@orchestr7 orchestr7 Mar 16, 2025

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will be also great if you could add a test which deserializes the following code:

[table2]
    i = 1
[table2.table2."akuleshov7.com"]
    name = "test"

to same structures. Just to make it more obvious

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, brat! LGTM. Free to merge (don't forget to squash)


@Test
@Ignore
fun decodeSimpleInlineTable() {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BOOMeranGG can you please also add the second example:
table2 = { "akuleshov7.com" = { name = "test" }, i = 1 }

toml-lang/toml#879

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in test fun decodeInlineTable()

@BOOMeranGG
BOOMeranGG force-pushed the support-nested-inline-tables branch from 4c65e1f to 01d8495 Compare March 22, 2025 08:33
@BOOMeranGG
BOOMeranGG force-pushed the support-nested-inline-tables branch from 01d8495 to bd19a11 Compare March 22, 2025 08:34
@BOOMeranGG
BOOMeranGG merged commit 80a1f36 into main Mar 22, 2025
@BOOMeranGG
BOOMeranGG deleted the support-nested-inline-tables branch March 22, 2025 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add the proper support of nested inline tables

2 participants