Changeset 81 for trunk/markup_stats.cxx


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

Separate CDATA start/end actions as in expat.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/markup_stats.cxx

    r79 r81  
    5555int comment_count = 0;
    5656int comment_length = 0;
    57 int CDATA_count = 0;
     57int CDATA_start_count = 0;
     58int CDATA_start_pos = 0;
    5859int CDATA_length = 0;
     60int CDATA_end_count = 0;
    5961int PI_count = 0;
    6062int PI_length = 0;
     
    105107}
    106108
    107 /* Action routine for a CDATA section enclosed in "<![CDATA[" and "]]>" brackets. */
    108 template <CodeUnit_Base C>
    109 inline void ParsingEngine<C>::CDATA_action(int start_pos, int end_pos) {
    110         CDATA_count +=1;
    111         CDATA_length += end_pos - start_pos;
    112         LastItemAction(start_pos, end_pos, buffer_rel_pos);
     109/* Action routine called upon recognizing "<![CDATA[" to start a CDATA section. */
     110template <CodeUnit_Base C>
     111inline void ParsingEngine<C>::CDATA_start_action(int pos) {
     112        CDATA_start_pos = pos - 9;
     113        CDATA_start_count +=1;
     114        LastItemAction(pos-9, pos, buffer_rel_pos);
     115}
     116
     117/* Action routine called upon recognizing "]]>" to end a CDATA section. */
     118template <CodeUnit_Base C>
     119inline void ParsingEngine<C>::CDATA_end_action(int pos) {
     120        CDATA_end_count +=1;
     121        CDATA_length += pos - CDATA_start_pos;
     122        LastItemAction(pos-3, pos, buffer_rel_pos);
    113123}
    114124
     
    368378       
    369379        print_stats("comment", comment_count, comment_length);
    370         print_stats("CDATA section", CDATA_count, CDATA_length);
     380        print_stats("CDATA section", CDATA_end_count, CDATA_length);
    371381        print_stats("processing instruction", PI_count, PI_length);
    372382        print_stats("empty element", empty_elem_count, empty_elem_length);
Note: See TracChangeset for help on using the changeset viewer.