Giter Club home page Giter Club logo

ferrous-chloride's Introduction

ferrous-chloride

Line count

HCL parser in Rust

ferrous-chloride's People

Contributors

dependabot-preview[bot] avatar gyng avatar lawliet89 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ferrous-chloride's Issues

Parser Library

I tried using nom in this branch.

  • I tried for hours to figure out the right macros to use to parse the sign of a number...
  • It's hard to use. There aren't many good tutorials.
  • Macros.... ๐Ÿคฎ

Alternatives:

Reading Materials:

What do you think @gyng?

Parsing HCL files

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.

Implement Deserialize

In the future:

  • Schema driven deserialization of blocks including whether to assign block labels are enum variants or actual strings in the block body.
  • For enums, they will be strictly be treated as "externally tagged" which is Serde's default

For now (and the default behvaiour in the absence of a schema provided):

  • Objects will be deserialized as-is to maps/structs (visit_map)
  • Blocks will be deserialized to maps/structs via visit_map if the Deserialize implementation does not give any hints. What happens if multiple blocks of the same type exist?
  • If hinted to be an enum, all the labels will be concatenated (how?) to form the variant name. Users can customise the matching variant by using Serde's renaming attributes. (consider only the first label?)

What about:

  • Internally tagged: Probably cannot use any block labels as aid. If used, will be treated as dumb nested maps/blocks
  • Adjacently Tagged: Same as above
  • Untagged: Probably same as above

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.