Changeset 81 for trunk/src


Ignore:
Timestamp:
Mar 31, 2008, 5:37:37 AM (11 years ago)
Author:
cameron
Message:

Separate CDATA start/end actions as in expat.

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/engine.c

    r80 r81  
    195195                AdvanceBuffers(preserve_pos);
    196196                buffer_rel_pos = bitstream_scan(buf->item_stream[MarkupStart], buffer_rel_pos);
     197        }
     198}
     199
     200template <CodeUnit_Base C>
     201inline void ParsingEngine<C>::ScanToCD_End_check() {
     202        int preserve_pos;
     203        buffer_rel_pos = bitstream_scan(buf->item_stream[CD_End_check], buffer_rel_pos);
     204        while (buffer_rel_pos >= BUFFER_SIZE) {
     205                Text_action(text_or_markup_start, AbsPos());
     206                text_or_markup_start = AbsPos();
     207                FinalizeBuffer_action(preserve_pos);
     208                AdvanceBuffers(preserve_pos);
     209                buffer_rel_pos = bitstream_scan(buf->item_stream[CD_End_check], buffer_rel_pos);
    197210        }
    198211}
     
    292305                Error_action(text_or_markup_start, AbsPos());
    293306        }
    294         else {
     307        else { 
     308                Advance(1);
     309                text_or_markup_start = AbsPos();
     310                CDATA_start_action(text_or_markup_start);
    295311                ScanTo(CD_End_check);
    296312                while (!at_CDATA_End<C>(cur())) {
     
    298314                        ScanTo(CD_End_check);
    299315                }
     316                Text_action(text_or_markup_start, AbsPos());
    300317                Advance(3); /* Skip "]]>". */
    301                 CDATA_action(text_or_markup_start, AbsPos());
     318                CDATA_end_action(AbsPos());
    302319        }
    303320}
  • trunk/src/engine.h

    r80 r81  
    6868        void Advance(int n);
    6969        void ScanTo(int lex_item);
    70         void ScanToMarkupStart(); // Specialized version.
     70        void ScanToMarkupStart();  // Specialized version.
     71        void ScanToCD_End_check(); // Specialized version.
    7172
    7273        void AdvanceBuffers(int preserve_pos);
     
    110111        void Comment_action(int start_pos, int end_pos);
    111112       
    112         /* Action routine for a CDATA section enclosed in "<![CDATA[" and "]]>" brackets. */
    113         void CDATA_action(int start_pos, int end_pos);
     113        /* Action routine called upon recognizing "<![CDATA[" to start a CDATA section. */
     114        void CDATA_start_action(int pos);
     115
     116        /* Action routine called upon recognizing "]]>" to end a CDATA section. */
     117        void CDATA_end_action(int pos);
    114118       
    115119        /* Action routine for an XML processing instruction enclosed in "<?" and "?>" brackets. */
Note: See TracChangeset for help on using the changeset viewer.