Fix infinite loop by only checking paragraph matcher when boolean is true.
Before I was checking afterwards with a verify, which was causing an infinite loop.
This commit is contained in:
		
							parent
							
								
									7855020927
								
							
						
					
					
						commit
						af90ea6dfd
					
				| @ -69,16 +69,22 @@ pub fn element( | ||||
|             map(diary_sexp_matcher, Element::DiarySexp), | ||||
|             map(fixed_width_area_matcher, Element::FixedWidthArea), | ||||
|             map(horizontal_rule_matcher, Element::HorizontalRule), | ||||
|             map( | ||||
|                 verify(paragraph_matcher, |_p| can_be_paragraph), | ||||
|                 Element::Paragraph, | ||||
|             ), | ||||
|         ))(remaining) | ||||
|         { | ||||
|             the_ok @ Ok(_) => the_ok, | ||||
|             Err(_) => { | ||||
|                 affiliated_keywords.clear(); | ||||
|                 map(keyword_matcher, Element::Keyword)(input) | ||||
|                 if can_be_paragraph { | ||||
|                     match map(paragraph_matcher, Element::Paragraph)(remaining) { | ||||
|                         the_ok @ Ok(_) => the_ok, | ||||
|                         Err(_) => { | ||||
|                             affiliated_keywords.clear(); | ||||
|                             map(keyword_matcher, Element::Keyword)(input) | ||||
|                         } | ||||
|                     } | ||||
|                 } else { | ||||
|                     affiliated_keywords.clear(); | ||||
|                     map(keyword_matcher, Element::Keyword)(input) | ||||
|                 } | ||||
|             } | ||||
|         }?; | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Tom Alexander
						Tom Alexander