Use out-of-context states when in error parse state
This commit is contained in:
parent
9b2e775b79
commit
c8d7c16f87
2 changed files with 6 additions and 1 deletions
|
|
@ -10,6 +10,7 @@ extern "C" {
|
|||
#include "tree_sitter/runtime.h"
|
||||
|
||||
#define ts_lex_state_error 0
|
||||
#define ts_parse_state_error ((TSStateId)-1)
|
||||
#define TS_DEBUG_BUFFER_SIZE 512
|
||||
|
||||
typedef struct TSTree TSTree;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,11 @@
|
|||
const TSParseAction *ts_language_actions(const TSLanguage *language,
|
||||
TSStateId state, TSSymbol sym,
|
||||
size_t *count) {
|
||||
unsigned short action_index =
|
||||
if (state == ts_parse_state_error) {
|
||||
state = language->out_of_context_states[sym];
|
||||
}
|
||||
|
||||
unsigned action_index =
|
||||
(language->parse_table + (state * language->symbol_count))[sym];
|
||||
*count = language->parse_actions[action_index].count;
|
||||
const TSParseActionEntry *entry = language->parse_actions + action_index + 1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue