Ignore:
Timestamp:
Jun 28, 2015, 3:55:39 PM (4 years ago)
Author:
nmedfort
Message:

Bug fix for CC insert_range and UnicodeSet? iterator.

Location:
icGREP/icgrep-devel/icgrep/re
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/re/re_cc.cpp

    r4617 r4621  
    6060        }
    6161        else {
    62             // ranges overlap; expand the range to include the prior one and
    63             // remove the old one from the list
     62            // ranges overlap; expand the range to include the overlapp
    6463            lo_codepoint(i) = std::min(lo_codepoint(i), lo);
    6564            hi_codepoint(i) = std::max(hi_codepoint(i), hi);
     65            // Test whether the new hi code point of this range touches the subsequent
     66            // interval. If so extend it over that one and remove it from the list.
     67            for (auto j = i + 1; j != mSparseCharSet.end(); ) {
     68                if (LLVM_LIKELY(hi_codepoint(i) + 1 < lo_codepoint(j))) {
     69                    break;
     70                }
     71                hi_codepoint(i) = std::max(hi_codepoint(i), hi_codepoint(j));
     72                j = mSparseCharSet.erase(j);
     73            }
    6674            return;
    6775        }
  • icGREP/icgrep-devel/icgrep/re/re_cc.h

    r4617 r4621  
    202202    mSparseCharSet.resize(std::distance(begin, end));
    203203    for (auto i = begin; i != end; ++i) {
    204         assert (i == begin || lo_codepoint(i) > max_codepoint());
     204        assert (i == begin || lo_codepoint(*i) > max_codepoint());
    205205        mSparseCharSet[std::distance(begin, i)] = *i;
    206206    }
Note: See TracChangeset for help on using the changeset viewer.