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

@ -41,6 +41,7 @@ enum {
typedef unsigned int StackIterateAction;
typedef StackIterateAction (*StackIterateCallback)(void *, TSStateId state,
TreeArray *trees,
size_t tree_count,
bool is_done,
bool is_pending);
@ -72,6 +73,10 @@ TSStateId ts_stack_top_state(const Stack *, StackVersion);
*/
TSLength ts_stack_top_position(const Stack *, StackVersion);
size_t ts_stack_error_length(const Stack *, StackVersion);
size_t ts_stack_last_repaired_error_size(const Stack *, StackVersion);
/*
* Push a tree and state onto the given head of the stack. This could cause
* the version to merge with an existing version.
@ -100,6 +105,8 @@ void ts_stack_merge(Stack *);
void ts_stack_renumber_version(Stack *, StackVersion, StackVersion);
StackVersion ts_stack_duplicate_version(Stack *, StackVersion);
/*
* Remove the given version from the stack.
*/