Ignore:
Timestamp:
Jun 25, 2015, 3:47:56 PM (4 years ago)
Author:
nmedfort
Message:

Upload of an untested (inactive) UCD compiler.

File:
1 edited

Legend:

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

    r4614 r4617  
    127127    friend CC * makeCC(const codepoint_t lo, const codepoint_t hi);
    128128    friend CC * makeCC(const CC * cc1, const CC * cc2);
     129    friend CC * makeCC(const std::initializer_list<interval_t> list);
     130    friend CC * makeCC(const std::vector<interval_t> & list);
    129131    friend CC * subtractCC(const CC * cc1, const CC * cc2);
     132
    130133    inline CC()
    131134    : RE(ClassTypeId::CC)
     
    146149    CC(const CC * cc1, const CC * cc2);
    147150
     151    template <typename itr>
     152    CC * initialize(itr begin, itr end);
    148153private:   
    149154    IntervalVector mSparseCharSet;
     
    167172}
    168173
    169 inline codepoint_t & lo_codepoint(CC::reference i) {
     174inline codepoint_t & lo_codepoint(interval_t & i) {
    170175    return std::get<0>(i);
    171176}
    172 inline codepoint_t lo_codepoint(CC::const_reference i) {
     177inline codepoint_t lo_codepoint(const interval_t & i) {
    173178    return std::get<0>(i);
    174179}
     
    180185}
    181186
    182 inline codepoint_t & hi_codepoint(CC::reference i) {
     187inline codepoint_t & hi_codepoint(interval_t & i) {
    183188    return std::get<1>(i);
    184189}
    185 inline codepoint_t hi_codepoint(CC::const_reference i) {
     190inline codepoint_t hi_codepoint(const interval_t & i) {
    186191    return std::get<1>(i);
    187192}
     
    191196inline codepoint_t hi_codepoint(const CC::const_iterator i) {
    192197    return hi_codepoint(*i);
     198}
     199
     200template<typename itr>
     201CC * CC::initialize(itr begin, itr end) {
     202    mSparseCharSet.resize(std::distance(begin, end));
     203    for (auto i = begin; i != end; ++i) {
     204        assert (i == begin || lo_codepoint(i) > max_codepoint());
     205        mSparseCharSet[std::distance(begin, i)] = *i;
     206    }
     207    return this;
    193208}
    194209
     
    218233}
    219234
     235inline CC * makeCC(const std::initializer_list<interval_t> list) {
     236    return makeCC()->initialize(list.begin(), list.end());
     237}
     238
     239inline CC * makeCC(const std::vector<interval_t> & list) {
     240    return makeCC()->initialize(list.begin(), list.end());
     241}
     242
    220243CC * subtractCC(const CC * a, const CC * b);
    221244   
     
    224247CC * caseInsensitize(const CC * cc);
    225248
    226 CC * rangeIntersect(const CC * cc, const codepoint_t lo, const codepoint_t hi);
    227 
    228 CC * rangeGaps(const CC * cc, const codepoint_t lo, const codepoint_t hi);
    229 
    230 CC * outerRanges(const CC * cc);
    231 
    232 CC * innerRanges(const CC * cc);
    233 
    234249}
    235250
Note: See TracChangeset for help on using the changeset viewer.