Ignore:
Timestamp:
Dec 15, 2017, 12:44:01 PM (19 months ago)
Author:
nmedfort
Message:

Initial check-in of LookAhead? support; modified LineBreakKernel? to compute CR+LF using LookAhead?(1) + misc. fixes.

File:
1 edited

Legend:

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

    r5775 r5782  
    5252RE * makeAlt(iterator begin, iterator end) {
    5353    Alt * newAlt = makeAlt();
    54     CC * unionCC = makeCC();
     54    CC * unionCC = nullptr;
    5555    for (auto i = begin; i != end; ++i) {
    56         if (const CC * cc = llvm::dyn_cast<CC>(*i)) {
    57             unionCC = makeCC(unionCC, cc);
     56        if (CC * cc = llvm::dyn_cast<CC>(*i)) {
     57            unionCC = unionCC ? makeCC(unionCC, cc) : cc;
    5858        } else if (const Alt * alt = llvm::dyn_cast<Alt>(*i)) {
    5959            // We have an Alt to embed within the alt.  We extract the individual
     
    6262            for (RE * a : *alt) {
    6363                if (CC * cc = llvm::dyn_cast<CC>(a)) {
    64                     unionCC = makeCC(unionCC, cc);
     64                    unionCC = unionCC ? makeCC(unionCC, cc) : cc;
     65                } else {
     66                    newAlt->push_back(a);
    6567                }
    66                 else newAlt->push_back(a);
    6768            }
    6869        }
     
    7172        }
    7273    }
    73     if (!unionCC->empty()) newAlt->push_back(unionCC);
     74    if (unionCC) {
     75        newAlt->push_back(unionCC);
     76    }
    7477    return newAlt;
    7578}
Note: See TracChangeset for help on using the changeset viewer.