X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=ragel%2Ffsmap.cpp;h=12d9e5660b28cb747fbf5802bb80f361b5fbfe8f;hb=acae12355db19c40ecea436989d78c59d6a10477;hp=0674fa99a0384e96f58786fc0d2bf5498f12ae4b;hpb=6fc85667e35a6563a1c679b9ebecaf04eb8aa0be;p=external%2Fragel.git diff --git a/ragel/fsmap.cpp b/ragel/fsmap.cpp index 0674fa9..12d9e56 100644 --- a/ragel/fsmap.cpp +++ b/ragel/fsmap.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2002-2004 Adrian Thurston + * Copyright 2002-2004 Adrian Thurston */ /* This file is part of Ragel. @@ -126,7 +126,7 @@ void FsmAp::startFsmPrior( int ordering, PriorDesc *prior ) /* If the new start state is final then set the out priority. This follows * the same convention as setting start action in the out action table of * a final start state. */ - if ( startState->stateBits & SB_ISFINAL ) + if ( startState->stateBits & STB_ISFINAL ) startState->outPriorTable.setPrior( ordering, prior ); } @@ -190,7 +190,7 @@ void FsmAp::startFsmAction( int ordering, Action *action ) /* If start state is final then add the action to the out action table. * This means that when the null string is accepted the start action will * not be bypassed. */ - if ( startState->stateBits & SB_ISFINAL ) + if ( startState->stateBits & STB_ISFINAL ) startState->outActionTable.setAction( ordering, action ); } @@ -302,6 +302,18 @@ void FsmAp::fillGaps( StateAp *state ) } } +void FsmAp::setErrorActions( StateAp *state, const ActionTable &other ) +{ + /* Fill any gaps in the out list with an error transition. */ + fillGaps( state ); + + /* Set error transitions in the transitions that go to error. */ + for ( TransList::Iter trans = state->outList; trans.lte(); trans++ ) { + if ( trans->toState == 0 ) + trans->actionTable.setActions( other ); + } +} + void FsmAp::setErrorAction( StateAp *state, int ordering, Action *action ) { /* Fill any gaps in the out list with an error transition. */ @@ -658,14 +670,14 @@ void FsmAp::verifyStates() { for ( StateList::Iter state = stateList; state.lte(); state++ ) { /* Non final states should not have leaving data. */ - if ( ! (state->stateBits & SB_ISFINAL) ) { + if ( ! (state->stateBits & STB_ISFINAL) ) { assert( state->outActionTable.length() == 0 ); assert( state->outCondSet.length() == 0 ); assert( state->outPriorTable.length() == 0 ); } /* Data used in algorithms should be cleared. */ - assert( (state->stateBits & SB_BOTH) == 0 ); + assert( (state->stateBits & STB_BOTH) == 0 ); assert( state->foreignInTrans > 0 ); } }