forked from jasder/antlr
Compare contents in LexerATNConfig::operator==
This commit is contained in:
parent
903fa473c5
commit
739bf3a756
|
@ -89,10 +89,13 @@ size_t LexerATNConfig::hashCode() const {
|
||||||
|
|
||||||
bool LexerATNConfig::operator == (const LexerATNConfig& other) const
|
bool LexerATNConfig::operator == (const LexerATNConfig& other) const
|
||||||
{
|
{
|
||||||
|
if (this == &other)
|
||||||
|
return true;
|
||||||
|
|
||||||
if (_passedThroughNonGreedyDecision != other._passedThroughNonGreedyDecision)
|
if (_passedThroughNonGreedyDecision != other._passedThroughNonGreedyDecision)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (_lexerActionExecutor != other._lexerActionExecutor) {
|
if (_lexerActionExecutor != other._lexerActionExecutor && (_lexerActionExecutor != nullptr && *_lexerActionExecutor != *(other._lexerActionExecutor))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -115,6 +115,10 @@ bool LexerActionExecutor::operator == (const LexerActionExecutor &obj) const {
|
||||||
return _hashCode == obj._hashCode && Arrays::equals(_lexerActions, obj._lexerActions);
|
return _hashCode == obj._hashCode && Arrays::equals(_lexerActions, obj._lexerActions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool LexerActionExecutor::operator != (const LexerActionExecutor &obj) const {
|
||||||
|
return !operator==(obj);
|
||||||
|
}
|
||||||
|
|
||||||
size_t LexerActionExecutor::generateHashCode() const {
|
size_t LexerActionExecutor::generateHashCode() const {
|
||||||
size_t hash = MurmurHash::initialize();
|
size_t hash = MurmurHash::initialize();
|
||||||
for (auto lexerAction : _lexerActions) {
|
for (auto lexerAction : _lexerActions) {
|
||||||
|
|
|
@ -125,6 +125,7 @@ namespace atn {
|
||||||
|
|
||||||
virtual size_t hashCode() const;
|
virtual size_t hashCode() const;
|
||||||
virtual bool operator == (const LexerActionExecutor &obj) const;
|
virtual bool operator == (const LexerActionExecutor &obj) const;
|
||||||
|
virtual bool operator != (const LexerActionExecutor &obj) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const std::vector<Ref<LexerAction>> _lexerActions;
|
const std::vector<Ref<LexerAction>> _lexerActions;
|
||||||
|
|
Loading…
Reference in New Issue