Rename nom context to parser context.
This commit is contained in:
		
							parent
							
								
									279b9dceb4
								
							
						
					
					
						commit
						6352f92ebc
					
				| @ -1,5 +1,5 @@ | ||||
| use super::nom_context::ContextElement; | ||||
| use super::nom_context::PreviousElementNode; | ||||
| use super::parser_context::ContextElement; | ||||
| use super::parser_context::PreviousElementNode; | ||||
| use super::token::Token; | ||||
| use super::Context; | ||||
| use nom::error::ErrorKind; | ||||
|  | ||||
| @ -1,10 +1,10 @@ | ||||
| mod combinator; | ||||
| mod error; | ||||
| mod list; | ||||
| mod nom_context; | ||||
| mod parser_context; | ||||
| mod parser_with_context; | ||||
| mod text; | ||||
| mod text_element_parser; | ||||
| mod token; | ||||
| pub use text_element_parser::document; | ||||
| type Context<'r, 's> = &'r nom_context::ContextTree<'r, 's>; | ||||
| type Context<'r, 's> = &'r parser_context::ContextTree<'r, 's>; | ||||
|  | ||||
| @ -6,10 +6,10 @@ use super::combinator::context_many1; | ||||
| use super::combinator::context_many_till; | ||||
| use super::error::CustomError; | ||||
| use super::error::MyError; | ||||
| use super::nom_context::ChainBehavior; | ||||
| use super::nom_context::ContextElement; | ||||
| use super::nom_context::ContextTree; | ||||
| use super::nom_context::ExitMatcherNode; | ||||
| use super::parser_context::ChainBehavior; | ||||
| use super::parser_context::ContextElement; | ||||
| use super::parser_context::ContextTree; | ||||
| use super::parser_context::ExitMatcherNode; | ||||
| use super::text::bold_end; | ||||
| use super::text::bold_start; | ||||
| use super::text::line_break; | ||||
| @ -206,13 +206,13 @@ fn flat_text_element<'s, 'r>( | ||||
| 
 | ||||
| fn flat_bold<'s, 'r>(context: Context<'r, 's>, i: &'s str) -> Res<&'s str, Bold<'s>> { | ||||
|     let bold_start = parser_with_context!(context_bold_start)(&context); | ||||
|     let nom_context = context | ||||
|     let parser_context = context | ||||
|         .with_additional_node(ContextElement::ExitMatcherNode(ExitMatcherNode { | ||||
|             exit_matcher: ChainBehavior::AndParent(Some(&context_bold_end)), | ||||
|         })) | ||||
|         .with_additional_node(ContextElement::Context("bold")); | ||||
|     let (remaining, captured) = recognize(tuple((bold_start, |i| { | ||||
|         context_many_till(&nom_context, flat_text_element, context_bold_end)(i) | ||||
|         context_many_till(&parser_context, flat_text_element, context_bold_end)(i) | ||||
|     })))(i)?; | ||||
|     let ret = Bold { contents: captured }; | ||||
|     Ok((remaining, ret)) | ||||
| @ -220,13 +220,13 @@ fn flat_bold<'s, 'r>(context: Context<'r, 's>, i: &'s str) -> Res<&'s str, Bold< | ||||
| 
 | ||||
| fn flat_link<'s, 'r>(context: Context<'r, 's>, i: &'s str) -> Res<&'s str, Link<'s>> { | ||||
|     let link_start = parser_with_context!(context_link_start)(&context); | ||||
|     let nom_context = context | ||||
|     let parser_context = context | ||||
|         .with_additional_node(ContextElement::ExitMatcherNode(ExitMatcherNode { | ||||
|             exit_matcher: ChainBehavior::AndParent(Some(&context_link_end)), | ||||
|         })) | ||||
|         .with_additional_node(ContextElement::Context("link")); | ||||
|     let (remaining, captured) = recognize(tuple((link_start, |i| { | ||||
|         context_many_till(&nom_context, flat_text_element, context_link_end)(i) | ||||
|         context_many_till(&parser_context, flat_text_element, context_link_end)(i) | ||||
|     })))(i)?; | ||||
|     let ret = Link { contents: captured }; | ||||
|     Ok((remaining, ret)) | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Tom Alexander
						Tom Alexander