Skip to content
Snippets Groups Projects
Commit aed00fee authored by Jan Trávníček's avatar Jan Trávníček
Browse files

fix ordering of regexps

parent e40ea7de
No related branches found
No related tags found
No related merge requests found
......@@ -135,9 +135,10 @@ std::ostream& operator <<(std::ostream& out, const RegExp& regExp) {
}
 
bool RegExp::operator<(const RegExp& other) const {
if(*this == other) return false;
if(*(this->regExp) < *(other.regExp)) {
return true;
} else if(*(this->regExp) > *(other.regExp)) {
return false;
} else {
return this->alphabet < other.alphabet;
}
......
......@@ -34,27 +34,27 @@ bool RegExpElement::operator!=(const RegExpElement& other) const {
 
 
bool RegExpElement::operator<(const Concatenation& other) const {
return typeid(this).before(typeid(other));
return typeid(*this).before(typeid(other));
}
 
bool RegExpElement::operator<(const Alternation& other) const {
return typeid(this).before(typeid(other));
return typeid(*this).before(typeid(other));
}
 
bool RegExpElement::operator<(const Iteration& other) const {
return typeid(this).before(typeid(other));
return typeid(*this).before(typeid(other));
}
 
bool RegExpElement::operator<(const RegExpSymbol& other) const {
return typeid(this).before(typeid(other));
return typeid(*this).before(typeid(other));
}
 
bool RegExpElement::operator<(const RegExpEpsilon& other) const {
return typeid(this).before(typeid(other));
return typeid(*this).before(typeid(other));
}
 
bool RegExpElement::operator<(const RegExpEmpty& other) const {
return typeid(this).before(typeid(other));
return typeid(*this).before(typeid(other));
}
 
 
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment