tree-sitter/src/runtime/parser.h
Max Brunsfeld 22c550c9d6 Discard tokens after error detection to find the best repair
* Use GLR stack-splitting to try all numbers of tokens to
  discard until a repair is found.
* Check the validity of repairs by looking at the child trees,
  rather than the statically-computed 'in-progress symbols' list
2016-05-11 13:49:43 -07:00

33 lines
692 B
C

#ifndef RUNTIME_PARSER_H_
#define RUNTIME_PARSER_H_
#ifdef __cplusplus
extern "C" {
#endif
#include "runtime/stack.h"
#include "runtime/array.h"
#include "runtime/reduce_action.h"
typedef struct {
TSLexer lexer;
Stack *stack;
const TSLanguage *language;
ReduceActionSet reduce_actions;
TSTree *finished_tree;
bool is_split;
bool print_debugging_graphs;
TSTree scratch_tree;
} TSParser;
bool ts_parser_init(TSParser *);
void ts_parser_destroy(TSParser *);
TSDebugger ts_parser_debugger(const TSParser *);
void ts_parser_set_debugger(TSParser *, TSDebugger);
TSTree *ts_parser_parse(TSParser *, TSInput, TSTree *);
#ifdef __cplusplus
}
#endif
#endif // RUNTIME_PARSER_H_