summaryrefslogtreecommitdiff
path: root/src/pdarun.c
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@complang.org>2015-10-05 12:54:50 -0400
committerAdrian Thurston <thurston@complang.org>2015-10-05 12:54:50 -0400
commit2c8090f0b665281827c7867f957a224f1d1b6cae (patch)
tree29510e0a5b18e5ccb397ce7f35bf93243c9366e3 /src/pdarun.c
parent904ac5cc1675b19249750e3f5492cba720dda4c5 (diff)
downloadcolm-2c8090f0b665281827c7867f957a224f1d1b6cae.tar.gz
traverse both parse tree and real tree during reduce
Diffstat (limited to 'src/pdarun.c')
-rw-r--r--src/pdarun.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/pdarun.c b/src/pdarun.c
index 68cbe280..d06659f3 100644
--- a/src/pdarun.c
+++ b/src/pdarun.c
@@ -1382,8 +1382,9 @@ again:
pda_run->commit_shift_count = pda_run->shift_count;
/* Not in a reverting context and the parser result is not used. */
- if ( ! pda_run->revert_on && pda_run->not_used )
+ if ( pda_run->not_used ) {
commit_reduce( prg, sp, pda_run );
+ }
}
/*
@@ -2132,7 +2133,12 @@ long colm_parse_finish( tree_t **result, program_t *prg, tree_t **sp,
/* FIXME: need something here to check that we are not stopped waiting for
* more data when we are actually expected to finish. This check doesn't
* work (at time of writing). */
- //assert( (pdaRun->stopTarget > 0 && pdaRun->stopParsing) || streamToImpl( input )->eofSent );
+ //assert( (pdaRun->stopTarget > 0 && pdaRun->stopParsing) ||
+ // streamToImpl( input )->eofSent );
+
+ /* Flush out anything not committed. */
+ if ( pda_run->not_used )
+ commit_reduce( prg, sp, pda_run );
if ( !revert_on )
colm_rcode_downref_all( prg, sp, &pda_run->reverse_code );