Rename node accessor methods
Instead of child() vs concrete_child(), next_sibling() vs next_concrete_sibling(), etc, the default is switched: child() refers to the concrete syntax tree, and named_child() refers to the AST. Because the AST is abstract through exclusion of some nodes, the names are clearer if the qualifier goes on the AST operations
This commit is contained in:
parent
245daffbc4
commit
7ee5eaa16a
16 changed files with 475 additions and 476 deletions
|
|
@ -31,7 +31,7 @@ TSTree *ts_tree_make_leaf(TSSymbol sym, TSLength size, TSLength padding,
|
|||
|
||||
TSTree *ts_tree_make_error(TSLength size, TSLength padding, char lookahead_char) {
|
||||
TSTree *result =
|
||||
ts_tree_make_leaf(ts_builtin_sym_error, size, padding, TSNodeTypeNormal);
|
||||
ts_tree_make_leaf(ts_builtin_sym_error, size, padding, TSNodeTypeNamed);
|
||||
result->lookahead_char = lookahead_char;
|
||||
return result;
|
||||
}
|
||||
|
|
@ -56,11 +56,11 @@ static void ts_tree__set_children(TSTree *this, TSTree **children,
|
|||
}
|
||||
|
||||
switch (child->options.type) {
|
||||
case TSNodeTypeNormal:
|
||||
case TSNodeTypeNamed:
|
||||
this->visible_child_count++;
|
||||
this->named_child_count++;
|
||||
break;
|
||||
case TSNodeTypeConcrete:
|
||||
case TSNodeTypeAnonymous:
|
||||
this->visible_child_count++;
|
||||
break;
|
||||
case TSNodeTypeHidden:
|
||||
|
|
@ -149,7 +149,7 @@ static size_t ts_tree__write_to_string(const TSTree *tree,
|
|||
|
||||
char *cursor = string;
|
||||
char **writer = (limit > 0) ? &cursor : &string;
|
||||
int visible = tree->options.type == TSNodeTypeNormal || is_root;
|
||||
int visible = tree->options.type == TSNodeTypeNamed || is_root;
|
||||
|
||||
if (visible && !is_root)
|
||||
cursor += snprintf(*writer, limit, " ");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue