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
This commit is contained in:
Max Brunsfeld 2016-05-09 14:31:44 -07:00
parent 9d247e45b2
commit 22c550c9d6
21 changed files with 454 additions and 506 deletions

View file

@ -7,15 +7,13 @@ extern "C" {
#include "runtime/stack.h"
#include "runtime/array.h"
typedef struct ErrorRepair ErrorRepair;
typedef Array(ErrorRepair) ErrorRepairArray;
#include "runtime/reduce_action.h"
typedef struct {
TSLexer lexer;
Stack *stack;
const TSLanguage *language;
ErrorRepairArray error_repairs;
ReduceActionSet reduce_actions;
TSTree *finished_tree;
bool is_split;
bool print_debugging_graphs;