Requery the parse table when breaking down the parse stack on invalid lookahead (#636)
* Requery parse table after breaking down parse stack due to invalid lookahead * Include Ruby parser in randomized test suite Ruby and PHP are our only two languages that use non-terminal extras. Adding Ruby uncovered some bugs. * Print edited source code when running parse --edit w/ debug flag * Recompute lookahead when breaking down stack on invalid lookahead * Fix stack summary leak when there are two discontinuities on a stack version
This commit is contained in:
parent
81d533d2d1
commit
0e5ff14976
4 changed files with 25 additions and 2 deletions
|
|
@ -571,7 +571,12 @@ void ts_stack_record_summary(Stack *self, StackVersion version, unsigned max_dep
|
|||
};
|
||||
array_init(session.summary);
|
||||
stack__iter(self, version, summarize_stack_callback, &session, -1);
|
||||
self->heads.contents[version].summary = session.summary;
|
||||
StackHead *head = &self->heads.contents[version];
|
||||
if (head->summary) {
|
||||
array_delete(head->summary);
|
||||
ts_free(head->summary);
|
||||
}
|
||||
head->summary = session.summary;
|
||||
}
|
||||
|
||||
StackSummary *ts_stack_get_summary(Stack *self, StackVersion version) {
|
||||
|
|
@ -743,6 +748,10 @@ bool ts_stack_print_dot_graph(Stack *self, const TSLanguage *language, FILE *f)
|
|||
ts_stack_error_cost(self, i)
|
||||
);
|
||||
|
||||
if (head->summary) {
|
||||
fprintf(f, "\nsummary_size: %u", head->summary->size);
|
||||
}
|
||||
|
||||
if (head->last_external_token.ptr) {
|
||||
const ExternalScannerState *state = &head->last_external_token.ptr->external_scanner_state;
|
||||
const char *data = ts_external_scanner_state_data(state);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue