1 #include "runtime/parser.h"
6 #include "tree_sitter/runtime.h"
7 #include "runtime/tree.h"
8 #include "runtime/lexer.h"
9 #include "runtime/length.h"
10 #include "runtime/array.h"
11 #include "runtime/language.h"
12 #include "runtime/alloc.h"
13 #include "runtime/reduce_action.h"
14 #include "runtime/error_costs.h"
17 if (self->lexer.logger.log) { \
18 snprintf(self->lexer.debug_buffer, TS_DEBUG_BUFFER_SIZE, __VA_ARGS__); \
19 self->lexer.logger.log(self->lexer.logger.payload, TSLogTypeParse, \
20 self->lexer.debug_buffer); \
22 if (self->print_debugging_graphs) { \
23 fprintf(stderr, "graph {\nlabel=\""); \
24 fprintf(stderr, __VA_ARGS__); \
25 fprintf(stderr, "\"\n}\n\n"); \
29 if (self->print_debugging_graphs) { \
30 ts_stack_print_dot_graph(self->stack, self->language->symbol_names, \
32 fputs("\n\n", stderr); \
36 if (self->print_debugging_graphs) { \
37 ts_tree_print_dot_graph(self->finished_tree, self->language, stderr); \
38 fputs("\n", stderr); \
41 #define SYM_NAME(symbol) ts_language_symbol_name(self->language, symbol)
62 ts_tree_release(tree);
66 bool did_break_down =
false;
74 did_break_down =
true;
81 for (
uint32_t j = 0; j < parent->child_count; j++) {
82 Tree *child = parent->children[j];
83 pending = child->child_count > 0;
87 }
else if (!child->extra) {
94 for (
uint32_t j = 1; j < slice.trees.size; j++) {
95 Tree *tree = slice.trees.contents[j];
99 LOG(
"breakdown_top_of_stack tree:%s",
SYM_NAME(parent->symbol));
102 ts_stack_decrease_push_count(self->stack, slice.
version,
103 parent->child_count + 1);
104 ts_tree_release(parent);
109 return did_break_down;
116 while (reusable_node->tree->child_count > 0 &&
117 (self->is_split || reusable_node->tree->parse_state !=
state ||
118 reusable_node->tree->fragile_left ||
119 reusable_node->tree->fragile_right)) {
120 LOG(
"state_mismatch sym:%s",
SYM_NAME(reusable_node->tree->symbol));
121 reusable_node_breakdown(reusable_node);
126 ts_tree_release(*lookahead);
127 ts_tree_retain(*lookahead = reusable_node->tree);
134 return self.lex_state == other.
lex_state &&
145 if (tree->size.bytes == 0)
149 if (!table_entry->depends_on_lookahead)
151 return tree->child_count > 1 && tree->error_cost == 0;
160 bool has_version_without_errors =
false;
170 ErrorStatus error_status = ts_stack_error_status(self->stack,
i);
171 if (error_status.count == 0) has_version_without_errors =
true;
180 switch (error_status_compare(error_status,
181 ts_stack_error_status(self->stack, j))) {
205 const TSExternalTokenState *
state = ts_stack_external_token_state(self->stack,
version);
206 if (self->lexer.last_external_token_state !=
state) {
207 LOG(
"restore_external_scanner");
208 self->lexer.last_external_token_state =
state;
210 self->language->external_scanner.deserialize(
211 self->external_scanner_payload,
215 self->language->external_scanner.reset(self->external_scanner_payload);
222 Length start_position = ts_stack_top_position(self->stack,
version);
223 TSLexMode lex_mode =
self->language->lex_modes[parse_state];
229 bool found_external_token =
false;
230 bool found_error =
false;
231 bool skipped_error =
false;
232 int32_t first_error_character = 0;
233 Length error_start_position, error_end_position;
237 Length current_position =
self->lexer.current_position;
239 if (valid_external_tokens) {
244 if (self->language->external_scanner.scan(self->external_scanner_payload,
245 &self->lexer.data, valid_external_tokens)) {
246 if (length_has_unknown_chars(self->lexer.token_end_position)) {
247 self->lexer.token_end_position =
self->lexer.current_position;
250 self->lexer.token_end_position.bytes > current_position.
bytes) {
251 found_external_token =
true;
258 LOG(
"lex_internal state:%d, row:%u, column:%u", lex_mode.
lex_state,
261 if (self->language->lex_fn(&self->lexer.data, lex_mode.
lex_state)) {
262 if (length_has_unknown_chars(self->lexer.token_end_position)) {
263 self->lexer.token_end_position =
self->lexer.current_position;
269 LOG(
"retry_in_error_mode");
280 if (!skipped_error) {
281 LOG(
"skip_unrecognized_character");
282 skipped_error =
true;
283 error_start_position =
self->lexer.token_start_position;
284 error_end_position =
self->lexer.token_start_position;
285 first_error_character =
self->lexer.data.lookahead;
288 if (self->lexer.current_position.bytes == error_end_position.
bytes) {
289 if (self->lexer.data.lookahead == 0) {
293 self->lexer.data.advance(&self->lexer,
false);
296 error_end_position =
self->lexer.current_position;
303 result = ts_tree_make_error(
size, padding, first_error_character);
305 TSSymbol symbol =
self->lexer.data.result_symbol;
306 if (found_external_token) {
307 symbol =
self->language->external_scanner.symbol_map[symbol];
310 Length padding =
length_sub(self->lexer.token_start_position, start_position);
313 result = ts_tree_make_leaf(symbol, padding,
size, metadata);
315 if (found_external_token) {
316 result->has_external_tokens =
true;
317 result->has_external_token_state =
true;
318 memset(result->external_token_state, 0,
sizeof(TSExternalTokenState));
319 self->language->external_scanner.serialize(self->external_scanner_payload, result->external_token_state);
320 self->lexer.last_external_token_state = &result->external_token_state;
324 result->bytes_scanned =
self->lexer.current_position.bytes - start_position.
bytes + 1;
325 result->parse_state = parse_state;
326 result->first_leaf.lex_mode = lex_mode;
328 LOG(
"lexed_lookahead sym:%s, size:%u",
SYM_NAME(result->symbol), result->size.bytes);
333 ts_tree_release(self->cached_token);
334 self->cached_token =
NULL;
340 Length position = ts_stack_top_position(self->stack,
version);
342 while (reusable_node->tree) {
343 if (reusable_node->byte_index > position.
bytes) {
344 LOG(
"before_reusable_node sym:%s",
SYM_NAME(reusable_node->tree->symbol));
348 if (reusable_node->byte_index < position.
bytes) {
349 LOG(
"past_reusable sym:%s",
SYM_NAME(reusable_node->tree->symbol));
350 reusable_node_pop(reusable_node);
354 if (reusable_node->tree->has_changes) {
355 LOG(
"cant_reuse_changed tree:%s, size:%u",
356 SYM_NAME(reusable_node->tree->symbol),
357 reusable_node->tree->size.bytes);
358 if (!reusable_node_breakdown(reusable_node)) {
359 reusable_node_pop(reusable_node);
366 LOG(
"cant_reuse_error tree:%s, size:%u",
367 SYM_NAME(reusable_node->tree->symbol),
368 reusable_node->tree->size.bytes);
369 if (!reusable_node_breakdown(reusable_node)) {
370 reusable_node_pop(reusable_node);
376 if (!ts_external_token_state_eq(
377 reusable_node->preceding_external_token_state,
378 ts_stack_external_token_state(self->stack,
version))) {
379 LOG(
"cant_reuse_external_tokens tree:%s, size:%u",
380 SYM_NAME(reusable_node->tree->symbol),
381 reusable_node->tree->size.bytes);
382 if (!reusable_node_breakdown(reusable_node)) {
383 reusable_node_pop(reusable_node);
389 Tree *result = reusable_node->tree;
390 ts_tree_retain(result);
394 if (self->cached_token && position.
bytes == self->cached_token_byte_index) {
395 ts_tree_retain(self->cached_token);
396 return self->cached_token;
408 if (right->error_cost < left->error_cost) {
409 LOG(
"select_smaller_error symbol:%s, over_symbol:%s",
413 if (left->error_cost < right->error_cost) {
414 LOG(
"select_smaller_error symbol:%s, over_symbol:%s",
419 int comparison = ts_tree_compare(left, right);
420 switch (comparison) {
422 LOG(
"select_earlier symbol:%s, over_symbol:%s",
SYM_NAME(left->symbol),
427 LOG(
"select_earlier symbol:%s, over_symbol:%s",
SYM_NAME(right->symbol),
431 LOG(
"select_existing symbol:%s, over_symbol:%s",
SYM_NAME(left->symbol),
439 if (self->finished_tree &&
440 self->finished_tree->error_cost <= my_error_status.
cost)
447 switch (error_status_compare(my_error_status,
448 ts_stack_error_status(self->stack,
i))) {
450 LOG(
"halt_other version:%u",
i);
462 Tree *lookahead,
bool extra) {
463 if (extra != lookahead->extra) {
467 lookahead = ts_tree_make_copy(lookahead);
469 ts_tree_retain(lookahead);
471 lookahead->extra = extra;
473 ts_tree_retain(lookahead);
476 bool is_pending = lookahead->child_count > 0;
478 if (lookahead->has_external_token_state) {
479 ts_stack_set_external_token_state(
480 self->stack,
version, ts_tree_last_external_token_state(lookahead));
482 ts_tree_release(lookahead);
487 self->scratch_tree.symbol = tree->symbol;
488 self->scratch_tree.child_count = 0;
489 ts_tree_set_children(&self->scratch_tree,
count, children);
491 tree->size =
self->scratch_tree.size;
492 tree->padding =
self->scratch_tree.padding;
493 tree->error_cost =
self->scratch_tree.error_cost;
494 tree->children =
self->scratch_tree.children;
495 tree->child_count =
self->scratch_tree.child_count;
496 tree->named_child_count =
self->scratch_tree.named_child_count;
497 tree->visible_child_count =
self->scratch_tree.visible_child_count;
506 bool fragile,
bool allow_skipping) {
510 if (pop.stopped_at_error)
522 uint32_t child_count = slice.trees.size;
523 while (child_count > 0 && slice.trees.contents[child_count - 1]->extra)
526 Tree *parent = ts_tree_make_node(symbol, child_count, slice.trees.contents, metadata);
532 while (
i + 1 < pop.slices.size) {
533 StackSlice next_slice = pop.slices.contents[
i + 1];
538 uint32_t child_count = next_slice.trees.size;
539 while (child_count > 0 && next_slice.trees.contents[child_count - 1]->extra)
543 ts_tree_array_delete(&slice.trees);
546 ts_tree_array_delete(&next_slice.trees);
552 if (fragile || self->is_split || pop.slices.size > 1 || initial_version_count > 1) {
553 parent->fragile_left =
true;
554 parent->fragile_right =
true;
557 parent->parse_state =
state;
567 for (
uint32_t j = parent->child_count; j < slice.trees.size; j++) {
568 Tree *tree = slice.trees.contents[j];
572 ErrorStatus error_status = ts_stack_error_status(self->stack, other_version);
580 for (
uint32_t j = parent->child_count; j < slice.trees.size; j++) {
581 Tree *tree = slice.trees.contents[j];
600 uint32_t tree_count_below,
const TreeArray *trees_above,
607 if (child_count == tree_count_below)
609 Tree *tree = trees_below->contents[trees_below->size - 1 -
i];
610 if (tree->extra)
continue;
614 if (next_state !=
state) {
621 Tree *tree = trees_above->contents[
i];
622 if (tree->extra)
continue;
626 if (next_state !=
state) {
653 bool is_done,
bool is_pending) {
656 Parser *
self = session->
parser;
658 ReduceActionSet *repairs = &
self->reduce_actions;
662 StackIterateAction result = StackIterateNone;
665 uint32_t repair_reduction_count = -1;
670 uint32_t count_needed_below_error = repair->
count - tree_count_above_error;
671 if (count_needed_below_error > tree_count)
674 uint32_t skip_count = tree_count - count_needed_below_error;
686 if (action_count == 0)
689 if (count_needed_below_error != last_repair_count) {
690 last_repair_count = count_needed_below_error;
692 self,
state, trees, count_needed_below_error, trees_above_error,
693 lookahead_symbol, &repair_reduction_count);
696 for (
uint32_t j = 0; j < repair_reduction_count; j++) {
697 if (repair_reductions[j].params.
symbol == repair->
symbol) {
698 result |= StackIteratePop;
709 if (repairs->size == 0)
710 result |= StackIterateStop;
720 .lookahead_symbol = lookahead_symbol,
721 .found_repair =
false,
722 .trees_above_error = &slice.trees,
723 .tree_count_above_error = ts_tree_array_essential_count(&slice.trees),
741 StackPopResult pop = ts_stack_iterate(
745 LOG(
"no_repair_found");
747 ts_tree_array_delete(&slice.trees);
757 TreeArray children = new_slice.trees;
760 for (
uint32_t i = pop.slices.size - 1;
i + 1 > 0;
i--) {
762 ts_tree_array_delete(&other_slice.trees);
763 if (other_slice.
version != pop.slices.contents[
i + 1].version)
767 TreeArray skipped_children = ts_tree_array_remove_last_n(&children, skip_count);
768 TreeArray trailing_extras = ts_tree_array_remove_trailing_extras(&skipped_children);
769 Tree *
error = ts_tree_make_error_node(&skipped_children);
772 trailing_extras.size = 0;
780 ts_tree_make_node(symbol, children.size, children.contents,
783 ts_stack_decrease_push_count(self->stack, slice.
version,
error->child_count);
787 LOG(
"no_better_repair_found");
791 LOG(
"repair_found sym:%s, child_count:%u, cost:%u",
SYM_NAME(symbol),
792 repair.
count, parent->error_cost);
799 LOG(
"parse_after_edit");
804 if (self->language->external_scanner.reset) {
805 self->language->external_scanner.reset(self->external_scanner_payload);
811 self->cached_token =
NULL;
812 self->finished_tree =
NULL;
817 lookahead->extra =
true;
824 TreeArray trees = slice.trees;
827 if (trees.size == 1) {
828 root = trees.contents[0];
831 for (
uint32_t j = trees.size - 1; j + 1 > 0; j--) {
832 Tree *child = trees.contents[j];
834 root = ts_tree_make_copy(child);
835 root->child_count = 0;
837 ts_tree_retain(child->children[
k]);
838 array_splice(&trees, j, 1, child->child_count, child->children);
839 ts_tree_set_children(
root, trees.size, trees.contents);
840 ts_tree_release(child);
847 ts_tree_release(self->finished_tree);
849 self->finished_tree =
root;
851 ts_tree_release(
root);
860 bool has_shift_action =
false;
865 for (
TSSymbol symbol = 0; symbol <
self->language->token_count; symbol++) {
875 has_shift_action =
true;
878 if (
action.params.child_count > 0)
880 .symbol = action.params.symbol,
881 .count = action.params.child_count,
889 bool did_reduce =
false;
890 for (
uint32_t i = 0;
i <
self->reduce_actions.size;
i++) {
892 StackPopResult reduction =
894 if (reduction.stopped_at_error) {
895 ts_tree_array_delete(&reduction.slices.contents[0].trees);
904 if (has_shift_action) {
917 bool is_done,
bool is_pending) {
921 bytes_skipped += ts_tree_total_bytes(trees->contents[
i]);
923 if (bytes_skipped == 0)
return StackIterateNone;
925 Parser *
self = session->
parser;
931 return StackIteratePop | StackIterateStop;
934 return StackIterateNone;
940 StackPopResult pop = ts_stack_iterate(
946 if (slice.
version == previous_version) {
947 ts_tree_array_delete(&slice.trees);
951 previous_version = slice.
version;
952 Tree *
error = ts_tree_make_error_node(&slice.trees);
958 return pop.slices.size > 0;
966 error_status.count++;
969 LOG(
"bail_on_error");
979 LOG(
"skip_preceding_trees");
989 v = previous_version_count;
1006 LOG(
"halting_parse");
1011 self->lexer.current_position,
1012 ts_stack_top_position(self->stack, 0)
1015 Tree *filler_node = ts_tree_make_error(remaining_length,
length_zero(), 0);
1016 filler_node->visible =
false;
1020 Tree *root_error = ts_tree_make_error_node(&children);
1026 ts_tree_release(eof);
1034 Tree *parent = ts_tree_make_error_node(&children);
1046 ErrorStatus error_status = ts_stack_error_status(self->stack, new_version);
1049 LOG(
"bail_on_recovery");
1057 bool validated_lookahead =
false;
1066 if (!validated_lookahead) {
1068 if (lookahead == reusable_node->tree) {
1069 reusable_node_pop_leaf(reusable_node);
1074 ts_tree_release(lookahead);
1079 validated_lookahead =
true;
1080 LOG(
"reused_lookahead sym:%s, size:%u",
SYM_NAME(lookahead->symbol), lookahead->size.bytes);
1083 bool reduction_stopped_at_error =
false;
1091 bool extra =
action.extra;
1098 next_state =
action.params.to_state;
1099 LOG(
"shift state:%u", next_state);
1102 if (lookahead->child_count > 0) {
1105 reusable_node_pop(reusable_node);
1106 ts_tree_release(lookahead);
1116 if (lookahead == reusable_node->tree)
1117 reusable_node_pop(reusable_node);
1119 ts_tree_release(lookahead);
1124 if (reduction_stopped_at_error)
1127 unsigned child_count =
action.params.child_count;
1129 bool fragile =
action.fragile;
1131 LOG(
"reduce sym:%s, child_count:%u",
SYM_NAME(symbol), child_count);
1133 StackPopResult reduction =
1136 if (reduction.stopped_at_error) {
1137 reduction_stopped_at_error =
true;
1143 last_reduction_version = slice.
version;
1148 if (ts_stack_error_status(self->stack,
version).count > 0)
1153 ts_tree_release(lookahead);
1158 while (lookahead->child_count > 0) {
1159 reusable_node_breakdown(reusable_node);
1160 ts_tree_release(lookahead);
1161 lookahead = reusable_node->tree;
1162 ts_tree_retain(lookahead);
1166 if (lookahead == reusable_node->tree)
1167 reusable_node_pop(reusable_node);
1168 ts_tree_release(lookahead);
1192 ts_tree_release(lookahead);
1203 array_grow(&self->reduce_actions, 4);
1205 self->finished_tree =
NULL;
1210 if (self->external_scanner_payload && self->language->external_scanner.destroy)
1211 self->language->external_scanner.destroy(self->external_scanner_payload);
1216 self->external_scanner_payload =
NULL;
1218 self->language = language;
1224 if (self->reduce_actions.contents)
1226 if (self->tree_path1.contents)
1228 if (self->tree_path2.contents)
1237 uint32_t position = 0, last_position = 0;
1242 reusable_node =
self->reusable_node;
1243 last_position = position;
1246 position = ts_stack_top_position(self->stack,
version).chars;
1247 if (position > last_position || (
version > 0 && position == last_position))
1250 LOG(
"process version:%d, version_count:%u, state:%d, row:%u, col:%u",
1252 ts_stack_top_state(self->stack,
version),
1253 ts_stack_top_position(self->stack,
version).extent.row,
1254 ts_stack_top_position(self->stack,
version).extent.column);
1261 self->reusable_node = reusable_node;
1274 self->is_split = (
version > 1);
1281 ts_tree_assign_parents(self->finished_tree, &self->tree_path1);
1282 return self->finished_tree;
#define array_front(self)
#define array_erase(self, index)
#define array_push_all(self, other)
#define array_push(self, element)
#define array_delete(self)
#define array_clear(self)
#define array_splice(self, index, old_count, new_count, new_contents)
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void count
void ts_language_table_entry(const TSLanguage *self, TSStateId state, TSSymbol symbol, TableEntry *result)
TSSymbolMetadata ts_language_symbol_metadata(const TSLanguage *self, TSSymbol symbol)
static const TSParseAction * ts_language_actions(const TSLanguage *self, TSStateId state, TSSymbol symbol, uint32_t *count)
static TSStateId ts_language_next_state(const TSLanguage *self, TSStateId state, TSSymbol symbol)
static const bool * ts_language_enabled_external_tokens(const TSLanguage *self, unsigned external_scanner_state)
static Length length_zero(void)
static Length length_sub(Length len1, Length len2)
void ts_lexer_reset(Lexer *self, Length position)
void ts_lexer_set_input(Lexer *self, TSInput input)
void ts_lexer_advance_to_end(Lexer *self)
void ts_lexer_start(Lexer *self)
void ts_lexer_init(Lexer *self)
return memset(p, 0, total)
static void start_state(RzCmdStateOutput *state)
assert(limit<=UINT32_MAX/2)
static void ts_reduce_action_set_add(ReduceActionSet *self, ReduceAction new_action)
static ReusableNode reusable_node_new(void)
#define ts_builtin_sym_end
@ TSParseActionTypeAccept
@ TSParseActionTypeRecover
@ TSParseActionTypeReduce
#define ts_builtin_sym_error
#define STACK_VERSION_NONE
uint32_t tree_count_above_error
TreeArray * trees_above_error
uint32_t best_repair_skip_count
TSSymbol lookahead_symbol
TSStateId best_repair_next_state
TSSymbol lookahead_symbol
struct TSLanguage::@436 external_scanner
uint16_t external_lex_state
const TSParseAction * actions
void ts_stack_renumber_version(Stack *self, StackVersion v1, StackVersion v2)
void ts_stack_halt(Stack *self, StackVersion version)
void ts_stack_clear(Stack *self)
uint32_t ts_stack_version_count(const Stack *self)
StackSliceArray ts_stack_pop_count(Stack *self, StackVersion version, uint32_t count)
void ts_stack_push(Stack *self, StackVersion version, Subtree subtree, bool pending, TSStateId state)
void ts_stack_remove_version(Stack *self, StackVersion version)
bool ts_stack_merge(Stack *self, StackVersion version1, StackVersion version2)
StackVersion ts_stack_copy_version(Stack *self, StackVersion version)
StackSliceArray ts_stack_pop_pending(Stack *self, StackVersion version)
StackSliceArray ts_stack_pop_all(Stack *self, StackVersion version)
Stack * ts_stack_new(SubtreePool *subtree_pool)
void ts_stack_delete(Stack *self)
bool ts_stack_is_halted(const Stack *self, StackVersion version)
#define TS_TREE_STATE_NONE
static StackPopResult parser__reduce(Parser *self, StackVersion version, TSSymbol symbol, unsigned count, bool fragile, bool allow_skipping)
static void parser__handle_error(Parser *self, StackVersion version, TSSymbol lookahead_symbol)
static void parser__clear_cached_token(Parser *self)
bool parser_init(Parser *self)
static bool parser__select_tree(Parser *self, Tree *left, Tree *right)
void parser_destroy(Parser *self)
static StackIterateAction parser__skip_preceding_trees_callback(void *payload, TSStateId state, TreeArray *trees, uint32_t tree_count, bool is_done, bool is_pending)
static void parser__push(Parser *self, StackVersion version, Tree *tree, TSStateId state)
static void parser__halt_parse(Parser *self)
static bool parser__better_version_exists(Parser *self, StackVersion version, ErrorStatus my_error_status)
static void parser__start(Parser *self, TSInput input, Tree *previous_tree)
static Tree * parser__get_lookahead(Parser *self, StackVersion version, ReusableNode *reusable_node, bool *is_fresh)
static bool parser__breakdown_lookahead(Parser *self, Tree **lookahead, TSStateId state, ReusableNode *reusable_node)
static void parser__shift(Parser *self, StackVersion version, TSStateId state, Tree *lookahead, bool extra)
static bool parser__switch_children(Parser *self, Tree *tree, Tree **children, uint32_t count)
static bool parser__can_reuse(Parser *self, TSStateId state, Tree *tree, TableEntry *table_entry)
Tree * parser_parse(Parser *self, TSInput input, Tree *old_tree, bool halt_on_error)
static bool ts_lex_mode_eq(TSLexMode self, TSLexMode other)
static Tree * parser__lex(Parser *self, StackVersion version)
static StackIterateAction parser__repair_error_callback(void *payload, TSStateId state, TreeArray *trees, uint32_t tree_count, bool is_done, bool is_pending)
static CondenseResult parser__condense_stack(Parser *self)
static bool parser__do_potential_reductions(Parser *self, StackVersion version)
static int CondenseResultMadeChange
static bool parser__breakdown_top_of_stack(Parser *self, StackVersion version)
void parser_set_language(Parser *self, const TSLanguage *language)
static void parser__advance(Parser *self, StackVersion version, ReusableNode *reusable_node)
static bool parser__repair_error(Parser *self, StackSlice slice, TSSymbol lookahead_symbol, TableEntry entry)
static void parser__recover(Parser *self, StackVersion version, TSStateId state, Tree *lookahead)
static void parser__accept(Parser *self, StackVersion version, Tree *lookahead)
static const TSParseAction * parser__reductions_after_sequence(Parser *self, TSStateId start_state, const TreeArray *trees_below, uint32_t tree_count_below, const TreeArray *trees_above, TSSymbol lookahead_symbol, uint32_t *count)
static int CondenseResultAllVersionsHadError
static bool parser__skip_preceding_trees(Parser *self, StackVersion version, TSSymbol lookahead_symbol)
static void parser__restore_external_scanner(Parser *self, StackVersion version)
void error(const char *msg)
static bool input(void *ud, zip_uint8_t *data, zip_uint64_t length)