Changeset 5779


Ignore:
Timestamp:
Dec 13, 2017, 12:06:28 PM (16 months ago)
Author:
cameron
Message:

Remove RE compiler dependency on linebreak/mAny

Location:
icGREP/icgrep-devel/icgrep
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/grep_engine.cpp

    r5772 r5779  
    2424#include <re/re_cc.h>
    2525#include <re/casing.h>
     26#include <re/exclude_CC.h>
    2627#include <re/re_toolchain.h>
    2728#include <toolchain/toolchain.h>
     
    118119        REs[i] = resolveGraphemeMode(REs[i], false /* not in grapheme mode at top level*/);
    119120        REs[i] = re::resolveNames(REs[i]);
     121        REs[i] = exclude_CC(REs[i], re::makeCC(re::makeCC(0x0A, 0x0D), re::makeCC(re::makeCC(0x85), re::makeCC(0x2028, 0x2029))));
     122
    120123        const auto UnicodeSets = re::collectUnicodeSets(REs[i]);
    121124        std::vector<std::vector<unsigned>> exclusiveSetIDs;
  • icGREP/icgrep-devel/icgrep/re/exclude_CC.cpp

    r5778 r5779  
    5858            case Name::Type::Unicode:
    5959            case Name::Type::UnicodeProperty:
    60                 return exclude_CC(n->getDefinition(), cc);
     60                return makeName(subtractCC(cast<CC>(n->getDefinition()), cc));
    6161            case Name::Type::ZeroWidth:
    6262                return re;
  • icGREP/icgrep-devel/icgrep/re/re_compiler.cpp

    r5777 r5779  
    8787        CC * one = makeCC(std::move(*i->first));
    8888        CC * two = makeCC(std::move(*i->second));
    89         PabloAST * pablo_one = pb.createAnd(mCCCompiler.compileCC(one), mAny);
    90         PabloAST * pablo_two = pb.createAnd(mCCCompiler.compileCC(two), mAny);
     89        PabloAST * pablo_one = mCCCompiler.compileCC(one);
     90        PabloAST * pablo_two = mCCCompiler.compileCC(two);
    9191        PabloAST * one1 = pb.createAdvance(pablo_one, 1, "one1");
    9292        PabloAST * follow = pb.createAnd(pb.createScanThru(pb.createAnd(mInitial, one1), mNonFinal), pablo_two);
     
    145145inline MarkerType RE_Compiler::compileAny(const MarkerType m, PabloBuilder & pb) {
    146146    PabloAST * nextFinalByte = markerVar(AdvanceMarker(m, MarkerPosition::FinalPostPositionUnit, pb));
    147     PabloAST * lb = mLineBreak;
    148     if (UNICODE_LINE_BREAK) {
    149         lb = pb.createOr(mLineBreak, mCRLF);
    150     }
    151     return makeMarker(MarkerPosition::FinalMatchUnit, pb.createAnd(nextFinalByte, pb.createNot(lb), "dot"));
     147    return makeMarker(MarkerPosition::FinalMatchUnit, nextFinalByte);
    152148}
    153149
     
    159155        nextPos = AdvanceMarker(marker, MarkerPosition::FinalPostPositionUnit, pb);
    160156    }
    161     return makeMarker(MarkerPosition::FinalMatchUnit, pb.createAnd(markerVar(nextPos), pb.createAnd(mCCCompiler.compileCC(cc, pb), mAny)));
     157    return makeMarker(MarkerPosition::FinalMatchUnit, pb.createAnd(markerVar(nextPos), mCCCompiler.compileCC(cc, pb)));
    162158}
    163159
     
    271267        if (LLVM_LIKELY(markerPos(cond) == MarkerPosition::FinalMatchUnit)) {
    272268            MarkerType postCond = AdvanceMarker(cond, MarkerPosition::FinalPostPositionUnit, pb);
    273             PabloAST * boundaryCond = pb.createAnd(mAny, pb.createXor(markerVar(cond), markerVar(postCond)));
     269            PabloAST * boundaryCond = pb.createXor(markerVar(cond), markerVar(postCond));
    274270            if (a->getSense() == Assertion::Sense::Negative) {
    275271                boundaryCond = pb.createNot(boundaryCond);
     
    663659, mLineBreak(nullptr)
    664660, mCRLF(nullptr)
    665 , mAny(nullptr)
    666661, mGraphemeBoundaryRule(nullptr)
    667662, mInitial(nullptr)
     
    674669    Var * const linebreak = mKernel->getInputStreamVar("linebreak");
    675670    mLineBreak = mPB.createExtract(linebreak, mPB.getInteger(0));
    676     mAny = mPB.createNot(mLineBreak, "any");
    677671    Var * const required = mKernel->getInputStreamVar("required");
    678672    mInitial = mPB.createExtract(required, mPB.getInteger(0));
  • icGREP/icgrep-devel/icgrep/re/re_compiler.h

    r5732 r5779  
    126126    pablo::PabloAST *                               mLineBreak;
    127127    pablo::PabloAST *                               mCRLF;
    128     pablo::PabloAST *                               mAny;
    129128    pablo::PabloAST *                               mGraphemeBoundaryRule;
    130129    pablo::PabloAST *                               mInitial;
Note: See TracChangeset for help on using the changeset viewer.