lawliet89 / ferrous-chloride

HCL parser, serializer and deserializer in Rust
https://lawliet89.github.io/ferrous-chloride/ferrous_chloride/
MIT License
8 stars 3 forks source link

Parsing HCL files #65

Open christos-h opened 4 years ago

christos-h commented 4 years ago

Hey! Love this crate.

Is there any functionality to parse HCL files into a collection of structs?

I would assume that some_type "some_label" { ... } would deserialize into some struct SomeType { labels: vec!["some_label"], ... }

I can see this project has not been worked on for a while, maybe you could point me in the right direction? (I realise you can already deserialize the body into a struct, but that doesn't really help me out.) I would love to contribute if you could point me in the right direction.

lawliet89 commented 4 years ago

The deserialization should help, if it works. It's quite hard to deserialize a HCL data model into Rust's data model. I never really figured out a satisfactory way of doing so.

I would try to conform the parsing to HCL 2's parsing rules and data model. If you would like to take a stab, you could try to take a look at Hashicorp's repo: https://github.com/hashicorp/hcl

I would like to work on this again, but it's done as a hobby so time's a bit short. My plans/wishlist are:

Sorry, I can't be more helpful at this point.