Fix bugs in handling multiple simultaneous ambiguities
This commit is contained in:
parent
0955f660d0
commit
500533476b
5 changed files with 3377 additions and 2852 deletions
|
|
@ -22,7 +22,7 @@ static const char *empty_chunk = "";
|
|||
|
||||
static void ts_lexer__get_chunk(TSLexer *self) {
|
||||
TSInput input = self->input;
|
||||
if (self->current_position.bytes != self->chunk_start + self->chunk_size)
|
||||
if (!self->chunk || self->current_position.bytes != self->chunk_start + self->chunk_size)
|
||||
input.seek_fn(input.payload, self->current_position);
|
||||
|
||||
self->chunk_start = self->current_position.bytes;
|
||||
|
|
@ -113,6 +113,7 @@ void ts_lexer_reset(TSLexer *self, TSLength position) {
|
|||
self->token_end_position = position;
|
||||
self->current_position = position;
|
||||
self->chunk = 0;
|
||||
self->chunk_start = 0;
|
||||
self->chunk_size = 0;
|
||||
self->lookahead_size = 0;
|
||||
self->lookahead = 0;
|
||||
|
|
|
|||
|
|
@ -168,9 +168,8 @@ static int ts_stack__find_or_add_head(Stack *self, StackNode *node) {
|
|||
|
||||
void ts_stack_remove_head(Stack *self, int head_index) {
|
||||
stack_node_release(self->heads[head_index]);
|
||||
for (int i = head_index; i < self->head_count - 1; i++) {
|
||||
self->heads[head_index] = self->heads[head_index + 1];
|
||||
}
|
||||
for (int i = head_index; i < self->head_count - 1; i++)
|
||||
self->heads[i] = self->heads[i + 1];
|
||||
self->head_count--;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue