matklad / tom

tom: a format-preserving TOML parser in Rust
Apache License 2.0
38 stars 2 forks source link

Add logical model #13

Open matklad opened 6 years ago

matklad commented 6 years ago

Currently, we have two layered API: low-level CST and higher-level AST. The AST is still low-level, it does not say that [foo] bar.baz = 1 and [foo.bar] baz = 1 are the same thing.

We should add a higher-level TomlDoc::model API, which returns some sort-of JSON-like object. However, it is important to be able to map from logical model to concrete syntax, so I expect that these JSON will contain things like struct Integer { value: i64, ast: ast::Number }.

See for a preliminary idea: https://github.com/matklad/tom/blob/5a1b98e0b0b13529a917a9c2212f6813a9eb1948/src/model.rs

It would be super awesome if this logical model supported editing as well...