Ignore:
Timestamp:
Mar 16, 2016, 2:06:52 PM (4 years ago)
Author:
cameron
Message:

-invert-matches/-v option

File:
1 edited

Legend:

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

    r4921 r4978  
    3636
    3737static cl::OptionCategory fREcompilationOptions("Regex Compilation Options", "These options control the compilation of regular expressions to Pablo.");
     38static cl::opt<bool> InvertMatches("v", cl::init(false),
     39                     cl::desc("select non-matching lines"), cl::cat(fREcompilationOptions));
     40static cl::alias InvertMatchesLong("invert-matches", cl::desc("Alias for -v"), cl::aliasopt(InvertMatches));
    3841
    3942static cl::opt<bool> DisableLog2BoundedRepetition("disable-log2-bounded-repetition", cl::init(false),
     
    377380
    378381void RE_Compiler::finalizeMatchResult(MarkerType match_result) {
    379     mFunction.setResult(0, mPB.createAssign("matches", mPB.createAnd(mPB.createMatchStar(markerVar(match_result), mAny), UNICODE_LINE_BREAK ? mUnicodeLineBreak : mLineFeed)));
     382    PabloAST * match_follow = mPB.createMatchStar(markerVar(match_result), mAny);
     383    if (InvertMatches) {
     384        match_follow = mPB.createNot(match_follow);
     385    }
     386    mFunction.setResult(0, mPB.createAssign("matches", mPB.createAnd(match_follow, UNICODE_LINE_BREAK ? mUnicodeLineBreak : mLineFeed)));
    380387}
    381388
Note: See TracChangeset for help on using the changeset viewer.