/// Create iterators for ast nodes where it only has to iterate over children macro_rules! simple_iter { ($astnodetype:ty, $itertype:ident, $innertype:ty) => { pub struct $itertype<'r, 's> { next: $innertype, } impl<'r, 's> Iterator for $itertype<'r, 's> { type Item = AstNode<'r, 's>; fn next(&mut self) -> Option { self.next.next().map(Into::::into) } } impl<'r, 's> IntoIterator for &'r $astnodetype { type Item = AstNode<'r, 's>; type IntoIter = $itertype<'r, 's>; fn into_iter(self) -> Self::IntoIter { $itertype { next: self.children.iter(), } } } }; } pub(crate) use simple_iter;