Ignore:
Timestamp:
Oct 18, 2014, 5:43:45 PM (5 years ago)
Author:
nmedfort
Message:

Big update to use CC_NameMap; removed CharClass? and RE_Reducer.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/re/re_name.h

    r4246 r4249  
    44#include <re/re_re.h>
    55#include <string>
     6#include <iostream>
     7#include <re/printer_re.h>
    68
    79namespace pablo {
     
    4042    virtual ~Name() {}
    4143protected:
    42     friend Name * makeName();
    4344    friend Name * makeName(const std::string, RE *);
    4445    friend Name * makeName(const std::string, const bool, const Type);
    45     Name();
    46     Name(const std::string && name, const bool negated, const Type type);
    47     Name(const std::string && name, RE * cc);
     46
     47    Name(const std::string && name, const bool negated, const Type type, RE * cc)
     48    : RE(ClassTypeId::Name)
     49    , mName(std::move(name))
     50    , mNegated(negated)
     51    , mType(type)
     52    , mCC(cc)
     53    , mVar(nullptr)
     54    {
     55
     56    }
     57
    4858private:
    4959    const std::string   mName;
     
    5363    pablo::Var *        mVar;
    5464};
    55 
    56 inline Name::Name()
    57 : RE(ClassTypeId::Name)
    58 , mName()
    59 , mNegated(false)
    60 , mType(Type::FixedLength)
    61 , mCC(nullptr)
    62 , mVar(nullptr)
    63 {
    64 
    65 }
    66 
    67 inline Name::Name(const std::string && name, const bool negated, const Type type)
    68 : RE(ClassTypeId::Name)
    69 , mName(std::move(name))
    70 , mNegated(negated)
    71 , mType(type)
    72 , mCC(nullptr)
    73 , mVar(nullptr)
    74 {
    75 
    76 }
    77 
    78 inline Name::Name(const std::string && name, RE * cc)
    79 : RE(ClassTypeId::Name)
    80 , mName(std::move(name))
    81 , mNegated(false)
    82 , mType(Type::FixedLength)
    83 , mCC(cc)
    84 , mVar(nullptr)
    85 {
    86 
    87 }
    8865
    8966inline const std::string & Name::getName() const {
     
    10784}
    10885
    109 inline Name * makeName() {
    110     return new Name();
    111 }
    112 
    11386inline Name * makeName(const std::string name, const bool negated = false, const Name::Type type = Name::Type::FixedLength) {
    114     return new Name(std::move(name), negated, type);
     87    return new Name(std::move(name), negated, type, nullptr);
    11588}
    11689
    11790inline Name * makeName(const std::string name, RE * cc) {
    118     return new Name(std::move(name), cc);
     91    if (isa<Name>(cc)) {
     92        return cast<Name>(cc);
     93    }
     94    return new Name(std::move(name), false, Name::Type::FixedLength, cc);
    11995}
    12096
Note: See TracChangeset for help on using the changeset viewer.