From 3663456b3414207d0ec945db83c62c5f4119136c Mon Sep 17 00:00:00 2001 From: thurston Date: Thu, 27 Sep 2007 16:07:44 +0000 Subject: [PATCH] Added the eofTarget to StateAp. This will be used only to track the transition back to the start state in scanners. git-svn-id: http://svn.complang.org/ragel/trunk@289 052ea7fc-9027-0410-9066-f65837a77df0 --- ragel/fsmbase.cpp | 4 ++++ ragel/fsmgraph.h | 4 ++++ ragel/fsmstate.cpp | 7 +++++++ 3 files changed, 15 insertions(+) diff --git a/ragel/fsmbase.cpp b/ragel/fsmbase.cpp index f1d7141..cbf33b7 100644 --- a/ragel/fsmbase.cpp +++ b/ragel/fsmbase.cpp @@ -98,6 +98,10 @@ FsmAp::FsmAp( const FsmAp &graph ) trans->toState = 0; attachTrans( state, toState, trans ); } + + /* Fix the eofTarg, if set. */ + if ( state->eofTarget != 0 ) + state->eofTarget = state->eofTarget->alg.stateMap; } /* Fix the state pointers in the entry points array. */ diff --git a/ragel/fsmgraph.h b/ragel/fsmgraph.h index e3b3486..3241f0f 100644 --- a/ragel/fsmgraph.h +++ b/ragel/fsmgraph.h @@ -680,6 +680,10 @@ struct StateAp /* In transition Lists. */ TransInList inList; + /* Set only during scanner construction when actions are added. NFA to DFA + * code can ignore this. */ + StateAp *eofTarget; + /* Entry points into the state. */ EntryIdSet entryIds; diff --git a/ragel/fsmstate.cpp b/ragel/fsmstate.cpp index 4322c10..ac2113a 100644 --- a/ragel/fsmstate.cpp +++ b/ragel/fsmstate.cpp @@ -76,6 +76,9 @@ StateAp::StateAp() outList(), inList(), + /* No EOF target. */ + eofTarget(0), + /* No entry points, or epsilon trans. */ entryIds(), epsilonTrans(), @@ -115,6 +118,10 @@ StateAp::StateAp(const StateAp &other) outList(), inList(), + /* Set this using the original state's eofTarget. It will get mapped back + * to the new machine in the Fsm copy constructor. */ + eofTarget(other.eofTarget), + /* Duplicate the entry id set and epsilon transitions. These * are sets of integers and as such need no fixing. */ entryIds(other.entryIds), -- 2.7.4