"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/fsmgraph.cc" between
ragel-7.0.0.11.tar.gz and ragel-7.0.0.12.tar.gz

About: Ragel compiles executable finite state machines from regular languages (C, C++, Obj-C, C#, D, Java, Go and Ruby). Development version.

fsmgraph.cc  (ragel-7.0.0.11):fsmgraph.cc  (ragel-7.0.0.12)
skipping to change at line 354 skipping to change at line 354
cond->actionTable.setActions( srcState->o utActionTable ); cond->actionTable.setActions( srcState->o utActionTable );
/* Get the priorities from the outPriorTa ble. */ /* Get the priorities from the outPriorTa ble. */
cond->priorTable.setPriors( srcState->out PriorTable ); cond->priorTable.setPriors( srcState->out PriorTable );
} }
} }
} }
} }
if ( destState->nfaOut != 0 ) { if ( destState->nfaOut != 0 ) {
for ( NfaTransList::Iter na = *destState->nfaOut; na.lte(); na++ for ( NfaTransList::Iter na = *destState->nfaOut; na.lte(); na++
) { )
na->popAction.setActions( srcState->outActionTable ); transferOutToNfaTrans( na, srcState );
na->popCondSpace = srcState->outCondSpace;
na->popCondKeys = srcState->outCondKeys;
na->priorTable.setPriors( srcState->outPriorTable );
}
} }
} }
/* Union worker used by union, set diff (subtract) and intersection. */ /* Union worker used by union, set diff (subtract) and intersection. */
FsmRes FsmAp::doUnion( FsmAp *fsm, FsmAp *other ) FsmRes FsmAp::doUnion( FsmAp *fsm, FsmAp *other )
{ {
/* Build a state set consisting of both start states */ /* Build a state set consisting of both start states */
StateSet startStateSet; StateSet startStateSet;
startStateSet.insert( fsm->startState ); startStateSet.insert( fsm->startState );
startStateSet.insert( other->startState ); startStateSet.insert( other->startState );
skipping to change at line 515 skipping to change at line 509
/* Clean up the target list. */ /* Clean up the target list. */
delete st->eptVect; delete st->eptVect;
st->eptVect = 0; st->eptVect = 0;
} }
/* Clear the epsilon transitions vector. */ /* Clear the epsilon transitions vector. */
st->epsilonTrans.empty(); st->epsilonTrans.empty();
} }
} }
FsmRes FsmAp::applyNfaTrans( FsmAp *fsm, StateAp *fromState, StateAp *toState, N
faTrans *nfaTrans )
{
fsm->setMisfitAccounting( true );
fsm->mergeStates( fromState, toState, false );
/* Epsilons can caused merges which leave behind unreachable states. */
FsmRes res = FsmAp::fillInStates( fsm );
if ( !res.success() )
return res;
/* Can nuke the epsilon transition that we will never
* follow. */
fsm->detachFromNfa( fromState, toState, nfaTrans );
fromState->nfaOut->detach( nfaTrans );
delete nfaTrans;
if ( fromState->nfaOut->length() == 0 ) {
delete fromState->nfaOut;
fromState->nfaOut = 0;
}
/* Remove the misfits and turn off misfit accounting. */
fsm->removeMisfits();
fsm->setMisfitAccounting( false );
return FsmRes( FsmRes::Fsm(), fsm );
}
void FsmAp::globOp( FsmAp **others, int numOthers ) void FsmAp::globOp( FsmAp **others, int numOthers )
{ {
for ( int m = 0; m < numOthers; m++ ) { for ( int m = 0; m < numOthers; m++ ) {
assert( ctx == others[m]->ctx ); assert( ctx == others[m]->ctx );
} }
/* All other machines loose start states status. */ /* All other machines loose start states status. */
for ( int m = 0; m < numOthers; m++ ) for ( int m = 0; m < numOthers; m++ )
others[m]->unsetStartState(); others[m]->unsetStartState();
skipping to change at line 1363 skipping to change at line 1386
/* Get the epsilons, out priorities. */ /* Get the epsilons, out priorities. */
destState->epsilonTrans.append( srcState->epsilonTrans ); destState->epsilonTrans.append( srcState->epsilonTrans );
destState->outPriorTable.setPriors( srcState->outPriorTable ); destState->outPriorTable.setPriors( srcState->outPriorTable );
/* Get all actions. */ /* Get all actions. */
destState->toStateActionTable.setActions( srcState->toStateAction Table ); destState->toStateActionTable.setActions( srcState->toStateAction Table );
destState->fromStateActionTable.setActions( srcState->fromStateAc tionTable ); destState->fromStateActionTable.setActions( srcState->fromStateAc tionTable );
destState->outActionTable.setActions( srcState->outActionTable ); destState->outActionTable.setActions( srcState->outActionTable );
destState->errActionTable.setActions( srcState->errActionTable ); destState->errActionTable.setActions( srcState->errActionTable );
destState->eofActionTable.setActions( srcState->eofActionTable ); destState->eofActionTable.setActions( srcState->eofActionTable );
destState->lmNfaParts.insert( srcState->lmNfaParts );
destState->guardedInTable.setPriors( srcState->guardedInTable ); destState->guardedInTable.setPriors( srcState->guardedInTable );
} }
} }
void FsmAp::mergeStateBits( StateAp *destState, StateAp *srcState ) void FsmAp::mergeStateBits( StateAp *destState, StateAp *srcState )
{ {
/* Get bits and final state status. Note in the above code we depend on t he /* Get bits and final state status. Note in the above code we depend on t he
* original final state status being present. */ * original final state status being present. */
destState->stateBits |= ( srcState->stateBits & ~STB_ISFINAL ); destState->stateBits |= ( srcState->stateBits & ~STB_ISFINAL );
if ( srcState->isFinState() ) if ( srcState->isFinState() )
skipping to change at line 1386 skipping to change at line 1410
void FsmAp::mergeNfaTransitions( StateAp *destState, StateAp *srcState ) void FsmAp::mergeNfaTransitions( StateAp *destState, StateAp *srcState )
{ {
/* Copy in any NFA transitions. */ /* Copy in any NFA transitions. */
if ( srcState->nfaOut != 0 ) { if ( srcState->nfaOut != 0 ) {
if ( destState->nfaOut == 0 ) if ( destState->nfaOut == 0 )
destState->nfaOut = new NfaTransList; destState->nfaOut = new NfaTransList;
for ( NfaTransList::Iter nt = *srcState->nfaOut; nt.lte(); nt++ ) { for ( NfaTransList::Iter nt = *srcState->nfaOut; nt.lte(); nt++ ) {
NfaTrans *trans = new NfaTrans( NfaTrans *trans = new NfaTrans(
nt->pushTable, nt->restoreTable, nt->pushTable, nt->restoreTable,
nt->popCondSpace, nt->popCondKeys, nt->popFrom, nt->popCondSpace, nt->popCon dKeys,
nt->popAction, nt->popTest, nt->order ); nt->popAction, nt->popTest, nt->order );
destState->nfaOut->append( trans ); destState->nfaOut->append( trans );
attachToNfa( destState, nt->toState, trans ); attachToNfa( destState, nt->toState, trans );
} }
} }
} }
void FsmAp::checkPriorInteractions( StateAp *destState, StateAp *srcState ) void FsmAp::checkPriorInteractions( StateAp *destState, StateAp *srcState )
{ {
 End of changes. 4 change blocks. 
10 lines changed or deleted 35 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)