Ignore:
Timestamp:
Jun 17, 2017, 2:53:30 PM (2 years ago)
Author:
cameron
Message:

Allow repeated quantifiers in parsing, support possessive quantifiers, further optimizations

File:
1 edited

Legend:

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

    r5509 r5515  
    3535        int l = rep->getLB();
    3636        int u = rep->getUB();
    37         if (u == Rep::UNBOUNDED_REP) {
     37        if (lb == ub) {
     38            return new Rep(rep->getRE(), l * lb, ubCombine(u, ub));
     39        }
     40        else if (u == Rep::UNBOUNDED_REP) {
    3841            if (l == 0) {
    3942                /*  R{0,}{lb, ub} = R{0,} */
     
    5861            if ((ub == Rep::UNBOUNDED_REP) || (ub >= n)) {
    5962                RE * r1 = new Rep(rep->getRE(), n * l, ubCombine(u, ub));
    60                 RE * r2 = new Rep(rep, lb, n - 1);
     63                RE * r2 = makeRep(rep, lb, n - 1);  // makeRep recursive simplifies.
    6164                return makeAlt({r1, r2});
    6265            }
Note: See TracChangeset for help on using the changeset viewer.