Remove the TS prefix from some internal type/function names

This commit is contained in:
Max Brunsfeld 2016-11-09 20:59:05 -08:00
parent 255bc2427c
commit c9dcb29c6f
21 changed files with 313 additions and 313 deletions

View file

@ -9,13 +9,13 @@ typedef Array(TSRange) RangeArray;
static void range_array_add(RangeArray *results, TSPoint start, TSPoint end) {
if (results->size > 0) {
TSRange *last_range = array_back(results);
if (ts_point_lte(start, last_range->end)) {
if (point_lte(start, last_range->end)) {
last_range->end = end;
return;
}
}
if (ts_point_lt(start, end)) {
if (point_lt(start, end)) {
TSRange range = { start, end };
array_push(results, range);
}
@ -27,12 +27,12 @@ static bool tree_path_descend(TreePath *path, TSPoint position) {
do {
did_descend = false;
TreePathEntry entry = *array_back(path);
TSLength child_position = entry.position;
Length child_position = entry.position;
for (size_t i = 0; i < entry.tree->child_count; i++) {
TSTree *child = entry.tree->children[i];
TSLength child_right_position =
ts_length_add(child_position, ts_tree_total_size(child));
if (ts_point_lt(position, child_right_position.extent)) {
Tree *child = entry.tree->children[i];
Length child_right_position =
length_add(child_position, ts_tree_total_size(child));
if (point_lt(position, child_right_position.extent)) {
TreePathEntry child_entry = { child, child_position, i };
if (child->visible) {
array_push(path, child_entry);
@ -58,10 +58,10 @@ static size_t tree_path_advance(TreePath *path) {
break;
TreePathEntry parent_entry = *array_back(path);
if (parent_entry.tree->visible) ascend_count++;
TSLength position =
ts_length_add(entry.position, ts_tree_total_size(entry.tree));
Length position =
length_add(entry.position, ts_tree_total_size(entry.tree));
for (size_t i = entry.child_index + 1; i < parent_entry.tree->child_count; i++) {
TSTree *next_child = parent_entry.tree->children[i];
Tree *next_child = parent_entry.tree->children[i];
if (next_child->visible || next_child->visible_child_count > 0) {
if (parent_entry.tree->visible) ascend_count--;
array_push(path, ((TreePathEntry){
@ -73,7 +73,7 @@ static size_t tree_path_advance(TreePath *path) {
tree_path_descend(path, (TSPoint){ 0, 0 });
return ascend_count;
}
position = ts_length_add(position, ts_tree_total_size(next_child));
position = length_add(position, ts_tree_total_size(next_child));
}
}
return ascend_count;
@ -87,7 +87,7 @@ static void tree_path_ascend(TreePath *path, size_t count) {
}
}
static void tree_path_init(TreePath *path, TSTree *tree) {
static void tree_path_init(TreePath *path, Tree *tree) {
array_clear(path);
array_push(path, ((TreePathEntry){
.tree = tree,
@ -98,7 +98,7 @@ static void tree_path_init(TreePath *path, TSTree *tree) {
tree_path_descend(path, (TSPoint){ 0, 0 });
}
static bool tree_must_eq(TSTree *old_tree, TSTree *new_tree) {
static bool tree_must_eq(Tree *old_tree, Tree *new_tree) {
return old_tree == new_tree || (
!old_tree->has_changes &&
old_tree->symbol == new_tree->symbol &&
@ -121,32 +121,32 @@ static void tree_path_get_changes(TreePath *old_path, TreePath *new_path,
TreePathEntry old_entry = *array_back(old_path);
TreePathEntry new_entry = *array_back(new_path);
TSTree *old_tree = old_entry.tree;
TSTree *new_tree = new_entry.tree;
Tree *old_tree = old_entry.tree;
Tree *new_tree = new_entry.tree;
size_t old_start_byte = old_entry.position.bytes + old_tree->padding.bytes;
size_t new_start_byte = new_entry.position.bytes + new_tree->padding.bytes;
TSPoint old_start_point =
ts_point_add(old_entry.position.extent, old_tree->padding.extent);
point_add(old_entry.position.extent, old_tree->padding.extent);
TSPoint new_start_point =
ts_point_add(new_entry.position.extent, new_tree->padding.extent);
TSPoint old_end_point = ts_point_add(old_start_point, old_tree->size.extent);
TSPoint new_end_point = ts_point_add(new_start_point, new_tree->size.extent);
point_add(new_entry.position.extent, new_tree->padding.extent);
TSPoint old_end_point = point_add(old_start_point, old_tree->size.extent);
TSPoint new_end_point = point_add(new_start_point, new_tree->size.extent);
// #define NAME(t) (ts_language_symbol_name(language, ((TSTree *)(t))->symbol))
// #define NAME(t) (ts_language_symbol_name(language, ((Tree *)(t))->symbol))
// printf("At [%-2lu, %-2lu] Compare (%-20s\t [%-2lu, %-2lu] - [%lu, %lu])\tvs\t(%-20s\t [%lu, %lu] - [%lu, %lu])\n",
// position.row, position.column, NAME(old_tree), old_start_point.row,
// old_start_point.column, old_end_point.row, old_end_point.column,
// NAME(new_tree), new_start_point.row, new_start_point.column,
// new_end_point.row, new_end_point.column);
if (ts_point_lt(position, old_start_point)) {
if (ts_point_lt(position, new_start_point)) {
next_position = ts_point_min(old_start_point, new_start_point);
if (point_lt(position, old_start_point)) {
if (point_lt(position, new_start_point)) {
next_position = point_min(old_start_point, new_start_point);
} else {
is_changed = true;
next_position = old_start_point;
}
} else if (ts_point_lt(position, new_start_point)) {
} else if (point_lt(position, new_start_point)) {
is_changed = true;
next_position = new_start_point;
} else if (old_start_byte == new_start_byte &&
@ -164,15 +164,15 @@ static void tree_path_get_changes(TreePath *old_path, TreePath *new_path,
is_changed = true;
next_position = old_end_point;
} else {
next_position = ts_point_min(old_end_point, new_end_point);
next_position = point_min(old_end_point, new_end_point);
}
} else {
is_changed = true;
next_position = ts_point_min(old_end_point, new_end_point);
next_position = point_min(old_end_point, new_end_point);
}
bool at_old_end = ts_point_lte(old_end_point, next_position);
bool at_new_end = ts_point_lte(new_end_point, next_position);
bool at_old_end = point_lte(old_end_point, next_position);
bool at_new_end = point_lte(new_end_point, next_position);
if (at_new_end && at_old_end) {
size_t old_ascend_count = tree_path_advance(old_path);