mcandre / unmake

a makefile linter
Other
86 stars 3 forks source link

parse AST from peg::Parse interface stream #16

Open mcandre opened 1 year ago

mcandre commented 1 year ago

So that we don't necessarily have to read the entire, potentially very large makefile, into memory all at once.

Also, using Read interfaces makes the code agnostic of whether the string comes from a fixture file vs a Rust string constant.

Assuming this is possible in peg.

https://docs.rs/peg/latest/peg/

mcandre commented 1 year ago

We should be able to use the peg::Parse trait for this.

https://docs.rs/peg/latest/peg/trait.Parse.html

Because this is a trait, then we may have to introduce lifetimes. Unsure whether to use for str or for peg::Parse when declaring the grammar.