tree-sitter/spec/runtime/helpers/point_helpers.cc
2015-12-02 17:28:52 -05:00

24 lines
626 B
C++

#include <string>
#include <ostream>
#include "runtime/length.h"
using namespace std;
bool operator==(const TSPoint &left, const TSPoint &right) {
return left.row == right.row && left.column == right.column;
}
std::ostream &operator<<(std::ostream &stream, const TSPoint &point) {
return stream << "{" << point.row << ", " << point.column << "}";
}
bool operator<(const TSPoint &left, const TSPoint &right) {
if (left.row < right.row) return true;
if (left.row > right.row) return false;
return left.column < right.column;
}
bool operator>(const TSPoint &left, const TSPoint &right) {
return right < left;
}