martinohmann / hcl-rs

HCL parsing and encoding libraries for rust with serde support
Apache License 2.0
121 stars 14 forks source link

refactor(parser)!: switch to `hcl-edit` for parsing HCL #267

Closed martinohmann closed 1 year ago

martinohmann commented 1 year ago

BREAKING CHANGES: The parser will now return an error if it encounters a duplicate attribute in a HCL body. Furthermore, the Message variant of the Error type was changed from Message { msg: String, location: Option<Location> } to Message(String) and the Location type was removed from the error module. Use the location() method of the error wrapped by the new Error::Parse variant to get access to the location where the parser failed.

The old pest parser was replaced by the winnow-based parser that is used by hcl-edit. There's only one HCL parser implementation that needs to be maintained now.

The hcl-edit parser is more correct and also over 100% faster than the old pest-based implementation.

As a nice side effect, this decreases the number of transitive dependencies for the hcl-rs crate as well.