mirror of
https://github.com/jezhiggins/arabica
synced 2025-01-17 18:12:04 +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_;
|
||||
|
||||
friend bool operator<(const Precedence& lhs, const Precedence& rhs);
|
||||
friend std::ostream& operator<<(std::ostream& os, const Precedence& prec);
|
||||
}; // class Precedence
|
||||
|
||||
bool operator<(const Precedence& lhs, const Precedence& rhs)
|
||||
|
@ -92,7 +93,7 @@ bool operator<(const Precedence& lhs, const Precedence& rhs)
|
|||
return false;
|
||||
|
||||
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])
|
||||
return true;
|
||||
|
@ -110,4 +111,13 @@ bool operator>(const Precedence& lhs, const Precedence& rhs)
|
|||
return !(lhs == rhs) && !(lhs < rhs);
|
||||
} // 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
|
||||
|
|
Loading…
Reference in a new issue