summaryrefslogtreecommitdiff
path: root/src/pdarun.c
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@complang.org>2016-03-23 15:23:07 +0100
committerAdrian Thurston <thurston@complang.org>2016-03-23 15:23:07 +0100
commit2afdfef96c9de759a24ba4cb56928c48e1d86bd3 (patch)
treeb00080639d90458badc067b1d37a6c3936070ca0 /src/pdarun.c
parentb9d35edf909d3b68461e27a8985acb0df25d19b2 (diff)
downloadcolm-2afdfef96c9de759a24ba4cb56928c48e1d86bd3.tar.gz
commit shift count needs to be initialized to -1
An initial value of zero for commit shift count means we can erroneously fail a parse when we back up to zero shifts.
Diffstat (limited to 'src/pdarun.c')
-rw-r--r--src/pdarun.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/pdarun.c b/src/pdarun.c
index dcbab4cb..52b203f5 100644
--- a/src/pdarun.c
+++ b/src/pdarun.c
@@ -1312,6 +1312,11 @@ void colm_pda_init( program_t *prg, struct pda_run *pda_run, struct pda_tables *
pda_run->target_steps = -1;
pda_run->reducer = reducer;
+ /* An initial commit shift count of -1 means we won't ever back up to zero
+ * shifts and think parsing cannot continue. */
+ pda_run->shift_count = 0;
+ pda_run->commit_shift_count = -1;
+
if ( reducer ) {
init_pool_alloc( &pda_run->local_pool, sizeof(parse_tree_t) +
prg->rtd->commit_union_sz(reducer) );
@@ -1508,6 +1513,7 @@ again:
*/
if ( pda_run->pda_tables->commit_len[pos] != 0 ) {
+ debug( prg, REALM_PARSE, "commit point\n" );
pda_run->commit_shift_count = pda_run->shift_count;
/* Not in a reverting context and the parser result is not used. */