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

OrderedTable support #44

Closed
Patitotective opened this issue Jun 9, 2022 · 3 comments
Closed

OrderedTable support #44

Patitotective opened this issue Jun 9, 2022 · 3 comments

Comments

@Patitotective
Copy link

I'm using this library to parse a TOML file where I describe some tables that will later become graphical elements, it will be cool if there were some TomlKind.OrderedTable or TomlFlag.TomlOrderedTable so the elements look in the order you defined them.

@Patitotective
Copy link
Author

Or simply turn TomlTable into OrderedTable[string, TomlValueRef]

@jangko
Copy link
Collaborator

jangko commented Jun 12, 2022

fixed by #45.

You can use -d:tomlOrderedTable to switch TomlTable into OrderedTable when parsing.
But because elements ordering is not mandated and even not not guaranteed by the spec, ordered table only supported by reader/parser/decoder. The writer/encoder cannot support full toml spec if using ordered table. there are cases related to dotted key where it's simply too hard or almost impossible to implement an ordered top level elements because dotted keys original form is destroyed during parsing, and when the generalized form of table is serialized, it will create different structure than the original document.

@jangko jangko closed this as completed Jun 12, 2022
@Patitotective
Copy link
Author

Thank you for the quick implementation. 🙃

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

No branches or pull requests

2 participants