From 859c26b3518f113ba21eb065ba54ee4e5f61103d Mon Sep 17 00:00:00 2001 From: Adrian Thurston Date: Sun, 8 Mar 2009 16:08:30 +0000 Subject: Got parse_stop working again. Don't need to set fsmRun->cs to error anymore because we don't need to break out of the fsmRun loop deeper in the stack. --- colm/fsmrun.cpp | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/colm/fsmrun.cpp b/colm/fsmrun.cpp index 43d63687..133d0048 100644 --- a/colm/fsmrun.cpp +++ b/colm/fsmrun.cpp @@ -590,7 +590,6 @@ void send_handle_error( FsmRun *fsmRun, PdaRun *parser, Kid *input ) cerr << "stopping the parse" << endl; } #endif - fsmRun->cs = fsmRun->tables->errorState; parser->stopParsing = true; } } @@ -907,25 +906,14 @@ void parse( FsmRun *fsmRun, PdaRun *parser ) fsmRun->sendEOF( parser ); if ( fsmRun->eofSent ) break; + continue; } /* Check for a named language element. */ - if ( tokenId == SCAN_LANG_EL ) + if ( tokenId == SCAN_LANG_EL ) { fsmRun->sendNamedLangEl( parser ); - -/* THIS GOES SOMEWHERE ELSE NOW */ -#if 0 - /* Fall through here either when the input buffer has been exhausted - * or the scanner is in an error state. Otherwise we must continue. */ - if ( cs == tables->errorState && parser->stopParsing ) { - #ifdef COLM_LOG_PARSE - if ( colm_log_parse ) { - cerr << "scanner has been stopped" << endl; - } - #endif - goto done; + continue; } -#endif /* Check for error. */ if ( tokenId == SCAN_ERROR ) { @@ -941,6 +929,17 @@ void parse( FsmRun *fsmRun, PdaRun *parser ) fsmRun->sendIgnore( parser, tokenId ); else fsmRun->sendToken( parser, tokenId ); + + /* Fall through here either when the input buffer has been exhausted + * or the scanner is in an error state. Otherwise we must continue. */ + if ( parser->stopParsing ) { + #ifdef COLM_LOG_PARSE + if ( colm_log_parse ) { + cerr << "scanner has been stopped" << endl; + } + #endif + break; + } } } -- cgit v1.2.1