Changeset 5863


Ignore:
Timestamp:
Feb 6, 2018, 11:21:07 AM (10 months ago)
Author:
cameron
Message:

Eliminate mInitial - only 1 required UTF-8 stream

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

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/kernels/grep_kernel.cpp

    r5847 r5863  
    109109    //
    110110    //
    111    
    112     it.createAssign(valid_pfx, it.createAnd(valid_pfx, u8valid));
    113111    it.createAssign(nonFinal, it.createAnd(nonFinal, u8valid));
    114    
    115     PabloAST * u8single = pb.createAnd(ccc.compileCC(makeByte(0x00, 0x7F)), pb.createNot(u8invalid));
    116     PabloAST * const initial = pb.createOr(u8single, valid_pfx, "initial");
    117     PabloAST * const final = pb.createNot(pb.createOr(nonFinal, u8invalid), "final");
    118112
    119113    Var * const required = getOutputStreamVar("required");
    120     pb.createAssign(pb.createExtract(required, pb.getInteger(0)), initial);
    121     pb.createAssign(pb.createExtract(required, pb.getInteger(1)), nonFinal);
    122     pb.createAssign(pb.createExtract(required, pb.getInteger(2)), final);
    123 
     114    pb.createAssign(pb.createExtract(required, pb.getInteger(0)), nonFinal);
    124115}
    125116
     
    129120{Binding{kb->getStreamSetTy(8), "basis"}},
    130121// output
    131 {Binding{kb->getStreamSetTy(3), "required", FixedRate(), Add1()}}) {
     122{Binding{kb->getStreamSetTy(1), "required", FixedRate()}}) {
    132123
    133124}
     
    182173        Binding{b->getStreamSetTy(1, 1), "linebreak"},
    183174        Binding{b->getStreamSetTy(1, 1), "cr+lf"},
    184         Binding{b->getStreamSetTy(3, 1), "required"}
     175        Binding{b->getStreamSetTy(1, 1), "required"}
    185176    };
    186177    for (const auto & alphabet : alphabets) {
  • icGREP/icgrep-devel/icgrep/re/re_compiler.cpp

    r5847 r5863  
    234234        return makeMarker(InitialPostPositionUnit, combine);
    235235    }
    236     combine = pb.createOr(pb.createScanThru(pb.createAnd(mInitial, combine), mNonFinal), accum[FinalPostPositionUnit], "alt");
     236    combine = pb.createOr(pb.createOr(pb.createAnd(combine, mFinal), pb.createScanThru(pb.createAnd(mNonFinal, combine), mNonFinal)), accum[FinalPostPositionUnit], "alt");
    237237    return makeMarker(FinalPostPositionUnit, combine);
    238238}
     
    567567        }
    568568        if (newpos == FinalPostPositionUnit) {
    569             marker.stream = pb.createScanThru(pb.createAnd(mInitial, marker.stream), mNonFinal, "fpp");
     569            marker.stream = pb.createOr(pb.createAnd(marker.stream, mFinal), pb.createScanThru(pb.createAnd(mNonFinal, marker.stream), mNonFinal, "fpp"));
    570570            marker.pos = FinalPostPositionUnit;
    571571        }
     
    591591, mLineBreak(nullptr)
    592592, mCRLF(nullptr)
    593 , mInitial(nullptr)
    594593, mNonFinal(nullptr)
    595594, mFinal(nullptr)
     
    603602    mCRLF = mPB.createExtract(crlf, 0);
    604603    Var * const required = mKernel->getInputStreamVar("required");
    605     mInitial = mPB.createExtract(required, 0);
    606     mNonFinal = mPB.createExtract(required, 1);
    607     mFinal = mPB.createExtract(required, 2);
     604    mNonFinal = mPB.createExtract(required, 0);
     605    mFinal = mPB.createNot(mNonFinal);
    608606}
    609607
Note: See TracChangeset for help on using the changeset viewer.