Changeset 5813


Ignore:
Timestamp:
Dec 28, 2017, 7:35:09 PM (9 months ago)
Author:
cameron
Message:

Re compiler fixes for raw CCs

File:
1 edited

Legend:

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

    r5812 r5813  
    9696
    9797MarkerType RE_Compiler::compileCC(CC * cc, MarkerType marker, PabloBuilder & pb) {
     98    PabloAST * nextPos = markerVar(marker);
    9899    // If Unicode CCs weren't pulled out earlier, we generate the equivalent
    99100    // byte sequence as an RE.
    100101    if (cc->getAlphabet() == &cc::Unicode) {
    101         return process(toUTF8(cc), marker, pb);
    102     }
    103     PabloAST * nextPos = markerVar(marker);
     102         MarkerType m = compile(toUTF8(cc), pb);
     103         nextPos = markerVar(AdvanceMarker(marker, FinalPostPositionUnit, pb));
     104         return makeMarker(FinalMatchUnit, pb.createAnd(markerVar(m), nextPos));
     105    }
    104106    if (isByteLength(cc)) {
    105107        if (marker.pos == FinalMatchUnit) {
     
    185187
    186188MarkerType RE_Compiler::compileAlt(Alt * alt, const MarkerType base, PabloBuilder & pb) {
    187     std::array<PabloAST *, 3> accum;
     189    std::vector<PabloAST *>  accum(3, pb.createZeroes());
    188190    // The following may be useful to force a common Advance rather than separate
    189191    // Advances in each alternative.
    190     accum.fill(pb.createZeroes());
    191192    for (RE * re : *alt) {
    192193        MarkerType m = process(re, base, pb);
     
    431432            // "multi-byte" character. Combine the masked range with any nonFinals.
    432433            PabloAST * bounded = pb.createMatchStar(cursor, pb.createOr(masked, mNonFinal), "bounded");
    433             return makeMarker(InitialPostPositionUnit, bounded);
     434            return makeMarker(FinalPostPositionUnit, bounded);
    434435        }
    435436        else if (isUnicodeUnitLength(repeated)) {
     
    478479MarkerType RE_Compiler::processUnboundedRep(RE * repeated, MarkerType marker, PabloBuilder & pb) {
    479480    // always use PostPosition markers for unbounded repetition.
    480     PabloAST * base = markerVar(AdvanceMarker(marker, FinalPostPositionUnit, pb));
     481    PabloAST * base = markerVar(AdvanceMarker(marker, InitialPostPositionUnit, pb));
    481482    if (isByteLength(repeated)  && !AlgorithmOptionIsSet(DisableMatchStar)) {
    482483        PabloAST * mask = markerVar(compile(repeated, pb));
     
    500501        PabloAST * m1 = pb.createOr(base, starPending);
    501502        PabloAST * m2 = pb.createOr(base, starAccum);
    502         MarkerType result = process(repeated, makeMarker(FinalPostPositionUnit, m1), pb);
    503         result = AdvanceMarker(result, FinalPostPositionUnit, pb);
     503        MarkerType result = process(repeated, makeMarker(InitialPostPositionUnit, m1), pb);
     504        result = AdvanceMarker(result, InitialPostPositionUnit, pb);
    504505        PabloAST * loopComputation = markerVar(result);
    505506        pb.createAssign(starPending, pb.createAnd(loopComputation, pb.createNot(m2)));
     
    517518        mCompiledName = &nestedMap;
    518519        mStarDepth++;
    519         MarkerType result = process(repeated, makeMarker(FinalPostPositionUnit, whilePending), wb);
    520         result = AdvanceMarker(result, FinalPostPositionUnit, wb);
     520        MarkerType result = process(repeated, makeMarker(InitialPostPositionUnit, whilePending), wb);
     521        result = AdvanceMarker(result, InitialPostPositionUnit, wb);
    521522        PabloAST * loopComputation = markerVar(result);
    522523        wb.createAssign(whilePending, wb.createAnd(loopComputation, wb.createNot(whileAccum)));
Note: See TracChangeset for help on using the changeset viewer.