Ignore:
Timestamp:
Aug 5, 2018, 9:06:54 PM (12 months ago)
Author:
xwa163
Message:

UTF-8 support for Multiplexing LZ4 Grep

File:
1 edited

Legend:

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

    r5908 r6140  
    6363}
    6464
    65 RE * toUTF8(RE * r) {
    66     if (isa<Name>(r) || isa<Start>(r) || isa<End>(r)) {
     65RE * toUTF8(RE * r, bool convertName) {
     66    if (const Name*  n = dyn_cast<Name>(r)) {
     67        if (convertName) {
     68            return toUTF8(n->getDefinition(), convertName);
     69        } else {
     70            return r;
     71        }
     72    }
     73    else if (isa<Name>(r) || isa<Start>(r) || isa<End>(r)) {
    6774        return r;
    6875    } else if (const CC * cc = dyn_cast<CC>(r)) {
     
    7784        list.reserve(alt->size());
    7885        for (RE * a : *alt) {
    79             list.push_back(toUTF8(a));
     86            list.push_back(toUTF8(a, convertName));
    8087        }
    8188        return makeAlt(list.begin(), list.end());
     
    8491        list.reserve(seq->size());
    8592        for (RE * s : *seq) {
    86             list.push_back(toUTF8(s));
     93            list.push_back(toUTF8(s, convertName));
    8794        }
    8895        return makeSeq(list.begin(), list.end());
    8996    } else if (Assertion * a = dyn_cast<Assertion>(r)) {
    90         return makeAssertion(toUTF8(a->getAsserted()), a->getKind(), a->getSense());
     97        return makeAssertion(toUTF8(a->getAsserted(), convertName), a->getKind(), a->getSense());
    9198    } else if (Rep * rep = dyn_cast<Rep>(r)) {
    92         RE * expr = toUTF8(rep->getRE());
     99        RE * expr = toUTF8(rep->getRE(), convertName);
    93100        return makeRep(expr, rep->getLB(), rep->getUB());
    94101    } else if (Diff * diff = dyn_cast<Diff>(r)) {
    95         return makeDiff(toUTF8(diff->getLH()), toUTF8(diff->getRH()));
     102        return makeDiff(toUTF8(diff->getLH(), convertName), toUTF8(diff->getRH(), convertName));
    96103    } else if (Intersect * e = dyn_cast<Intersect>(r)) {
    97         return makeIntersect(toUTF8(e->getLH()), toUTF8(e->getRH()));
     104        return makeIntersect(toUTF8(e->getLH(), convertName), toUTF8(e->getRH(), convertName));
    98105    }
    99106    llvm_unreachable("unexpected RE type given to toUTF8");
Note: See TracChangeset for help on using the changeset viewer.