-
-
Notifications
You must be signed in to change notification settings - Fork 528
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
Inline Table Support #70
Comments
Yes absolutely. This tracks the TOML spec (as does BurntSushi/toml-test). I have a very limited number of hours (if that) each day to work on side projects such as these, but certainly, anything that causes an incompatibility between this repo and the TOML spec should be a priority. Pull requests are always welcome, but I'll eventually get to it if nobody else does. |
Cool, I'm in a similar state - not enough time in the day for the side projects. If I can find some time though, I'll try to get to this - it's something I need for a side project. |
@ttacon Ah neat, that'd be awesome. My hope is that this can be done completely inside the lexer, which is reasonably simple once you've stared at it long enough (and with a good understanding of the TOML spec in your head). My fear is that this is wishful thinking and that the change will permeate into the parser, in which case, it will be quite a bit more hairy to implement. |
So adding it to the lexer took all of 2 minutes (the lexer was super nice to read 👍). The parser, however, wasn't too happy with the changes... I'm going to try to make any changes minimal, but I probably won't have time to really dig into this until later unfortunately. |
That's awesome. If you want to put progress on to Github, I'll happily pull and piggy back off of you (if I get to it before you). |
Just put the lexer changes I'd made at PR #71. |
Hey, I just put up some more code to make parsing inline tables functional. However, I didn't spend enough time with parser.go to really understand what other information needs to be relayed (such as metadata about the file/keys/types/etc that this package keeps track of). TBH, I also wasn't sure what metadata you'd like extracted. Let me know what you think, I might have some more time this week to spend more time looking at it. |
@BurntSushi Have you had any time to think about what metadata should be included in this (with respect to inline tables)? |
@BurntSushi ^ bumpety bump :) |
@ttacon I'm sorry, but I'm still in the middle of it. I'm not sure when I'll be up for air. I haven't looked at your patch yet, so I'll just spit out a few things about meta data that I think I know. The table
My hope is that your changes would happen at the lexer level and expose the table via Hopefully that helps some. |
No problem! Just was wondering if you had seen the updates or not! I'll take another look at just making the changes in the lexer! Hopefully your research isn't keeping you too busy! |
Just pushed some changes to make metadata parsing work, and added a test to decode_test. Let me know if that's what you had in mind. |
any updates? inline-table is really a cool feature. |
Anyone working on this? |
Ya, there's been an open PR in #71 for a while, just hasn't been merged. |
@BurntSushi At a quick glance the code in #71 looks good. Could you review it? |
any update? |
+1. Looks like they're getting close... |
Looking at that PR looks like it will support parsing inline tables from toml, but not generating them. I would like the ability to encode certain values within a toml configuration to be represented as inline tables. How difficult would this be to implement, is it something that would be accepted? I would anticipate implementing it by configuring the encoder to treat certain keys to be rendered as inline tables. I think it would be reasonable to enable inline-table style rendering recursively for all sub-tables of a specified table. |
@silasdavis @BurntSushi -- What about using a struct field tag, as in: type Foo struct {
Bar map[string]string `toml:"some_name,inline"`
} to cause |
We now support decoding inline tables so this issue is resolved (and our TOML 0.4.0 support is complete). I opened #160 for encoding inline tables. |
Hey, forgive me if I missed this. Recently, inline tables made it into the spec, is this on the roadmap for being supported in this package soon (meaning what kind of priority would supporting inline tables be, if it's one at all)? Just wondering! Also, awesome library!
The text was updated successfully, but these errors were encountered: