From 875a50ae46c9e72e6b93c592072fe08751ee9971 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Wed, 27 Sep 2023 19:02:33 -0400 Subject: [PATCH] Finish implementing AstNodeIter for all types. --- src/iter/ast_node_iter.rs | 81 ++++++++++++++++++++++++++++++--------- 1 file changed, 63 insertions(+), 18 deletions(-) diff --git a/src/iter/ast_node_iter.rs b/src/iter/ast_node_iter.rs index fabe91d..4866681 100644 --- a/src/iter/ast_node_iter.rs +++ b/src/iter/ast_node_iter.rs @@ -4,8 +4,11 @@ use super::ast_node::AstNode; use super::macros::children_iter; use super::macros::empty_iter; use super::macros::multi_field_iter; +use crate::types::AngleLink; use crate::types::BabelCall; use crate::types::Bold; +use crate::types::Citation; +use crate::types::CitationReference; use crate::types::Clock; use crate::types::Code; use crate::types::Comment; @@ -16,32 +19,47 @@ use crate::types::DocumentElement; use crate::types::Drawer; use crate::types::DynamicBlock; use crate::types::Element; +use crate::types::Entity; use crate::types::ExampleBlock; use crate::types::ExportBlock; +use crate::types::ExportSnippet; use crate::types::FixedWidthArea; use crate::types::FootnoteDefinition; +use crate::types::FootnoteReference; use crate::types::GreaterBlock; use crate::types::Heading; use crate::types::HorizontalRule; +use crate::types::InlineBabelCall; +use crate::types::InlineSourceBlock; use crate::types::Italic; use crate::types::Keyword; use crate::types::LatexEnvironment; +use crate::types::LatexFragment; +use crate::types::LineBreak; use crate::types::NodeProperty; use crate::types::Object; +use crate::types::OrgMacro; use crate::types::Paragraph; +use crate::types::PlainLink; use crate::types::PlainList; use crate::types::PlainListItem; use crate::types::PlainText; use crate::types::Planning; use crate::types::PropertyDrawer; use crate::types::RadioLink; +use crate::types::RadioTarget; use crate::types::RegularLink; use crate::types::Section; use crate::types::SrcBlock; +use crate::types::StatisticsCookie; use crate::types::StrikeThrough; +use crate::types::Subscript; +use crate::types::Superscript; use crate::types::Table; use crate::types::TableCell; use crate::types::TableRow; +use crate::types::Target; +use crate::types::Timestamp; use crate::types::Underline; use crate::types::Verbatim; use crate::types::VerseBlock; @@ -92,25 +110,25 @@ pub enum AstNodeIter<'r, 's> { PlainText(PlainTextIter<'r, 's>), RegularLink(RegularLinkIter<'r, 's>), RadioLink(RadioLinkIter<'r, 's>), - // RadioTarget(RadioTargetIter<'r, 's>), - // PlainLink(PlainLinkIter<'r, 's>), - // AngleLink(AngleLinkIter<'r, 's>), - // OrgMacro(OrgMacroIter<'r, 's>), - // Entity(EntityIter<'r, 's>), - // LatexFragment(LatexFragmentIter<'r, 's>), - // ExportSnippet(ExportSnippetIter<'r, 's>), - // FootnoteReference(FootnoteReferenceIter<'r, 's>), - // Citation(CitationIter<'r, 's>), - // CitationReference(CitationReferenceIter<'r, 's>), - // InlineBabelCall(InlineBabelCallIter<'r, 's>), - // InlineSourceBlock(InlineSourceBlockIter<'r, 's>), - // LineBreak(LineBreakIter<'r, 's>), - // Target(TargetIter<'r, 's>), - // StatisticsCookie(StatisticsCookieIter<'r, 's>), - // Subscript(SubscriptIter<'r, 's>), - // Superscript(SuperscriptIter<'r, 's>), + RadioTarget(RadioTargetIter<'r, 's>), + PlainLink(PlainLinkIter<'r, 's>), + AngleLink(AngleLinkIter<'r, 's>), + OrgMacro(OrgMacroIter<'r, 's>), + Entity(EntityIter<'r, 's>), + LatexFragment(LatexFragmentIter<'r, 's>), + ExportSnippet(ExportSnippetIter<'r, 's>), + FootnoteReference(FootnoteReferenceIter<'r, 's>), + Citation(CitationIter<'r, 's>), + CitationReference(CitationReferenceIter<'r, 's>), + InlineBabelCall(InlineBabelCallIter<'r, 's>), + InlineSourceBlock(InlineSourceBlockIter<'r, 's>), + LineBreak(LineBreakIter<'r, 's>), + Target(TargetIter<'r, 's>), + StatisticsCookie(StatisticsCookieIter<'r, 's>), + Subscript(SubscriptIter<'r, 's>), + Superscript(SuperscriptIter<'r, 's>), TableCell(TableCellIter<'r, 's>), - // Timestamp(TimestampIter<'r, 's>), + Timestamp(TimestampIter<'r, 's>), } multi_field_iter!( @@ -215,8 +233,35 @@ children_iter!( RadioLinkIter, std::slice::Iter<'r, Object<'s>> ); +children_iter!( + RadioTarget<'s>, + RadioTargetIter, + std::slice::Iter<'r, Object<'s>> +); +empty_iter!(PlainLink<'s>, PlainLinkIter); +empty_iter!(AngleLink<'s>, AngleLinkIter); +empty_iter!(OrgMacro<'s>, OrgMacroIter); +empty_iter!(Entity<'s>, EntityIter); +empty_iter!(LatexFragment<'s>, LatexFragmentIter); +empty_iter!(ExportSnippet<'s>, ExportSnippetIter); +multi_field_iter!( + FootnoteReference<'s>, + FootnoteReferenceIter, + definition, + std::slice::Iter<'r, Object<'s>>, +); +empty_iter!(Citation<'s>, CitationIter); +empty_iter!(CitationReference<'s>, CitationReferenceIter); +empty_iter!(InlineBabelCall<'s>, InlineBabelCallIter); +empty_iter!(InlineSourceBlock<'s>, InlineSourceBlockIter); +empty_iter!(LineBreak<'s>, LineBreakIter); +empty_iter!(Target<'s>, TargetIter); +empty_iter!(StatisticsCookie<'s>, StatisticsCookieIter); +empty_iter!(Subscript<'s>, SubscriptIter); +empty_iter!(Superscript<'s>, SuperscriptIter); children_iter!( TableCell<'s>, TableCellIter, std::slice::Iter<'r, Object<'s>> ); +empty_iter!(Timestamp<'s>, TimestampIter);