summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/pdarun.c6
-rw-r--r--src/pdarun.h6
2 files changed, 12 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. */
diff --git a/src/pdarun.h b/src/pdarun.h
index dfabfea5..a5427576 100644
--- a/src/pdarun.h
+++ b/src/pdarun.h
@@ -317,6 +317,12 @@ struct pda_run
long steps;
long target_steps;
+
+
+ /* The shift count simply tracks the number of shifts that have happend.
+ * The commit shift count is the shift count when the last commit occurred.
+ * If we back up to this number of shifts then we decide we cannot proceed.
+ * The commit shift count is initialized to -1. */
long shift_count;
long commit_shift_count;