Ignore:
Timestamp:
Jul 16, 2016, 12:42:28 PM (3 years ago)
Author:
xuedongx
Message:

delete GCB as a separate type.

File:
1 edited

Legend:

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

    r5083 r5091  
    1919#include <re/re_intersect.h>
    2020#include <re/re_assertion.h>
    21 #include <re/re_grapheme_boundary.hpp>
    2221#include <re/re_analysis.h>
    2322#include <re/re_memoizer.hpp>
     
    176175
    177176RE * RE_Compiler::resolveUnicodeProperties(RE * re) {
    178     Name * graphemeClusterRule = nullptr;
     177    Name * ZeroWidth = nullptr;
    179178    UCD::UCDCompiler::NameMap nameMap;
    180179    std::unordered_set<Name *> visited;
    181     nameMap = resolveNames(re, graphemeClusterRule);
     180    nameMap = resolveNames(re, ZeroWidth);
    182181   
    183182    if (LLVM_LIKELY(nameMap.size() > 0)) {
     
    196195
    197196    // Now precompile any grapheme segmentation rules
    198     if (graphemeClusterRule) {
    199         auto gcb = compileName(graphemeClusterRule, mPB);
    200         mCompiledName.insert(std::make_pair(graphemeClusterRule, gcb));
     197    if (ZeroWidth) {
     198        auto gcb = compileName(ZeroWidth, mPB);
     199        mCompiledName.insert(std::make_pair(ZeroWidth, gcb));
    201200    }
    202201    return re;
     
    242241    } else if (isa<End>(re)) {
    243242        return compileEnd(marker, pb);
    244     } else if (isa<GraphemeBoundary>(re)) {
    245         return compileGraphemeBoundary(cast<GraphemeBoundary>(re), marker, pb);
    246243    }
    247244    throw std::runtime_error("RE Compiler failed to process " + Printer_RE::PrintRE(re));
     
    270267        nameMarker.stream = pb.createAnd(markerVar(nextPos), markerVar(nameMarker), name->getName());
    271268        return nameMarker;
    272     }
    273     else {
     269    } else if (name->getType() == Name::Type::ZeroWidth) {
     270        RE * zerowidth = name->getDefinition();
     271        MarkerType zero = compile(zerowidth, pb);
     272        AlignMarkers(marker, zero, pb);
     273        PabloAST * ze = markerVar(zero);
     274        const std::string value = name->getName();
     275        if (value == "NonGCB") {
     276            ze = pb.createNot(ze);
     277        }
     278        return makeMarker(markerPos(marker), pb.createAnd(markerVar(marker), ze, "zerowidth"));
     279    } else {
    274280        return process(name->getDefinition(), marker, pb);
    275281    }
     
    574580}
    575581
    576 inline MarkerType RE_Compiler::compileGraphemeBoundary(GraphemeBoundary * gb, MarkerType marker, pablo::PabloBuilder & pb) {
     582/*inline MarkerType RE_Compiler::compileGraphemeBoundary(GraphemeBoundary * gb, MarkerType marker, pablo::PabloBuilder & pb) {
    577583    auto f = mCompiledName.find(gb->getBoundaryRule());
    578584    assert ("Internal error: failed to locate grapheme boundary rule!" && (f != mCompiledName.end()));
     
    592598    }
    593599    return marker;
    594 }
     600}*/
    595601
    596602inline MarkerType RE_Compiler::AdvanceMarker(MarkerType marker, const MarkerPosition newpos, PabloBuilder & pb) {
Note: See TracChangeset for help on using the changeset viewer.