Ignore:
Timestamp:
Dec 28, 2017, 1:15:13 PM (13 months ago)
Author:
nmedfort
Message:

Bug fix for RE local + some clean up of RE local and the RE Compiler

File:
1 edited

Legend:

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

    r5810 r5812  
    2525namespace re { class CC; }
    2626
    27 //namespace UCD {
    28 //class UnicodeSet;
    29 //}
    30 
    3127/*   Marker streams represent the results of matching steps.
    3228     Three types of marker streams are used internally.
     
    4339namespace re {
    4440
    45 enum MarkerPosition {FinalMatchUnit, InitialPostPositionUnit, FinalPostPositionUnit};
    46 
    47 struct MarkerType {
    48     MarkerPosition pos;
    49     pablo::PabloAST * stream;
    50     MarkerType & operator =(const MarkerType &) = default;
    51 };
    52 
    53 inline MarkerPosition markerPos(const MarkerType & m) {return m.pos; }
    54 
    55 inline pablo::PabloAST * markerVar(const MarkerType & m) {return m.stream; }
    56 
    57 inline MarkerType makeMarker(MarkerPosition newpos, pablo::PabloAST * strm) {return {newpos, strm};}
    58 
    59 
    6041class RE_Compiler {
    6142public:
    6243
     44    enum MarkerPosition {FinalMatchUnit, InitialPostPositionUnit, FinalPostPositionUnit};
     45
     46    struct MarkerType {
     47        MarkerPosition pos;
     48        pablo::PabloAST * stream;
     49        MarkerType & operator =(const MarkerType &) = default;
     50    };
     51
    6352    RE_Compiler(pablo::PabloKernel * kernel, cc::CC_Compiler & ccCompiler);
    64     pablo::PabloAST * compile(RE * re);
     53    pablo::PabloAST * compile(RE * re, pablo::PabloAST * const initialCursors = nullptr);
    6554
    6655    static LLVM_ATTRIBUTE_NORETURN void UnsupportedRE(std::string errmsg);
     
    8877    };
    8978
    90     MarkerType compile(RE * re, pablo::PabloBuilder & cg);
     79
     80    MarkerType compile(RE * re, pablo::PabloBuilder & pb);
     81    MarkerType compile(RE * re, pablo::PabloAST * const cursors, pablo::PabloBuilder & pb);
    9182
    9283    MarkerType process(RE * re, MarkerType marker, pablo::PabloBuilder & pb);
     
    9586    MarkerType compileSeq(Seq * seq, MarkerType marker, pablo::PabloBuilder & pb);
    9687    MarkerType compileSeqTail(Seq::iterator current, const Seq::iterator end, int matchLenSoFar, MarkerType marker, pablo::PabloBuilder & pb);
    97     MarkerType compileAlt(Alt * alt, MarkerType marker, pablo::PabloBuilder & pb);
     88    MarkerType compileAlt(Alt * alt, MarkerType base, pablo::PabloBuilder & pb);
    9889    MarkerType compileAssertion(Assertion * a, MarkerType marker, pablo::PabloBuilder & pb);
    9990    MarkerType compileRep(Rep * rep, MarkerType marker, pablo::PabloBuilder & pb);
     
    114105    MarkerType AdvanceMarker(MarkerType marker, const MarkerPosition newpos, pablo::PabloBuilder & pb);
    115106    void AlignMarkers(MarkerType & m1, MarkerType & m2, pablo::PabloBuilder & pb);
     107
     108    static inline MarkerPosition markerPos(const MarkerType & m) {return m.pos; }
     109    static inline pablo::PabloAST * markerVar(const MarkerType & m) {return m.stream; }
     110    static inline MarkerType makeMarker(MarkerPosition newpos, pablo::PabloAST * strm) {return {newpos, strm};}
    116111
    117112private:
Note: See TracChangeset for help on using the changeset viewer.