Implement the rest of the elements.
This commit is contained in:
		
							parent
							
								
									95fa834420
								
							
						
					
					
						commit
						c4ea3fbf88
					
				| @ -31,6 +31,7 @@ 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; | ||||
| @ -50,6 +51,8 @@ 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; | ||||
| @ -71,7 +74,9 @@ pub enum AstNode<'r, 's> { | ||||
|     Comment(&'r Comment<'s>), | ||||
|     Drawer(&'r Drawer<'s>), | ||||
|     PropertyDrawer(&'r PropertyDrawer<'s>), | ||||
|     NodeProperty(&'r NodeProperty<'s>), | ||||
|     Table(&'r Table<'s>), | ||||
|     TableRow(&'r TableRow<'s>), | ||||
|     VerseBlock(&'r VerseBlock<'s>), | ||||
|     CommentBlock(&'r CommentBlock<'s>), | ||||
|     ExampleBlock(&'r ExampleBlock<'s>), | ||||
| @ -112,6 +117,7 @@ pub enum AstNode<'r, 's> { | ||||
|     StatisticsCookie(&'r StatisticsCookie<'s>), | ||||
|     Subscript(&'r Subscript<'s>), | ||||
|     Superscript(&'r Superscript<'s>), | ||||
|     TableCell(&'r TableCell<'s>), | ||||
|     Timestamp(&'r Timestamp<'s>), | ||||
| } | ||||
| 
 | ||||
| @ -199,7 +205,9 @@ to_ast_node!(&'r FootnoteDefinition<'s>, AstNode::FootnoteDefinition); | ||||
| to_ast_node!(&'r Comment<'s>, AstNode::Comment); | ||||
| to_ast_node!(&'r Drawer<'s>, AstNode::Drawer); | ||||
| to_ast_node!(&'r PropertyDrawer<'s>, AstNode::PropertyDrawer); | ||||
| to_ast_node!(&'r NodeProperty<'s>, AstNode::NodeProperty); | ||||
| to_ast_node!(&'r Table<'s>, AstNode::Table); | ||||
| to_ast_node!(&'r TableRow<'s>, AstNode::TableRow); | ||||
| to_ast_node!(&'r VerseBlock<'s>, AstNode::VerseBlock); | ||||
| to_ast_node!(&'r CommentBlock<'s>, AstNode::CommentBlock); | ||||
| to_ast_node!(&'r ExampleBlock<'s>, AstNode::ExampleBlock); | ||||
| @ -239,4 +247,5 @@ to_ast_node!(&'r Target<'s>, AstNode::Target); | ||||
| to_ast_node!(&'r StatisticsCookie<'s>, AstNode::StatisticsCookie); | ||||
| to_ast_node!(&'r Subscript<'s>, AstNode::Subscript); | ||||
| to_ast_node!(&'r Superscript<'s>, AstNode::Superscript); | ||||
| to_ast_node!(&'r TableCell<'s>, AstNode::TableCell); | ||||
| to_ast_node!(&'r Timestamp<'s>, AstNode::Timestamp); | ||||
|  | ||||
| @ -4,24 +4,47 @@ use super::ast_node::AstNode; | ||||
| use super::macros::children_iter; | ||||
| use super::macros::empty_iter; | ||||
| use super::macros::multi_field_iter; | ||||
| use crate::types::BabelCall; | ||||
| use crate::types::Bold; | ||||
| use crate::types::Clock; | ||||
| use crate::types::Code; | ||||
| use crate::types::Comment; | ||||
| use crate::types::CommentBlock; | ||||
| use crate::types::DiarySexp; | ||||
| use crate::types::Document; | ||||
| use crate::types::DocumentElement; | ||||
| use crate::types::Drawer; | ||||
| use crate::types::DynamicBlock; | ||||
| use crate::types::Element; | ||||
| use crate::types::ExampleBlock; | ||||
| use crate::types::ExportBlock; | ||||
| use crate::types::FixedWidthArea; | ||||
| use crate::types::FootnoteDefinition; | ||||
| use crate::types::GreaterBlock; | ||||
| use crate::types::Heading; | ||||
| use crate::types::HorizontalRule; | ||||
| use crate::types::Italic; | ||||
| use crate::types::Keyword; | ||||
| use crate::types::LatexEnvironment; | ||||
| use crate::types::NodeProperty; | ||||
| use crate::types::Object; | ||||
| use crate::types::Paragraph; | ||||
| 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::RegularLink; | ||||
| use crate::types::Section; | ||||
| use crate::types::SrcBlock; | ||||
| use crate::types::StrikeThrough; | ||||
| use crate::types::Table; | ||||
| use crate::types::TableCell; | ||||
| use crate::types::TableRow; | ||||
| use crate::types::Underline; | ||||
| use crate::types::Verbatim; | ||||
| use crate::types::VerseBlock; | ||||
| 
 | ||||
| /// Iterator over the AST nodes contained within the starting node.
 | ||||
| ///
 | ||||
| @ -37,26 +60,28 @@ pub enum AstNodeIter<'r, 's> { | ||||
|     Paragraph(ParagraphIter<'r, 's>), | ||||
|     PlainList(PlainListIter<'r, 's>), | ||||
|     PlainListItem(PlainListItemIter<'r, 's>), | ||||
|     // GreaterBlock(GreaterBlockIter<'r, 's>),
 | ||||
|     // DynamicBlock(DynamicBlockIter<'r, 's>),
 | ||||
|     // FootnoteDefinition(FootnoteDefinitionIter<'r, 's>),
 | ||||
|     // Comment(CommentIter<'r, 's>),
 | ||||
|     // Drawer(DrawerIter<'r, 's>),
 | ||||
|     // PropertyDrawer(PropertyDrawerIter<'r, 's>),
 | ||||
|     // Table(TableIter<'r, 's>),
 | ||||
|     // VerseBlock(VerseBlockIter<'r, 's>),
 | ||||
|     // CommentBlock(CommentBlockIter<'r, 's>),
 | ||||
|     // ExampleBlock(ExampleBlockIter<'r, 's>),
 | ||||
|     // ExportBlock(ExportBlockIter<'r, 's>),
 | ||||
|     // SrcBlock(SrcBlockIter<'r, 's>),
 | ||||
|     // Clock(ClockIter<'r, 's>),
 | ||||
|     // DiarySexp(DiarySexpIter<'r, 's>),
 | ||||
|     // Planning(PlanningIter<'r, 's>),
 | ||||
|     // FixedWidthArea(FixedWidthAreaIter<'r, 's>),
 | ||||
|     // HorizontalRule(HorizontalRuleIter<'r, 's>),
 | ||||
|     // Keyword(KeywordIter<'r, 's>),
 | ||||
|     // BabelCall(BabelCallIter<'r, 's>),
 | ||||
|     // LatexEnvironment(LatexEnvironmentIter<'r, 's>),
 | ||||
|     GreaterBlock(GreaterBlockIter<'r, 's>), | ||||
|     DynamicBlock(DynamicBlockIter<'r, 's>), | ||||
|     FootnoteDefinition(FootnoteDefinitionIter<'r, 's>), | ||||
|     Comment(CommentIter<'r, 's>), | ||||
|     Drawer(DrawerIter<'r, 's>), | ||||
|     PropertyDrawer(PropertyDrawerIter<'r, 's>), | ||||
|     NodeProperty(NodePropertyIter<'r, 's>), | ||||
|     Table(TableIter<'r, 's>), | ||||
|     TableRow(TableRowIter<'r, 's>), | ||||
|     VerseBlock(VerseBlockIter<'r, 's>), | ||||
|     CommentBlock(CommentBlockIter<'r, 's>), | ||||
|     ExampleBlock(ExampleBlockIter<'r, 's>), | ||||
|     ExportBlock(ExportBlockIter<'r, 's>), | ||||
|     SrcBlock(SrcBlockIter<'r, 's>), | ||||
|     Clock(ClockIter<'r, 's>), | ||||
|     DiarySexp(DiarySexpIter<'r, 's>), | ||||
|     Planning(PlanningIter<'r, 's>), | ||||
|     FixedWidthArea(FixedWidthAreaIter<'r, 's>), | ||||
|     HorizontalRule(HorizontalRuleIter<'r, 's>), | ||||
|     Keyword(KeywordIter<'r, 's>), | ||||
|     BabelCall(BabelCallIter<'r, 's>), | ||||
|     LatexEnvironment(LatexEnvironmentIter<'r, 's>), | ||||
|     // Objects
 | ||||
|     Bold(BoldIter<'r, 's>), | ||||
|     Italic(ItalicIter<'r, 's>), | ||||
| @ -84,6 +109,7 @@ pub enum AstNodeIter<'r, 's> { | ||||
|     // StatisticsCookie(StatisticsCookieIter<'r, 's>),
 | ||||
|     // Subscript(SubscriptIter<'r, 's>),
 | ||||
|     // Superscript(SuperscriptIter<'r, 's>),
 | ||||
|     TableCell(TableCellIter<'r, 's>), | ||||
|     // Timestamp(TimestampIter<'r, 's>),
 | ||||
| } | ||||
| 
 | ||||
| @ -122,6 +148,52 @@ multi_field_iter!( | ||||
|     children, | ||||
|     std::slice::Iter<'r, Element<'s>> | ||||
| ); | ||||
| children_iter!( | ||||
|     GreaterBlock<'s>, | ||||
|     GreaterBlockIter, | ||||
|     std::slice::Iter<'r, Element<'s>> | ||||
| ); | ||||
| children_iter!( | ||||
|     DynamicBlock<'s>, | ||||
|     DynamicBlockIter, | ||||
|     std::slice::Iter<'r, Element<'s>> | ||||
| ); | ||||
| children_iter!( | ||||
|     FootnoteDefinition<'s>, | ||||
|     FootnoteDefinitionIter, | ||||
|     std::slice::Iter<'r, Element<'s>> | ||||
| ); | ||||
| empty_iter!(Comment<'s>, CommentIter); | ||||
| children_iter!(Drawer<'s>, DrawerIter, std::slice::Iter<'r, Element<'s>>); | ||||
| children_iter!( | ||||
|     PropertyDrawer<'s>, | ||||
|     PropertyDrawerIter, | ||||
|     std::slice::Iter<'r, NodeProperty<'s>> | ||||
| ); | ||||
| empty_iter!(NodeProperty<'s>, NodePropertyIter); | ||||
| children_iter!(Table<'s>, TableIter, std::slice::Iter<'r, TableRow<'s>>); | ||||
| children_iter!( | ||||
|     TableRow<'s>, | ||||
|     TableRowIter, | ||||
|     std::slice::Iter<'r, TableCell<'s>> | ||||
| ); | ||||
| children_iter!( | ||||
|     VerseBlock<'s>, | ||||
|     VerseBlockIter, | ||||
|     std::slice::Iter<'r, Object<'s>> | ||||
| ); | ||||
| empty_iter!(CommentBlock<'s>, CommentBlockIter); | ||||
| empty_iter!(ExampleBlock<'s>, ExampleBlockIter); | ||||
| empty_iter!(ExportBlock<'s>, ExportBlockIter); | ||||
| empty_iter!(SrcBlock<'s>, SrcBlockIter); | ||||
| empty_iter!(Clock<'s>, ClockIter); | ||||
| empty_iter!(DiarySexp<'s>, DiarySexpIter); | ||||
| empty_iter!(Planning<'s>, PlanningIter); | ||||
| empty_iter!(FixedWidthArea<'s>, FixedWidthAreaIter); | ||||
| empty_iter!(HorizontalRule<'s>, HorizontalRuleIter); | ||||
| empty_iter!(Keyword<'s>, KeywordIter); | ||||
| empty_iter!(BabelCall<'s>, BabelCallIter); | ||||
| empty_iter!(LatexEnvironment<'s>, LatexEnvironmentIter); | ||||
| children_iter!(Bold<'s>, BoldIter, std::slice::Iter<'r, Object<'s>>); | ||||
| children_iter!(Italic<'s>, ItalicIter, std::slice::Iter<'r, Object<'s>>); | ||||
| children_iter!( | ||||
| @ -143,3 +215,8 @@ children_iter!( | ||||
|     RadioLinkIter, | ||||
|     std::slice::Iter<'r, Object<'s>> | ||||
| ); | ||||
| children_iter!( | ||||
|     TableCell<'s>, | ||||
|     TableCellIter, | ||||
|     std::slice::Iter<'r, Object<'s>> | ||||
| ); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Tom Alexander
						Tom Alexander