Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tableMap Codec with implicit tables not parsed #336

Open
everythingfunctional opened this issue Aug 28, 2020 · 3 comments
Open

tableMap Codec with implicit tables not parsed #336

everythingfunctional opened this issue Aug 28, 2020 · 3 comments
Labels
question Further information is requested

Comments

@everythingfunctional
Copy link
Contributor

I got a report from one of my users that the tableMap codec isn't working with implicit tables.

I did a little bit of playing with the examples/biTest.toml file and found that it still worked if I changed

[colours]
yellow = "#FFFF00"
red    = { red = 255, green = 0, blue = 0 }
pink   = "#FFC0CB"

to

[colours]
yellow = "#FFFF00"
pink   = "#FFC0CB"
[colours.red]
  red = 255
  green = 0
  blue = 0

still get output

[colours]
  pink = "#FFC0CB"
  yellow = "#FFFF00"

  [colours.red]
    blue = 0
    green = 0
    red = 255

but if I changed it to

[colours.red]
red = 255
green = 0
blue = 0

or

[colours.red]
    blue = 0
    green = 0
    red = 255

[colours.pink]
    red = 255
    green = 208
    blue = 220

then the output is just

[colours]

I'm guessing that the keys aren't combined into a single table without the single table declaration, and then the converter isn't picking them up. I'm a bit out of my depth on how to fix it though.

@everythingfunctional
Copy link
Contributor Author

tried one more. this

[colours.red]
red = 255
green = 0
blue = 0

[colours]
yellow = "#FFFF00"
pink   = "#FFC0CB"

only gives output

[colours]
  pink = "#FFC0CB"
  yellow = "#FFFF00"

@chshersh chshersh added the question Further information is requested label Aug 30, 2020
@chshersh
Copy link
Contributor

Hi @everythingfunctional! Thanks for reporting the problem with the specific use-case. tomland indeed doesn't handle implicit tables in the same way as explicit at the moment. The problem is that during parsing we don't keep information about whether the table is explicit or implicit. @vrom911 and I tried working on a patch for this problem but turns out that it requires a lot of work and massive changes to internal TOML AST representation. Changing TOML AST will have some other benefits as well, but it's a lot of work. It's definitely on our roadmap but it will take some time.

Current workaround is to specify implicit tables explicitly. Sorry for the inconvenience.

@everythingfunctional
Copy link
Contributor Author

I had it feeling it might be complicated. Glad to hear it's at least in the plan. Thanks for looking into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants