Changeset 4329


Ignore:
Timestamp:
Dec 9, 2014, 8:05:18 PM (4 years ago)
Author:
cameron
Message:

Improved names

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

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/cc/cc_compiler.cpp

    r4287 r4329  
    7171PabloAST * CC_Compiler::compile_re(Name * name) {
    7272    assert(name);
    73     Var * var = name->getVar();
     73    Var * var = name->getCompiled();
    7474    if (var == nullptr) {
    7575        if (name->getType() == Name::Type::FixedLength) {
     
    9898            var = mCG.createVar(name->getName());
    9999        }
    100         name->setVar(var);
     100        name->setCompiled(var);
    101101    }
    102102    return var;
  • icGREP/icgrep-devel/icgrep/cc/cc_namemap.cpp

    r4308 r4329  
    1616void CC_NameMap::addPredefined(const std::string friendlyName, re::CC * cc) {
    1717    assert (cc);
    18     std::string classname = cc->getName();
     18    std::string classname = cc->canonicalName();
    1919    Name * name = makeName(classname, cc);
    2020    assert (name->getCC() == cc);
     
    5959    }
    6060    else if (CC * cc = dyn_cast<CC>(re)) {
    61         std::string classname = cc->getName();
     61        std::string classname = cc->canonicalName();
    6262        auto f = mNameMap.find(classname);
    6363        if (f == mNameMap.end()) {
  • icGREP/icgrep-devel/icgrep/re/printer_re.cpp

    r4298 r4329  
    4545    {
    4646        retVal = "CC \"";
    47         retVal += re_cc->getName();
     47        retVal += re_cc->canonicalName();
    4848        retVal += "\" ";
    4949
  • icGREP/icgrep-devel/icgrep/re/re_cc.cpp

    r4320 r4329  
    2525}
    2626
    27 std::string CC::getName() const {
     27std::string CC::canonicalName() const {
    2828    std::string name = "CC";
    29     char seperator = '_';
     29    char separator = '_';
    3030    for (const CharSetItem & i : mSparseCharSet) {
    31         name += seperator;
     31        name += separator;
    3232        if (i.lo_codepoint == i.hi_codepoint) {
    3333            name += std::to_string(i.lo_codepoint);
     
    3636            name += std::to_string(i.lo_codepoint) + "-" + std::to_string(i.hi_codepoint);
    3737        }
    38         seperator = ',';
     38        separator = ',';
    3939    }
    4040    return name;
  • icGREP/icgrep-devel/icgrep/re/re_cc.h

    r4320 r4329  
    5252    static const CodePointType UNICODE_MAX = 0x10FFFF;
    5353
    54     std::string getName() const;
     54    std::string canonicalName() const;
    5555
    5656    void insert_range(const CodePointType lo_codepoint, const CodePointType hi_codepoint);
  • icGREP/icgrep-devel/icgrep/re/re_compiler.cpp

    r4319 r4329  
    4444void RE_Compiler::compile(RE * re, PabloBlock & pb) {
    4545
    46     mLineFeed = mNameMap["LineFeed"]->getVar();
     46    mLineFeed = mNameMap["LineFeed"]->getCompiled();
    4747
    4848    const std::string initial = "initial";
     
    5050
    5151    //Set the 'internal.initial' bit stream for the utf-8 multi-byte encoding.
    52     PabloAST * u8single = mNameMap["UTF8-SingleByte"]->getVar();
    53     PabloAST * u8pfx2 = mNameMap["UTF8-Prefix2"]->getVar();
    54     PabloAST * u8pfx3 = mNameMap["UTF8-Prefix3"]->getVar();
    55     PabloAST * u8pfx4 = mNameMap["UTF8-Prefix4"]->getVar();
     52    PabloAST * u8single = mNameMap["UTF8-SingleByte"]->getCompiled();
     53    PabloAST * u8pfx2 = mNameMap["UTF8-Prefix2"]->getCompiled();
     54    PabloAST * u8pfx3 = mNameMap["UTF8-Prefix3"]->getCompiled();
     55    PabloAST * u8pfx4 = mNameMap["UTF8-Prefix4"]->getCompiled();
    5656    PabloAST * u8pfx = pb.createOr(pb.createOr(u8pfx2, u8pfx3), u8pfx4);
    5757    mInitial = pb.createVar(pb.createAssign(initial, pb.createOr(u8pfx, u8single)));
     
    8282    }
    8383    else {
    84         return name->getVar();
     84        return name->getCompiled();
    8585    }
    8686}
     
    223223        if (isFixedLength(repeated)) {
    224224        Name * name = cast<Name>(repeated);
    225         Assign * cc_lb = consecutive(pb.createAssign("repeated", pb.createAdvance(name->getVar(), 1)), 1, lb, pb);
     225        Assign * cc_lb = consecutive(pb.createAssign("repeated", pb.createAdvance(name->getCompiled(), 1)), 1, lb, pb);
    226226                return pb.createAssign("lowerbound", pb.createAnd(pb.createAdvance(pb.createVar(marker), lb), pb.createVar(cc_lb)));
    227227        }
     
    240240                Assign * nonMatch = pb.createAssign("nonmatch", pb.createNot(pb.createVar(marker)));
    241241                PabloAST * upperLimitMask = pb.createNot(pb.createVar(consecutive(nonMatch, 1, ub + 1, pb)));
    242         PabloAST * rep_class_var = cast<Name>(repeated)->getVar();
     242        PabloAST * rep_class_var = cast<Name>(repeated)->getCompiled();
    243243        return pb.createAssign("bounded", pb.createAnd(pb.createMatchStar(pb.createVar(marker), rep_class_var), upperLimitMask));
    244244        }
  • icGREP/icgrep-devel/icgrep/re/re_name.h

    r4272 r4329  
    3232    Type getType() const;
    3333    RE *getCC() const;
    34     pablo::Var * getVar() const {
    35         return mVar;
     34    pablo::Var * getCompiled() const {
     35        return mCompiled;
    3636    }
    37     void setVar(pablo::Var * var) {
    38         mVar = var;
     37    void setCompiled(pablo::Var * var) {
     38        mCompiled = var;
    3939    }
    4040    void setCC(RE *cc);
     
    5151    , mType(type)
    5252    , mCC(cc)
    53     , mVar(nullptr)
     53    , mCompiled(nullptr)
    5454    {
    5555
     
    6060    const Type          mType;
    6161    RE *                mCC;
    62     pablo::Var *        mVar;
     62    pablo::Var *        mCompiled;
    6363};
    6464
Note: See TracChangeset for help on using the changeset viewer.