@@ -598,7 +598,33 @@ impl<'i> Parser<'i> {
598598 . map ( |( i, _) | i)
599599 . unwrap_or ( content. len ( ) ) ;
600600
601- let block = & content[ ..end_pos] ;
601+ self . take_upto ( end_pos, function)
602+ }
603+
604+ /// As take_until(), but for descriptive text, which holds no literals. A
605+ /// quote there is punctuation the author wrote, an old-fashioned mark for
606+ /// the inch unit of measurement, or a quotation; none of which indicate a
607+ /// run of text that needs to be masked.
608+ fn take_text_until < A , F > ( & mut self , pattern : & [ char ] , function : F ) -> Result < A , ParsingError >
609+ where
610+ F : Fn ( & mut Parser < ' i > ) -> Result < A , ParsingError > ,
611+ {
612+ let end_pos = self
613+ . source
614+ . find ( pattern)
615+ . unwrap_or (
616+ self . source
617+ . len ( ) ,
618+ ) ;
619+
620+ self . take_upto ( end_pos, function)
621+ }
622+
623+ fn take_upto < A , F > ( & mut self , end_pos : usize , function : F ) -> Result < A , ParsingError >
624+ where
625+ F : Fn ( & mut Parser < ' i > ) -> Result < A , ParsingError > ,
626+ {
627+ let block = & self . source [ ..end_pos] ;
602628 let mut parser = self . subparser ( 0 , block) ;
603629
604630 // Pass to closure for processing
@@ -1405,7 +1431,9 @@ impl<'i> Parser<'i> {
14051431 . push ( error) ,
14061432 }
14071433 } else {
1408- // Skip non-procedure content line by line
1434+ outer
1435+ . problems
1436+ . push ( ParsingError :: Unrecognized ( Span :: new ( outer. offset , 0 ) ) ) ;
14091437 outer. skip_to_next_line ( ) ;
14101438 }
14111439 }
@@ -1444,7 +1472,9 @@ impl<'i> Parser<'i> {
14441472 line. len ( ) ,
14451473 ) ) ) ;
14461474 } else {
1447- // Skip unrecognized content line by line
1475+ outer
1476+ . problems
1477+ . push ( ParsingError :: Unrecognized ( Span :: new ( outer. offset , 0 ) ) ) ;
14481478 outer. skip_to_next_line ( ) ;
14491479 }
14501480 }
@@ -2628,7 +2658,7 @@ impl<'i> Parser<'i> {
26282658 parser. advance ( 1 ) ;
26292659 content. push ( Descriptive :: Text ( "$" ) ) ;
26302660 } else {
2631- let text = parser. take_until (
2661+ let text = parser. take_text_until (
26322662 & [ '{' , '<' , '$' , '~' , '\n' ] ,
26332663 |inner| {
26342664 let content = inner
0 commit comments