Added the eofTarget to StateAp. This will be used only to track the transition
authorthurston <thurston@052ea7fc-9027-0410-9066-f65837a77df0>
Thu, 27 Sep 2007 16:07:44 +0000 (16:07 +0000)
committerthurston <thurston@052ea7fc-9027-0410-9066-f65837a77df0>
Thu, 27 Sep 2007 16:07:44 +0000 (16:07 +0000)
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
ragel/fsmgraph.h
ragel/fsmstate.cpp

index f1d7141..cbf33b7 100644 (file)
@@ -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. */
index e3b3486..3241f0f 100644 (file)
@@ -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;
 
index 4322c10..ac2113a 100644 (file)
@@ -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),