Ignore:
Timestamp:
Dec 31, 2017, 7:22:14 PM (20 months ago)
Author:
cameron
Message:

Supporting multiple alphabets in RE compilation - initial check-in

Location:
icGREP/icgrep-devel/icgrep/cc
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/cc/alphabet.h

    r5800 r5816  
    2222public:
    2323    const std::string & getName() const { return mAlphabetName;}
     24    virtual const unsigned getSize() const = 0;
    2425    enum class ClassTypeId : unsigned {UnicodeMappableAlphabet, CodeUnitAlphabet, MultiplexedAlphabet};
    2526    inline ClassTypeId getClassTypeId() const {
     
    5758    unsigned fromUnicode(const UCD::codepoint_t ucp) const;
    5859
     60    const unsigned getSize() const override {return mUnicodeCommon + mAboveCommon.size();}
     61
    5962protected:
    6063    UCD::codepoint_t mCharSet;
     
    7174    static inline bool classof(const void *) {return false;}
    7275    uint8_t getCodeUnitBitWidth() { return mCodeUnitBits;}
    73    
     76    const unsigned getSize() const override {return 1<<mCodeUnitBits;}
     77
    7478private:
    7579    uint8_t mCodeUnitBits;
  • icGREP/icgrep-devel/icgrep/cc/multiplex_CCs.cpp

    r5801 r5816  
    99#include "boost/dynamic_bitset.hpp"
    1010#include <cc/multiplex_CCs.h>
     11#include <re/printer_re.h>
    1112#include <llvm/Support/Casting.h>
    1213#include <llvm/Support/ErrorHandling.h>
     14#include <llvm/Support/raw_ostream.h>
    1315
    1416namespace cc {
     
    138140   
    139141    const auto index = find(mUnicodeSets.begin(), mUnicodeSets.end(), sourceCC) - mUnicodeSets.begin();
     142    if (index >= mUnicodeSets.size()) {
     143        llvm::errs() << Printer_RE::PrintRE(sourceCC) << " not found\n";
     144    }
    140145    const auto exclusive_IDs = mExclusiveSetIDs[index];
    141146    re::CC * CC_union = re::makeCC(this);
  • icGREP/icgrep-devel/icgrep/cc/multiplex_CCs.h

    r5801 r5816  
    2020    }
    2121    static inline bool classof(const void *) {return false;}
     22   
     23    const unsigned getSize() const override {return mUnicodeSets.size() + 1;}
    2224
    2325    const Alphabet * getSourceAlphabet() const;
Note: See TracChangeset for help on using the changeset viewer.