Changeset 5899 for icGREP


Ignore:
Timestamp:
Mar 10, 2018, 6:16:17 PM (11 months ago)
Author:
cameron
Message:

Fixes for Unix line break mode

Location:
icGREP/icgrep-devel/icgrep/re
Files:
2 edited

Legend:

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

    r5898 r5899  
    115115        return true;
    116116    } else if (const Seq * seq = dyn_cast<Seq>(re)) {
    117         return (seq->size() == 1) && isByteLength(&seq[0]);
     117        bool byteLengthSeen = false;
     118        for (const RE * e : *seq) {
     119            if (isa<Assertion>(e)) continue;
     120            else if (byteLengthSeen) return false;
     121            else if (isByteLength(e)) byteLengthSeen = true;
     122            else return false;
     123        }
     124        return byteLengthSeen;
    118125    } else if (const Rep * rep = dyn_cast<Rep>(re)) {
    119126        return (rep->getLB() == 1) && (rep->getUB() == 1) && isByteLength(rep->getRE());
  • icGREP/icgrep-devel/icgrep/re/re_compiler.cpp

    r5897 r5899  
    130130            nextPos = pb.createAdvance(nextPos, 1);
    131131        }
    132         return makeMarker(FinalMatchUnit, pb.createAnd(nextPos, mCCCompiler.compileCC(cc, pb)));
     132        return makeMarker(FinalMatchUnit, pb.createAnd(nextPos, pb.createInFile(mCCCompiler.compileCC(cc, pb))));
    133133    } else if (a == &cc::Unicode) {
    134134        MarkerType m = compile(toUTF8(cc), pb);
     
    266266        }
    267267        else UnsupportedRE("Unsupported boundary assertion");
     268    } else if (isByteLength(asserted)) {
     269        MarkerType lookahead = compile(asserted, pb);
     270        if (LLVM_LIKELY(markerPos(lookahead) == FinalMatchUnit)) {
     271            PabloAST * la = markerVar(lookahead);
     272            if (a->getSense() == Assertion::Sense::Negative) {
     273                la = pb.createNot(la);
     274            }
     275            MarkerType fbyte = AdvanceMarker(marker, InitialPostPositionUnit, pb);
     276            return makeMarker(InitialPostPositionUnit, pb.createAnd(markerVar(fbyte), la, "lookahead"));
     277        }
    268278    } else if (isUnicodeUnitLength(asserted)) {
    269279        MarkerType lookahead = compile(asserted, pb);
Note: See TracChangeset for help on using the changeset viewer.