-
-
Notifications
You must be signed in to change notification settings - Fork 39
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
Add parsing of inline tables #14
Comments
Blocked by #13 |
I played around a bit and I wrote a parser for inline tables, but it only works for simple key/value pairs at the moment.
I realized that it's much harder because key/value pairs and tables are stored in different data structures. Related problem:
which should be the same as
won't be parsed easily since it once again mixes key/value and table data types. One possibility to change that is to make the parsers return I also ran into something that bothers me a bit. The toml files
and
or
should, to my understanding, be parsed to the same tree, but since keys associated to values are separate from the table keys, all three input are saved differently. I think they should all be saved as the last input would be. That would probably help in checking name collisions and such. What do you think? |
I don't think this should be parsed to the same tree. Maybe only if you parse and then convert to JSON these configurations can have the same structure. But with TOML you can visually separate keys on tables and key-value pairs. There're two reasons to store keys and tables separately — optimisations and simplicity. You can see more uniform way to represent TOML in this library: But the goal of Regarding parsing things like this one: x = 1
table = { hello = "world"}
y = 2 I think that solution can be to replace the type of tomland/src/Toml/Parser/TOML.hs Line 17 in 713f232
To something like: keyValP :: Parser (Key, Either TOML AnyValue) And then you can convert |
Well then most of my problems go away, that's fine :)
I had explored that idea for a bit before I questioned the key/value - table structure, I'm glad that it wasn't a stupid idea ^^ |
* Added containers dependency * Added _Int and 4 list-type bimaps * used nonEmpty and cosmetic changes * Added ScopedTypeVariables to default extensions and removed from Combinators.hs * Made _BoundedInteger polymorphic * Parsing inline tables inline table treated with kev/value bug fix clean code * [#110] Example of TOML for the benchmarks (#114) * [#110] Add toml with data type * Improve FruitInside and SizeInside * Fix array to homogrneous * Delete * Add -02 * Swap digit with letter * Delete tomlData, fix types and names * Fix style * Changed hasKeyP signature * Signature for ditribute * Unit tests for hasKeyP * Test was incorrect * text instead of char in tableNameP
This might be convenient with #13.
The text was updated successfully, but these errors were encountered: