diff --git a/alib2data/src/alphabet/BlankSymbol.cpp b/alib2data/src/alphabet/BlankSymbol.cpp index 2f4f17821ec8f432e4a3e88ab35ea5996237fa84..a16b784d1f6f01a97fba039412449e30930e93d8 100644 --- a/alib2data/src/alphabet/BlankSymbol.cpp +++ b/alib2data/src/alphabet/BlankSymbol.cpp @@ -46,7 +46,7 @@ void BlankSymbol::operator>>(std::ostream& out) const { } BlankSymbol::operator std::string () const { - return ""; + return "B"; } BlankSymbol BlankSymbol::BLANK = BlankSymbol(); diff --git a/alib2data/src/alphabet/BottomOfTheStackSymbol.cpp b/alib2data/src/alphabet/BottomOfTheStackSymbol.cpp index 7aa1015591df86eb7286e9ef27c148b0fa40b606..8250981971b83bc9cc69daab016161a228e82f13 100644 --- a/alib2data/src/alphabet/BottomOfTheStackSymbol.cpp +++ b/alib2data/src/alphabet/BottomOfTheStackSymbol.cpp @@ -42,11 +42,11 @@ bool BottomOfTheStackSymbol::operator <(const BottomOfTheStackSymbol&) const { } void BottomOfTheStackSymbol::operator>>(std::ostream& out) const { - out << "(Blank symbol)"; + out << "(BottomOfTheStackSymbol)"; } BottomOfTheStackSymbol::operator std::string () const { - return ""; + return "T"; } BottomOfTheStackSymbol BottomOfTheStackSymbol::BOTTOM_OF_THE_STACK = BottomOfTheStackSymbol(); diff --git a/alib2data/src/alphabet/EndSymbol.cpp b/alib2data/src/alphabet/EndSymbol.cpp index 05efd4a4f38e2071f34d79b5dbf80ee8bb3f3c41..97cb86d67e1a4fe0bf3811990555e7937bf6070a 100644 --- a/alib2data/src/alphabet/EndSymbol.cpp +++ b/alib2data/src/alphabet/EndSymbol.cpp @@ -42,11 +42,11 @@ bool EndSymbol::operator <(const EndSymbol&) const { } void EndSymbol::operator>>(std::ostream& out) const { - out << "(Blank symbol)"; + out << "(EndSymbol)"; } EndSymbol::operator std::string () const { - return ""; + return "$"; } EndSymbol EndSymbol::END = EndSymbol(); diff --git a/alib2data/src/alphabet/SymbolBase.cpp b/alib2data/src/alphabet/SymbolBase.cpp index b26548fa9ed8fc0e96a7cb664d7f0f096bb4de4f..5b5bd2ff81d7463f524e0600d56d0d961990a712 100644 --- a/alib2data/src/alphabet/SymbolBase.cpp +++ b/alib2data/src/alphabet/SymbolBase.cpp @@ -19,6 +19,14 @@ SymbolBase::~SymbolBase() noexcept { } +bool SymbolBase::operator>=(const SymbolBase& other) const { + return !(*this < other); +} + +bool SymbolBase::operator<=(const SymbolBase& other) const { + return !(*this > other); +} + bool SymbolBase::operator !=(const SymbolBase& other) const { return !(*this == other); } diff --git a/alib2data/src/alphabet/SymbolBase.h b/alib2data/src/alphabet/SymbolBase.h index fae60484273c6820f10b7e9eae51ff53579cae2b..8d3ae6d9772a730ac34fef26a5162cfac514281e 100644 --- a/alib2data/src/alphabet/SymbolBase.h +++ b/alib2data/src/alphabet/SymbolBase.h @@ -26,22 +26,26 @@ public: virtual ~SymbolBase() noexcept; virtual SymbolBase* clone() const = 0; - virtual SymbolBase* plunder() && = 0; + virtual SymbolBase* plunder() && = 0; + + bool operator>=(const SymbolBase& other) const; + + bool operator<=(const SymbolBase& other) const; - virtual bool operator <(const SymbolBase& other) const = 0; - virtual bool operator ==(const SymbolBase& other) const = 0; - virtual bool operator >(const SymbolBase& other) const = 0; bool operator !=(const SymbolBase& other) const; + virtual bool operator==(const SymbolBase& other) const = 0; virtual bool operator==(const LabeledSymbol& other) const; virtual bool operator==(const BlankSymbol& other) const; virtual bool operator==(const BottomOfTheStackSymbol& other) const; virtual bool operator==(const EndSymbol& other) const; + virtual bool operator<(const SymbolBase& other) const = 0; virtual bool operator<(const LabeledSymbol& other) const; virtual bool operator<(const BlankSymbol& other) const; virtual bool operator<(const BottomOfTheStackSymbol& other) const; virtual bool operator<(const EndSymbol& other) const; + virtual bool operator>(const SymbolBase& other) const = 0; friend std::ostream& operator<<(std::ostream&, const SymbolBase&); diff --git a/alib2data/src/label/CharacterLabel.h b/alib2data/src/label/CharacterLabel.h index 9e151ad252195c7efba016f23dcd16a5c26bad1a..82425597fa4755bdb369ff98e7cc0f2ef8ff27cf 100644 --- a/alib2data/src/label/CharacterLabel.h +++ b/alib2data/src/label/CharacterLabel.h @@ -33,7 +33,7 @@ public: explicit CharacterLabel(char label); virtual bool operator<(const LabelBase& other) const; - + virtual bool operator>(const LabelBase& other) const; virtual bool operator==(const LabelBase& other) const; diff --git a/alib2data/src/label/LabelBase.h b/alib2data/src/label/LabelBase.h index 0ffa8f44c89aa971f7c3ab38696eff535dac937a..26b5801e3e5e318fcf608df9f5e78f92687cd6a1 100644 --- a/alib2data/src/label/LabelBase.h +++ b/alib2data/src/label/LabelBase.h @@ -27,25 +27,25 @@ public: virtual LabelBase* plunder() && = 0; virtual ~LabelBase() noexcept; - + virtual bool operator<(const LabelBase& other) const = 0; - + virtual bool operator<(const StringLabel& other) const; - + virtual bool operator<(const IntegerLabel& other) const; - + virtual bool operator<(const CharacterLabel& other) const; - + virtual bool operator>(const LabelBase& other) const = 0; - + bool operator>=(const LabelBase& other) const; bool operator<=(const LabelBase& other) const; bool operator!=(const LabelBase& other) const; - + virtual bool operator==(const LabelBase& other) const = 0; virtual bool operator==(const StringLabel& other) const;