summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@colm.net>2021-12-28 18:23:45 +0000
committerAdrian Thurston <thurston@colm.net>2021-12-28 18:26:40 +0000
commit2d8ba76ddaf6634f285d0a81ee42d5ee77d084cf (patch)
tree1633004184b2281a14ab876df19437ab44f185df
parentbe2c9cf238ec1d048e3b2d05f1b56a9f2a267668 (diff)
downloadcolm-2d8ba76ddaf6634f285d0a81ee42d5ee77d084cf.tar.gz
generate a check for EOF if there are from-state actions
From-state actions now execute on EOF, but we don't check for their presence when deciding if we should test against EOF. This led to from-state actions executing only if other conditions necessitating EOF-testing are present. Added the check. refs adrian-thurston/ragel#80
-rw-r--r--src/libfsm/asm.cc2
-rw-r--r--src/libfsm/goto.cc4
-rw-r--r--src/libfsm/ipgoto.cc2
-rw-r--r--src/libfsm/tabbreak.cc2
-rw-r--r--src/libfsm/tabgoto.cc2
-rw-r--r--src/libfsm/tabvar.cc2
6 files changed, 7 insertions, 7 deletions
diff --git a/src/libfsm/asm.cc b/src/libfsm/asm.cc
index ecfe1c0f..db084d6e 100644
--- a/src/libfsm/asm.cc
+++ b/src/libfsm/asm.cc
@@ -1160,7 +1160,7 @@ void AsmCodeGen::NFA_PUSH( RedStateAp *st )
void AsmCodeGen::STATE_GOTOS()
{
- bool eof = redFsm->anyEofActivity() || redFsm->anyNfaStates();
+ bool eof = redFsm->anyEofActivity() || redFsm->anyNfaStates() || redFsm->anyFromStateActions();
for ( RedStateList::Iter st = redFsm->stateList; st.lte(); st++ ) {
/* Writing code above state gotos. */
diff --git a/src/libfsm/goto.cc b/src/libfsm/goto.cc
index 610f44d1..04d381d9 100644
--- a/src/libfsm/goto.cc
+++ b/src/libfsm/goto.cc
@@ -368,7 +368,7 @@ void Goto::FROM_STATE_ACTION_EMIT( RedStateAp *state )
std::ostream &Goto::STATE_CASES()
{
- bool eof = redFsm->anyEofActivity() || redFsm->anyNfaStates();
+ bool eof = redFsm->anyEofActivity() || redFsm->anyNfaStates() || redFsm->anyFromStateActions();
for ( RedStateList::Iter st = redFsm->stateList; st.lte(); st++ ) {
/* Writing code above state gotos. */
@@ -881,7 +881,7 @@ void Goto::writeExec()
out << EMIT_LABEL( _resume );
/* Do we break out on no more input. */
- bool eof = redFsm->anyEofActivity() || redFsm->anyNfaStates();
+ bool eof = redFsm->anyEofActivity() || redFsm->anyNfaStates() || redFsm->anyFromStateActions();
if ( !noEnd ) {
if ( eof ) {
out <<
diff --git a/src/libfsm/ipgoto.cc b/src/libfsm/ipgoto.cc
index 3718ea91..5748ad72 100644
--- a/src/libfsm/ipgoto.cc
+++ b/src/libfsm/ipgoto.cc
@@ -452,7 +452,7 @@ void IpGoto::NFA_PUSH_ST( RedStateAp *state )
std::ostream &IpGoto::STATE_GOTOS()
{
- bool eof = redFsm->anyEofActivity() || redFsm->anyNfaStates();
+ bool eof = redFsm->anyEofActivity() || redFsm->anyNfaStates() || redFsm->anyFromStateActions();
for ( RedStateList::Iter st = redFsm->stateList; st.lte(); st++ ) {
IN_TRANS_ACTIONS( st );
diff --git a/src/libfsm/tabbreak.cc b/src/libfsm/tabbreak.cc
index ee82cc0c..87f7c690 100644
--- a/src/libfsm/tabbreak.cc
+++ b/src/libfsm/tabbreak.cc
@@ -215,7 +215,7 @@ void TabBreak::writeExec()
out << BREAK_LABEL( _resume );
/* Do we break out on no more input. */
- bool eof = redFsm->anyEofActivity() || redFsm->anyNfaStates();
+ bool eof = redFsm->anyEofActivity() || redFsm->anyNfaStates() || redFsm->anyFromStateActions();
if ( !noEnd ) {
if ( eof ) {
out <<
diff --git a/src/libfsm/tabgoto.cc b/src/libfsm/tabgoto.cc
index ca90cb9d..8179d4b5 100644
--- a/src/libfsm/tabgoto.cc
+++ b/src/libfsm/tabgoto.cc
@@ -185,7 +185,7 @@ void TabGoto::writeExec()
out << EMIT_LABEL( _resume );
/* Do we break out on no more input. */
- bool eof = redFsm->anyEofActivity() || redFsm->anyNfaStates();
+ bool eof = redFsm->anyEofActivity() || redFsm->anyNfaStates() || redFsm->anyFromStateActions();
if ( !noEnd ) {
if ( eof ) {
out <<
diff --git a/src/libfsm/tabvar.cc b/src/libfsm/tabvar.cc
index 02bd7b55..1b0ae824 100644
--- a/src/libfsm/tabvar.cc
+++ b/src/libfsm/tabvar.cc
@@ -161,7 +161,7 @@ void TabVar::writeExec()
out << BREAK_LABEL( _resume );
/* Do we break out on no more input. */
- bool eof = redFsm->anyEofActivity() || redFsm->anyNfaStates();
+ bool eof = redFsm->anyEofActivity() || redFsm->anyNfaStates() || redFsm->anyFromStateActions();
if ( !noEnd ) {
if ( eof ) {
out <<