shnewto / bnf

Parse BNF grammar definitions
MIT License
258 stars 22 forks source link

Use node iterators #21

Closed CrockAgile closed 7 years ago

CrockAgile commented 7 years ago

To close #13 , the internal vectors used to hold productions, expressions, and terms are no longer public. For users to still be able to iterate and modify these types, the following public functions have been added:

// bnf::node

Expression::add_term(&mut self, Term)
Expression::remove_term(&mut self, &Term) -> Option<Term>
Expression::terms_iter(&self) -> Expression::Iter
Expression::terms_iter_mut(&mut self) -> Expression::IterMut

Production::add_to_rhs(&mut self, Expression)
Production::remove_from_rhs(mut self, &Expression) -> Option<Expression>
Production::rhs_iter(&self) -> Production::Iter
Production::rhs_iter_mut(&mut self) -> Production::IterMut

Grammar::add_production(&mut self, Production)
Grammar::remove_production(&mut self, &Production) -> Option<Production>
Grammar::productions_iter(&self) -> Grammar::Iter
Grammar::productions_iter_mut(&mut self) -> Grammar::IterMut

bnf::node was also reorganized into a directory with respective grammar/production/expression/term files.

coveralls commented 7 years ago

Coverage Status

Coverage increased (+8.2%) to 92.089% when pulling b28b2ad712f6467cafa79e764fd565c3fd299a61 on use-node-iterators into 21338d3b66f6876b7822545b2225ed3399268473 on 0.2.0-devel.

shnewto commented 7 years ago

👏👏👏

Awesome add, solid testing and it all looks great! Thanks @CrockAgile !!