@@ -340,10 +340,12 @@ impl Parser {
340340 /// - `bytes`: a slice to search a new XML event. Should contain text in
341341 /// ASCII-compatible encoding
342342 pub fn feed ( & mut self , bytes : & [ u8 ] ) -> Result < FeedResult , SyntaxError > {
343+ dbg ! ( ( self . 0 , crate :: utils:: Bytes ( bytes) ) ) ;
343344 for ( offset, & byte) in bytes. iter ( ) . enumerate ( ) {
344345 let trail = & bytes[ offset..] ;
345346 let start = offset + 1 ;
346347 let rest = & bytes[ start..] ;
348+ dbg ! ( ( self . 0 , offset, byte as char , crate :: utils:: Bytes ( trail) , crate :: utils:: Bytes ( rest) ) ) ;
347349 self . 0 = match self . 0 {
348350 State :: Start => match byte {
349351 0x00 => State :: Bom ( BomParser :: X00 ) ,
@@ -544,6 +546,7 @@ impl Parser {
544546 /// - `offset`: a position of `bytes` sub-slice in the one that was passed to `feed()`
545547 #[ inline]
546548 fn parse_text ( & mut self , bytes : & [ u8 ] , offset : usize ) -> FeedResult {
549+ dbg ! ( ( self . 0 , offset, crate :: utils:: Bytes ( bytes) ) ) ;
547550 self . 0 = State :: Text ;
548551 match bytes. iter ( ) . position ( |& b| b == b'<' ) {
549552 Some ( i) => FeedResult :: EmitText ( offset + i) ,
@@ -565,6 +568,7 @@ impl Parser {
565568 offset : usize ,
566569 mut parser : CommentParser ,
567570 ) -> FeedResult {
571+ dbg ! ( ( self . 0 , offset, crate :: utils:: Bytes ( bytes) , parser) ) ;
568572 match parser. feed ( bytes) {
569573 Some ( i) => {
570574 self . 0 = State :: Text ;
@@ -588,6 +592,7 @@ impl Parser {
588592 /// - `offset`: a position of `bytes` sub-slice in the one that was passed to `feed()`
589593 /// - `braces_left`: count of braces that wasn't seen yet in the end of previous data chunk
590594 fn parse_cdata ( & mut self , bytes : & [ u8 ] , offset : usize , mut parser : CDataParser ) -> FeedResult {
595+ dbg ! ( ( self . 0 , offset, crate :: utils:: Bytes ( bytes) , parser) ) ;
591596 match parser. feed ( bytes) {
592597 Some ( i) => {
593598 self . 0 = State :: Text ;
@@ -606,8 +611,9 @@ impl Parser {
606611 offset : usize ,
607612 mut parser : QuotedParser ,
608613 ) -> Result < FeedResult , SyntaxError > {
614+ dbg ! ( ( self . 0 , offset, crate :: utils:: Bytes ( bytes) , parser) ) ;
609615 // Search `[` (start of DTD definitions) or `>` (end of <!DOCTYPE> tag)
610- match parser. one_of ( bytes) {
616+ match dbg ! ( parser. one_of( bytes) ) {
611617 OneOf :: Open ( i) => self . parse_dtd ( & bytes[ i..] , offset + i, DtdParser :: default ( ) ) ,
612618 OneOf :: Close ( i) => {
613619 self . 0 = State :: Text ;
@@ -634,8 +640,9 @@ impl Parser {
634640 mut offset : usize ,
635641 mut parser : DtdParser ,
636642 ) -> Result < FeedResult , SyntaxError > {
643+ dbg ! ( ( self . 0 , offset, crate :: utils:: Bytes ( bytes) , parser) ) ;
637644 loop {
638- let result = match parser. feed ( bytes) {
645+ let result = match dbg ! ( parser. feed( bytes) ) {
639646 // Skip recognized DTD structure
640647 // TODO: Emit DTD events while parsing
641648 quick_dtd:: FeedResult :: EmitPI ( off)
@@ -664,7 +671,8 @@ impl Parser {
664671 }
665672
666673 fn parse_doctype_finish ( & mut self , bytes : & [ u8 ] , offset : usize ) -> FeedResult {
667- match bytes. iter ( ) . position ( |& b| b == b'>' ) {
674+ dbg ! ( ( self . 0 , offset, crate :: utils:: Bytes ( bytes) ) ) ;
675+ match dbg ! ( bytes. iter( ) . position( |& b| b == b'>' ) ) {
668676 Some ( i) => {
669677 self . 0 = State :: Text ;
670678 // +1 for `>` which should be included in event
@@ -687,7 +695,8 @@ impl Parser {
687695 /// - `offset`: a position of `bytes` sub-slice in the one that was passed to `feed()`
688696 /// - `has_mark`: a flag that indicates was the previous fed data ended with `?`
689697 fn parse_pi ( & mut self , bytes : & [ u8 ] , offset : usize , mut parser : PiParser ) -> FeedResult {
690- match parser. feed ( bytes) {
698+ dbg ! ( ( self . 0 , offset, crate :: utils:: Bytes ( bytes) , parser) ) ;
699+ match dbg ! ( parser. feed( bytes) ) {
691700 Some ( i) => {
692701 self . 0 = State :: Text ;
693702 FeedResult :: EmitPI ( offset + i)
@@ -706,7 +715,8 @@ impl Parser {
706715 /// That sub-slice begins on the byte that represents a tag name
707716 /// - `offset`: a position of `bytes` sub-slice in the one that was passed to `feed()`
708717 fn parse_end ( & mut self , bytes : & [ u8 ] , offset : usize ) -> FeedResult {
709- match bytes. iter ( ) . position ( |& b| b == b'>' ) {
718+ dbg ! ( ( self . 0 , offset, crate :: utils:: Bytes ( bytes) ) ) ;
719+ match dbg ! ( bytes. iter( ) . position( |& b| b == b'>' ) ) {
710720 Some ( i) => {
711721 self . 0 = State :: Text ;
712722 // +1 for `>` which should be included in event
@@ -735,7 +745,8 @@ impl Parser {
735745 mut parser : QuotedParser ,
736746 has_slash : bool ,
737747 ) -> FeedResult {
738- match parser. feed ( bytes) {
748+ dbg ! ( ( self . 0 , offset, crate :: utils:: Bytes ( bytes) , parser, has_slash) ) ;
749+ match dbg ! ( parser. feed( bytes) ) {
739750 Some ( 0 ) if has_slash => {
740751 self . 0 = State :: Text ;
741752 // +1 for `>` which should be included in event
0 commit comments