Don't store first_leaf field on leaf nodes
This commit is contained in:
parent
637a65fee9
commit
c828ca308f
3 changed files with 39 additions and 17 deletions
|
|
@ -33,10 +33,6 @@ struct Subtree {
|
|||
uint32_t child_count;
|
||||
TSSymbol symbol;
|
||||
TSStateId parse_state;
|
||||
struct {
|
||||
TSSymbol symbol;
|
||||
TSLexMode lex_mode;
|
||||
} first_leaf;
|
||||
|
||||
bool is_small : 1;
|
||||
bool visible : 1;
|
||||
|
|
@ -59,6 +55,10 @@ struct Subtree {
|
|||
uint32_t repeat_depth;
|
||||
int32_t dynamic_precedence;
|
||||
uint16_t alias_sequence_id;
|
||||
struct {
|
||||
TSSymbol symbol;
|
||||
TSStateId parse_state;
|
||||
} first_leaf;
|
||||
};
|
||||
|
||||
// External terminal subtrees (`child_count == 0 && has_external_tokens`)
|
||||
|
|
@ -118,6 +118,10 @@ static inline Length ts_subtree_total_size(const Subtree *self) {
|
|||
return length_add(self->padding, self->size);
|
||||
}
|
||||
|
||||
static inline TSSymbol ts_subtree_leaf_symbol(const Subtree *self) {
|
||||
return self->child_count > 0 ? self->first_leaf.symbol : self->symbol;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue