Changeset 667 for proto


Ignore:
Timestamp:
Oct 20, 2010, 1:25:52 PM (9 years ago)
Author:
lindanl
Message:

fixed end tag matching at buffer boundary

File:
1 edited

Legend:

Unmodified
Added
Removed
  • proto/parabix2/src/tag_matcher.cpp

    r599 r667  
    8585          int lgth = tag_lgth_stack[depth];
    8686
    87           if (does_match(tag_stack[depth],&srcbuf[pos],lgth) && ((srcbuf[pos+lgth] == '>') ||(srcbuf[pos+lgth] <= ' '))) rt_val=0;
    88           else if (pos + lgth >= BUFFER_SIZE + OVERLAP_BUFSIZE) {
     87          if(pos + lgth >= BUFFER_SIZE + OVERLAP_BUFSIZE) {
    8988            state = InEndTag;
    9089            inTagPos = BUFFER_SIZE - pos;
     90            if(!does_match(tag_stack[depth],&srcbuf[pos],BUFFER_SIZE-pos)){
     91              fprintf(stderr,"tag name mismatch at position = %i\n",buf_base+pos);
     92              exit(-1);
     93            }
    9194            rt_val=0;
    92           }
     95          }       
     96          else if (does_match(tag_stack[depth],&srcbuf[pos],lgth) && ((srcbuf[pos+lgth] == '>') ||(srcbuf[pos+lgth] <= ' '))) rt_val=0;
    9397          else {
    94 //            cout << "matchlen = " << matchlen << endl;
    95 //            cout << "end tag is " << string(&srcbuf[pos],tag_lgth_stack[depth]) << endl ;
    96 //            cout << "start tag is " << string(tag_stack[depth],tag_lgth_stack[depth]) << endl ;
    9798              fprintf(stderr,"tag name mismatch at position = %i\n",buf_base+pos);
    9899              exit(-1);
     
    232233      state = Clear;
    233234      int lgth = tag_lgth_stack[depth];
    234       if (does_match(tag_stack[depth]+inTagPos,srcbuf,lgth-inTagPos) && ((srcbuf[lgth] == '>') ||(srcbuf[lgth] <= ' '))) return ;       
    235       else {
     235      if (does_match(tag_stack[depth]+inTagPos,srcbuf,lgth-inTagPos) && ((srcbuf[lgth-inTagPos] == '>') ||(srcbuf[lgth-inTagPos] <= ' '))) return ;     
     236      else {   
     237//           cout << "end tag is " << string(&srcbuf[0],tag_lgth_stack[depth]-inTagPos) << endl ;
     238//           cout << "start tag is " << string(tag_stack[depth]+inTagPos,tag_lgth_stack[depth]-inTagPos) << endl ;
    236239          fprintf(stderr,"tag name mismatch at position = %i\n",buf_base);
    237240          exit(-1);
Note: See TracChangeset for help on using the changeset viewer.