@@ -345,10 +345,12 @@ impl Parser {
345345 /// - `bytes`: a slice to search a new XML event. Should contain text in
346346 /// ASCII-compatible encoding
347347 pub fn feed ( & mut self , bytes : & [ u8 ] ) -> Result < FeedResult , SyntaxError > {
348+ dbg ! ( ( self . 0 , crate :: utils:: Bytes ( bytes) ) ) ;
348349 for ( offset, & byte) in bytes. iter ( ) . enumerate ( ) {
349350 let trail = & bytes[ offset..] ;
350351 let start = offset + 1 ;
351352 let rest = & bytes[ start..] ;
353+ dbg ! ( ( self . 0 , offset, byte as char , crate :: utils:: Bytes ( trail) , crate :: utils:: Bytes ( rest) ) ) ;
352354 self . 0 = match self . 0 {
353355 State :: Start => match byte {
354356 0x00 => State :: Bom ( BomParser :: X00 ) ,
@@ -549,6 +551,7 @@ impl Parser {
549551 /// - `offset`: a position of `bytes` sub-slice in the one that was passed to `feed()`
550552 #[ inline]
551553 fn parse_text ( & mut self , bytes : & [ u8 ] , offset : usize ) -> FeedResult {
554+ dbg ! ( ( self . 0 , offset, crate :: utils:: Bytes ( bytes) ) ) ;
552555 self . 0 = State :: Text ;
553556 match bytes. iter ( ) . position ( |& b| b == b'<' ) {
554557 Some ( i) => FeedResult :: EmitText ( offset + i) ,
@@ -570,6 +573,7 @@ impl Parser {
570573 offset : usize ,
571574 mut parser : CommentParser ,
572575 ) -> FeedResult {
576+ dbg ! ( ( self . 0 , offset, crate :: utils:: Bytes ( bytes) , parser) ) ;
573577 match parser. feed ( bytes) {
574578 Some ( i) => {
575579 self . 0 = State :: Text ;
@@ -593,6 +597,7 @@ impl Parser {
593597 /// - `offset`: a position of `bytes` sub-slice in the one that was passed to `feed()`
594598 /// - `braces_left`: count of braces that wasn't seen yet in the end of previous data chunk
595599 fn parse_cdata ( & mut self , bytes : & [ u8 ] , offset : usize , mut parser : CDataParser ) -> FeedResult {
600+ dbg ! ( ( self . 0 , offset, crate :: utils:: Bytes ( bytes) , parser) ) ;
596601 match parser. feed ( bytes) {
597602 Some ( i) => {
598603 self . 0 = State :: Text ;
@@ -611,8 +616,9 @@ impl Parser {
611616 offset : usize ,
612617 mut parser : QuotedParser ,
613618 ) -> Result < FeedResult , SyntaxError > {
619+ dbg ! ( ( self . 0 , offset, crate :: utils:: Bytes ( bytes) , parser) ) ;
614620 // Search `[` (start of DTD definitions) or `>` (end of <!DOCTYPE> tag)
615- match parser. one_of ( bytes) {
621+ match dbg ! ( parser. one_of( bytes) ) {
616622 OneOf :: Open ( i) => self . parse_dtd ( & bytes[ i..] , offset + i, DtdParser :: default ( ) ) ,
617623 OneOf :: Close ( i) => {
618624 self . 0 = State :: Text ;
@@ -639,8 +645,9 @@ impl Parser {
639645 mut offset : usize ,
640646 mut parser : DtdParser ,
641647 ) -> Result < FeedResult , SyntaxError > {
648+ dbg ! ( ( self . 0 , offset, crate :: utils:: Bytes ( bytes) , parser) ) ;
642649 loop {
643- let result = match parser. feed ( bytes) {
650+ let result = match dbg ! ( parser. feed( bytes) ) {
644651 // Skip recognized DTD structure
645652 // TODO: Emit DTD events while parsing
646653 quick_dtd:: FeedResult :: EmitPI ( off)
@@ -669,7 +676,8 @@ impl Parser {
669676 }
670677
671678 fn parse_doctype_finish ( & mut self , bytes : & [ u8 ] , offset : usize ) -> FeedResult {
672- match bytes. iter ( ) . position ( |& b| b == b'>' ) {
679+ dbg ! ( ( self . 0 , offset, crate :: utils:: Bytes ( bytes) ) ) ;
680+ match dbg ! ( bytes. iter( ) . position( |& b| b == b'>' ) ) {
673681 Some ( i) => {
674682 self . 0 = State :: Text ;
675683 // +1 for `>` which should be included in event
@@ -692,7 +700,8 @@ impl Parser {
692700 /// - `offset`: a position of `bytes` sub-slice in the one that was passed to `feed()`
693701 /// - `has_mark`: a flag that indicates was the previous fed data ended with `?`
694702 fn parse_pi ( & mut self , bytes : & [ u8 ] , offset : usize , mut parser : PiParser ) -> FeedResult {
695- match parser. feed ( bytes) {
703+ dbg ! ( ( self . 0 , offset, crate :: utils:: Bytes ( bytes) , parser) ) ;
704+ match dbg ! ( parser. feed( bytes) ) {
696705 Some ( i) => {
697706 self . 0 = State :: Text ;
698707 FeedResult :: EmitPI ( offset + i)
@@ -711,7 +720,8 @@ impl Parser {
711720 /// That sub-slice begins on the byte that represents a tag name
712721 /// - `offset`: a position of `bytes` sub-slice in the one that was passed to `feed()`
713722 fn parse_end ( & mut self , bytes : & [ u8 ] , offset : usize ) -> FeedResult {
714- match bytes. iter ( ) . position ( |& b| b == b'>' ) {
723+ dbg ! ( ( self . 0 , offset, crate :: utils:: Bytes ( bytes) ) ) ;
724+ match dbg ! ( bytes. iter( ) . position( |& b| b == b'>' ) ) {
715725 Some ( i) => {
716726 self . 0 = State :: Text ;
717727 // +1 for `>` which should be included in event
@@ -740,7 +750,8 @@ impl Parser {
740750 mut parser : QuotedParser ,
741751 has_slash : bool ,
742752 ) -> FeedResult {
743- match parser. feed ( bytes) {
753+ dbg ! ( ( self . 0 , offset, crate :: utils:: Bytes ( bytes) , parser, has_slash) ) ;
754+ match dbg ! ( parser. feed( bytes) ) {
744755 Some ( 0 ) if has_slash => {
745756 self . 0 = State :: Text ;
746757 // +1 for `>` which should be included in event
0 commit comments