🔥 symbol iterator API

This idea was never fully baked.
This commit is contained in:
Max Brunsfeld 2018-03-08 12:53:28 -08:00
parent 128edbebd6
commit 0810971f3e
3 changed files with 0 additions and 54 deletions

View file

@ -263,26 +263,6 @@ TSSymbol ts_node_symbol(TSNode self) {
return tree->context.alias_symbol ? tree->context.alias_symbol : tree->symbol;
}
TSSymbolIterator ts_node_symbols(TSNode self) {
const Tree *tree = ts_node__tree(self);
return (TSSymbolIterator){
.value = tree->symbol, .done = false, .data = (void *)tree,
};
}
void ts_symbol_iterator_next(TSSymbolIterator *self) {
const Tree *tree = (const Tree *)self->data;
const Tree *parent = tree->context.parent;
if (!self->done && parent) {
if (parent->child_count == 1 && !parent->visible) {
self->value = parent->symbol;
self->data = (void *)parent;
return;
}
}
self->done = true;
}
const char *ts_node_type(TSNode self, const TSDocument *document) {
return ts_language_symbol_name(document->parser.language, ts_node_symbol(self));
}