diff --git a/src/rewrite/Mod.cpp b/src/rewrite/Mod.cpp index 65e87be09..3bfea6c5e 100644 --- a/src/rewrite/Mod.cpp +++ b/src/rewrite/Mod.cpp @@ -38,12 +38,63 @@ Mod::~Mod () } //////////////////////////////////////////////////////////////////////////////// -bool Mod::isRecognized () +// before after +// not +// none any +// over under +// synth +// first last +// this +// next +// is isnt +// has hasnt +// startswith endswith +bool Mod::isValid () { - if (*this == ".is") + if (*this == "before" || *this == "after" || + *this == "not" || + *this == "none" || *this == "any" || + *this == "synth" || + *this == "under" || *this == "over" || + *this == "first" || *this == "last" || + *this == "this" || + *this == "next" || + *this == "is" || *this == "isnt" || + *this == "has" || *this == "hasnt" || + *this == "startswith" || *this == "endswith") return true; return false; } //////////////////////////////////////////////////////////////////////////////// +bool Mod::eval (const Mod& other) +{ + // before + // after + // non + // none + // any + // synth + // under + // over + // first + // last + // this + // next + + if (*this == ".is") + return *this == other ? true : false; + + if (*this == ".isnt") + return *this != other ? true : false; + + // has + // hasnt + // startswith + // endswith + + return false; +} + +//////////////////////////////////////////////////////////////////////////////// diff --git a/src/rewrite/Mod.h b/src/rewrite/Mod.h index c18ad8c2e..4e7e6e669 100644 --- a/src/rewrite/Mod.h +++ b/src/rewrite/Mod.h @@ -29,13 +29,16 @@ #include +class Mod; + class Mod : public std::string { public: Mod (); // Default constructor ~Mod (); // Destructor - bool isRecognized (); + bool isValid (); + bool eval (const Mod&); }; #endif