diff --git a/alib/src/regexp/RegExp.cpp b/alib/src/regexp/RegExp.cpp index 5730a96c30241a334149d3fc6f4647e7a9922c0f..b35657c0d97d7376f54e012d56f8539ff997d08a 100644 --- a/alib/src/regexp/RegExp.cpp +++ b/alib/src/regexp/RegExp.cpp @@ -70,6 +70,10 @@ void RegExp::setRegExp(RegExpElement* regExp) { this->regExp = regExp; } +bool RegExp::isEmpty() const { + return regExp == NULL || dynamic_cast<const RegExpEmpty*>(regExp); +} + void RegExp::toXML(ostream& out) { RegExpPrinter::toXML(*this, out); } diff --git a/alib/src/regexp/RegExp.h b/alib/src/regexp/RegExp.h index 19f25308bcd22331d4863289e05c5cf9868dde54..e31198ae94f0ae3d3c6bbcdce2adbf58867b3645 100644 --- a/alib/src/regexp/RegExp.h +++ b/alib/src/regexp/RegExp.h @@ -55,6 +55,11 @@ public: */ void setRegExp(RegExpElement* regExp); + /** + * @return true if regexp represents empty language + */ + bool isEmpty() const; + /** * Prints XML representation of the RegExp to the output stream. * @param out output stream to which print the RegExp