Ignore:
Timestamp:
Feb 9, 2017, 4:06:24 PM (2 years ago)
Author:
cameron
Message:

Boundary assertions; comment out a bug with RemoveNullableAfterAssertion?

File:
1 edited

Legend:

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

    r5267 r5308  
    266266        return compileEnd(marker, pb);
    267267    }
    268     throw std::runtime_error("RE Compiler failed to process " + Printer_RE::PrintRE(re));
     268    UnsupportedRE("RE Compiler failed to process " + Printer_RE::PrintRE(re));
    269269}
    270270
     
    313313        return m;
    314314    }
    315     throw std::runtime_error("Unresolved name " + name->getName());
     315    UnsupportedRE("Unresolved name " + name->getName());
    316316}
    317317
     
    377377        }
    378378        return makeMarker(markerPos(marker), pb.createAnd(markerVar(marker), lb, "lookback"));
     379    } else if (a->getKind() == Assertion::Kind::Boundary) {
     380        MarkerType cond = compile(asserted, pb);
     381        if (LLVM_LIKELY(markerPos(cond) == MarkerPosition::FinalMatchUnit)) {
     382            MarkerType postCond = AdvanceMarker(cond, MarkerPosition::FinalPostPositionUnit, pb);
     383            PabloAST * boundaryCond = pb.createAnd(mAny, pb.createXor(markerVar(cond), markerVar(postCond)));
     384            if (a->getSense() == Assertion::Sense::Negative) {
     385                boundaryCond = pb.createNot(boundaryCond);
     386            }
     387            MarkerType fbyte = AdvanceMarker(marker, MarkerPosition::FinalPostPositionUnit, pb);
     388            return makeMarker(MarkerPosition::FinalPostPositionUnit, pb.createAnd(markerVar(fbyte), boundaryCond, "boundary"));
     389        }
     390        else UnsupportedRE("Unsupported boundary assertion");
    379391    } else if (isUnicodeUnitLength(asserted)) {
    380392        MarkerType lookahead = compile(asserted, pb);
     
    388400        }
    389401    }
    390     throw std::runtime_error("Unsupported lookahead assertion.");
     402    UnsupportedRE("Unsupported lookahead assertion.");
    391403}
    392404
     
    406418        return makeMarker(markerPos(t1), pb.createAnd(markerVar(t1), pb.createNot(markerVar(t2)), "diff"));
    407419    }
    408     throw std::runtime_error("Unsupported Diff operands: " + Printer_RE::PrintRE(diff));
     420    UnsupportedRE("Unsupported Diff operands: " + Printer_RE::PrintRE(diff));
    409421}
    410422
     
    418430        return makeMarker(markerPos(t1), pb.createAnd(markerVar(t1), markerVar(t2), "intersect"));
    419431    }
    420     throw std::runtime_error("Unsupported Intersect operands: " + Printer_RE::PrintRE(x));
     432    UnsupportedRE("Unsupported Intersect operands: " + Printer_RE::PrintRE(x));
    421433}
    422434
     
    625637    }
    626638}
     639   
     640LLVM_ATTRIBUTE_NORETURN void RE_Compiler::UnsupportedRE(std::string errmsg) {
     641    llvm::report_fatal_error(errmsg);
     642}
     643   
     644   
    627645
    628646RE_Compiler::RE_Compiler(PabloKernel * kernel, cc::CC_Compiler & ccCompiler, bool CountOnly)
Note: See TracChangeset for help on using the changeset viewer.