Rename RENAME rule to ALIAS, allow it to create anonymous nodes

This commit is contained in:
Max Brunsfeld 2017-07-31 11:45:24 -07:00
parent b5f421cafb
commit cb5fe80348
28 changed files with 304 additions and 270 deletions

View file

@ -33,7 +33,7 @@ static inline uint32_t ts_node__offset_row(TSNode self) {
static inline bool ts_node__is_relevant(TSNode self, bool include_anonymous) {
const Tree *tree = ts_node__tree(self);
if (tree->context.rename_symbol > 0) {
if (tree->context.alias_symbol > 0) {
return true;
} else {
return include_anonymous ? tree->visible : tree->visible && tree->named;
@ -269,7 +269,7 @@ TSPoint ts_node_end_point(TSNode self) {
TSSymbol ts_node_symbol(TSNode self) {
const Tree *tree = ts_node__tree(self);
return tree->context.rename_symbol ? tree->context.rename_symbol : tree->symbol;
return tree->context.alias_symbol ? tree->context.alias_symbol : tree->symbol;
}
TSSymbolIterator ts_node_symbols(TSNode self) {
@ -308,7 +308,7 @@ bool ts_node_eq(TSNode self, TSNode other) {
bool ts_node_is_named(TSNode self) {
const Tree *tree = ts_node__tree(self);
return tree->named || tree->context.rename_symbol != 0;
return tree->context.alias_symbol ? tree->context.alias_is_named : tree->named;
}
bool ts_node_has_changes(TSNode self) {