clang-format
This commit is contained in:
parent
13d8de3eb3
commit
a8f50986e0
4 changed files with 12 additions and 10 deletions
|
|
@ -8,8 +8,7 @@ namespace tree_sitter {
|
|||
namespace build_tables {
|
||||
|
||||
template <typename StateType, typename ActionType, int advance_action>
|
||||
std::map<size_t, size_t> remove_duplicate_states(
|
||||
std::vector<StateType> *states) {
|
||||
std::map<size_t, size_t> remove_duplicate_states(std::vector<StateType> *states) {
|
||||
std::map<size_t, size_t> replacements;
|
||||
|
||||
while (true) {
|
||||
|
|
|
|||
|
|
@ -185,7 +185,8 @@ static TSTree *ts_parser__get_next_lookahead(TSParser *self, int head) {
|
|||
}
|
||||
|
||||
if (!ts_parser__can_reuse(self, head, state->reusable_subtree)) {
|
||||
LOG("breakdown_unreusable sym:%s", SYM_NAME(state->reusable_subtree->symbol));
|
||||
LOG("breakdown_unreusable sym:%s",
|
||||
SYM_NAME(state->reusable_subtree->symbol));
|
||||
ts_parser__breakdown_reusable_subtree(state);
|
||||
continue;
|
||||
}
|
||||
|
|
@ -511,9 +512,9 @@ static void ts_parser__accept(TSParser *self, int head) {
|
|||
TSTree *root = pop_result->trees[i];
|
||||
size_t leading_extra_count = i;
|
||||
size_t trailing_extra_count = pop_result->tree_count - 1 - i;
|
||||
TSTree **new_children =
|
||||
malloc((root->child_count + leading_extra_count + trailing_extra_count) *
|
||||
sizeof(TSTree *));
|
||||
TSTree **new_children = malloc(
|
||||
(root->child_count + leading_extra_count + trailing_extra_count) *
|
||||
sizeof(TSTree *));
|
||||
memcpy(new_children, pop_result->trees,
|
||||
leading_extra_count * sizeof(TSTree *));
|
||||
memcpy(new_children + leading_extra_count, root->children,
|
||||
|
|
@ -526,7 +527,8 @@ static void ts_parser__accept(TSParser *self, int head) {
|
|||
ts_tree_set_children(root, new_count, new_children);
|
||||
ts_tree_retain(root);
|
||||
ts_parser__remove_head(self, pop_result->head_index);
|
||||
self->finished_tree = ts_parser__select_tree(self, self->finished_tree, root);
|
||||
self->finished_tree =
|
||||
ts_parser__select_tree(self, self->finished_tree, root);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -220,8 +220,8 @@ static size_t ts_tree__write_to_string(const TSTree *self,
|
|||
|
||||
char *cursor = string;
|
||||
char **writer = (limit > 0) ? &cursor : &string;
|
||||
bool visible = is_root || (self->visible &&
|
||||
(include_anonymous || self->named));
|
||||
bool visible =
|
||||
is_root || (self->visible && (include_anonymous || self->named));
|
||||
|
||||
if (visible && !is_root)
|
||||
cursor += snprintf(*writer, limit, " ");
|
||||
|
|
|
|||
|
|
@ -68,7 +68,8 @@ static inline TSLength ts_tree_total_size(const TSTree *self) {
|
|||
}
|
||||
|
||||
static inline bool ts_tree_is_fragile(const TSTree *tree) {
|
||||
return tree->fragile_left || tree->fragile_right || ts_tree_total_chars(tree) == 0;
|
||||
return tree->fragile_left || tree->fragile_right ||
|
||||
ts_tree_total_chars(tree) == 0;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue