Don't use preprocesser for special tree state values
This commit is contained in:
parent
da1bc038e5
commit
7f1c5f7568
3 changed files with 12 additions and 8 deletions
|
|
@ -1,4 +1,5 @@
|
|||
#include <assert.h>
|
||||
#include <limits.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
|
|
@ -6,6 +7,9 @@
|
|||
#include "runtime/tree.h"
|
||||
#include "runtime/length.h"
|
||||
|
||||
TSStateId TS_TREE_STATE_INDEPENDENT = USHRT_MAX;
|
||||
TSStateId TS_TREE_STATE_ERROR = USHRT_MAX - 1;
|
||||
|
||||
TSTree *ts_tree_make_leaf(TSSymbol sym, TSLength padding, TSLength size,
|
||||
TSSymbolMetadata metadata) {
|
||||
TSTree *result = malloc(sizeof(TSTree));
|
||||
|
|
@ -20,8 +24,8 @@ TSTree *ts_tree_make_leaf(TSSymbol sym, TSLength padding, TSLength size,
|
|||
.padding = padding,
|
||||
.visible = metadata.visible,
|
||||
.named = metadata.named,
|
||||
.lex_state = TSTREE_STATE_INDEPENDENT,
|
||||
.parse_state = TSTREE_STATE_INDEPENDENT,
|
||||
.lex_state = TS_TREE_STATE_INDEPENDENT,
|
||||
.parse_state = TS_TREE_STATE_INDEPENDENT,
|
||||
};
|
||||
|
||||
if (sym == ts_builtin_sym_error) {
|
||||
|
|
@ -88,7 +92,7 @@ void ts_tree_set_children(TSTree *self, size_t child_count, TSTree **children) {
|
|||
|
||||
if (child->symbol == ts_builtin_sym_error) {
|
||||
self->fragile_left = self->fragile_right = true;
|
||||
self->parse_state = TSTREE_STATE_ERROR;
|
||||
self->parse_state = TS_TREE_STATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue