mirror of
https://github.com/jezhiggins/arabica
synced 2025-01-18 22:26:32 +01:00
added operator<< back in for debugging
This commit is contained in:
parent
cd97e2aa58
commit
0a2220dbb0
1 changed files with 11 additions and 1 deletions
|
@ -84,6 +84,7 @@ private:
|
||||||
int children_;
|
int children_;
|
||||||
|
|
||||||
friend bool operator<(const Precedence& lhs, const Precedence& rhs);
|
friend bool operator<(const Precedence& lhs, const Precedence& rhs);
|
||||||
|
friend std::ostream& operator<<(std::ostream& os, const Precedence& prec);
|
||||||
}; // class Precedence
|
}; // class Precedence
|
||||||
|
|
||||||
bool operator<(const Precedence& lhs, const Precedence& rhs)
|
bool operator<(const Precedence& lhs, const Precedence& rhs)
|
||||||
|
@ -92,7 +93,7 @@ bool operator<(const Precedence& lhs, const Precedence& rhs)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
int len = std::min(lhs.precedence_.size(), rhs.precedence_.size());
|
int len = std::min(lhs.precedence_.size(), rhs.precedence_.size());
|
||||||
for(int c = 0; c < len; ++c)
|
for(int c = 0; c != len; ++c)
|
||||||
{
|
{
|
||||||
if(lhs.precedence_[c] < rhs.precedence_[c])
|
if(lhs.precedence_[c] < rhs.precedence_[c])
|
||||||
return true;
|
return true;
|
||||||
|
@ -110,4 +111,13 @@ bool operator>(const Precedence& lhs, const Precedence& rhs)
|
||||||
return !(lhs == rhs) && !(lhs < rhs);
|
return !(lhs == rhs) && !(lhs < rhs);
|
||||||
} // operator>
|
} // operator>
|
||||||
|
|
||||||
|
std::ostream& operator<<(std::ostream& os, const Precedence& prec)
|
||||||
|
{
|
||||||
|
os << '(' << prec.precedence_[0];
|
||||||
|
for(int i = 1; i != prec.precedence_.size(); ++i)
|
||||||
|
os << ',' << prec.precedence_[i];
|
||||||
|
os << ')';
|
||||||
|
return os;
|
||||||
|
} // operator<<
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue