Implement ts_document_parse_and_get_changed_ranges

This commit is contained in:
Max Brunsfeld 2016-09-22 18:02:11 -07:00
parent 3014101104
commit b3140b2689
9 changed files with 274 additions and 141 deletions

View file

@ -18,6 +18,18 @@ static inline TSPoint ts_point_sub(TSPoint a, TSPoint b) {
return (TSPoint){0, a.column - b.column};
}
static inline bool ts_point_lte(TSPoint a, TSPoint b) {
return (a.row < b.row) || (a.row == b.row && a.column <= b.column);
}
static inline bool ts_point_lt(TSPoint a, TSPoint b) {
return (a.row < b.row) || (a.row == b.row && a.column < b.column);
}
static inline bool ts_point_eq(TSPoint a, TSPoint b) {
return a.row == b.row && a.column == b.column;
}
static inline TSPoint ts_point_min(TSPoint a, TSPoint b) {
if (a.row < b.row || (a.row == b.row && a.column < b.column))
return a;
@ -25,6 +37,13 @@ static inline TSPoint ts_point_min(TSPoint a, TSPoint b) {
return b;
}
static inline TSPoint ts_point_max(TSPoint a, TSPoint b) {
if (a.row > b.row || (a.row == b.row && a.column > b.column))
return a;
else
return b;
}
static inline bool ts_length_is_unknown(TSLength self) {
return self.bytes > 0 && self.chars == 0;
}