"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/fsmgraph.h" 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.h  (ragel-7.0.0.11):fsmgraph.h  (ragel-7.0.0.12)
skipping to change at line 701 skipping to change at line 701
: :
fromState(0), fromState(0),
toState(0), toState(0),
order(order), order(order),
popCondSpace(0) popCondSpace(0)
{ {
} }
NfaTrans( const ActionTable &pushTable, NfaTrans( const ActionTable &pushTable,
const ActionTable &restoreTable, const ActionTable &restoreTable,
const ActionTable &popFrom,
CondSpace *popCondSpace, CondSpace *popCondSpace,
const CondKeySet popCondKeys, const CondKeySet popCondKeys,
const ActionTable &popAction, const ActionTable &popAction,
const ActionTable &popTable, const ActionTable &popTable,
int order ) int order )
: :
fromState(0), toState(0), fromState(0), toState(0),
order(order), order(order),
pushTable(pushTable), pushTable(pushTable),
restoreTable(restoreTable), restoreTable(restoreTable),
popFrom(popFrom),
popCondSpace(popCondSpace), popCondSpace(popCondSpace),
popCondKeys(popCondKeys), popCondKeys(popCondKeys),
popAction(popAction), popAction(popAction),
popTest(popTable) popTest(popTable)
{} {}
NfaTrans( const NfaTrans &other ) NfaTrans( const NfaTrans &other )
: :
fromState(0), toState(0), fromState(0), toState(0),
order(other.order), order(other.order),
skipping to change at line 743 skipping to change at line 745
int order; int order;
ActionTable pushTable; ActionTable pushTable;
ActionTable restoreTable; ActionTable restoreTable;
/* /*
* 1. Conditions transferred (always tested first) * 1. Conditions transferred (always tested first)
* 2. Actions transferred * 2. Actions transferred
* 3. Pop actions created during epsilon draw. * 3. Pop actions created during epsilon draw.
*/ */
ActionTable popFrom;
CondSpace *popCondSpace; CondSpace *popCondSpace;
CondKeySet popCondKeys; CondKeySet popCondKeys;
ActionTable popAction; ActionTable popAction;
ActionTable popTest; ActionTable popTest;
PriorTable priorTable; PriorTable priorTable;
NfaTrans *prev, *next; NfaTrans *prev, *next;
NfaTrans *ilprev, *ilnext; NfaTrans *ilprev, *ilnext;
skipping to change at line 1013 skipping to change at line 1016
condSpaceMap.empty(); condSpaceMap.empty();
} }
}; };
struct FsmGbl struct FsmGbl
{ {
FsmGbl( const HostLang *hostLang ) FsmGbl( const HostLang *hostLang )
: :
printStatistics(false), printStatistics(false),
errorCount(0), errorCount(0),
//inLibRagel(false),
displayPrintables(false), displayPrintables(false),
//backend(Direct),
hostLang(hostLang), hostLang(hostLang),
stringTables(false), stringTables(false),
//backendFeature(GotoFeature),
checkPriorInteraction(0), checkPriorInteraction(0),
wantDupsRemoved(true), wantDupsRemoved(true),
minimizeLevel(MinimizePartition2), minimizeLevel(MinimizePartition2),
minimizeOpt(MinimizeMostOps) minimizeOpt(MinimizeMostOps)
{} {}
bool printStatistics; bool printStatistics;
/* /*
* Error reporting. * Error reporting.
skipping to change at line 1053 skipping to change at line 1053
/* Stats reporting. */ /* Stats reporting. */
std::ostream &stats(); std::ostream &stats();
/* Requested info. */ /* Requested info. */
std::ostream &info(); std::ostream &info();
std::stringstream libcerr; std::stringstream libcerr;
std::stringstream libcout; std::stringstream libcout;
int errorCount; int errorCount;
//bool inLibRagel;
void abortCompile( int code ); void abortCompile( int code );
bool displayPrintables; bool displayPrintables;
//RagelBackend backend;
const HostLang *hostLang; const HostLang *hostLang;
bool stringTables; bool stringTables;
//BackendFeature backendFeature;
bool checkPriorInteraction; bool checkPriorInteraction;
bool wantDupsRemoved; bool wantDupsRemoved;
MinimizeLevel minimizeLevel; MinimizeLevel minimizeLevel;
MinimizeOpt minimizeOpt; MinimizeOpt minimizeOpt;
}; };
/* All FSM operations must be between machines that have been created using the /* All FSM operations must be between machines that have been created using the
* same context object. */ * same context object. */
struct FsmCtx struct FsmCtx
skipping to change at line 1272 skipping to change at line 1269
/* Error action tables. */ /* Error action tables. */
ErrActionTable errActionTable; ErrActionTable errActionTable;
/* Actions to execute on eof. */ /* Actions to execute on eof. */
ActionTable eofActionTable; ActionTable eofActionTable;
/* Set of longest match items that may be active in this state. */ /* Set of longest match items that may be active in this state. */
LmItemSet lmItemSet; LmItemSet lmItemSet;
PriorTable guardedInTable; PriorTable guardedInTable;
/* Used by the NFA-based scanner to track the origin of final states. We
* only use it in cases where just one match is possible, starting with t
he
* final state duplicates that are drawn using NFA transitions. */
LmItemSet lmNfaParts;
}; };
/* Return and re-entry for the co-routine iterators. This should ALWAYS be /* Return and re-entry for the co-routine iterators. This should ALWAYS be
* used inside of a block. */ * used inside of a block. */
#define CO_RETURN(label) \ #define CO_RETURN(label) \
itState = label; \ itState = label; \
return; \ return; \
entry##label: {} entry##label: {}
/* Return and re-entry for the co-routine iterators. This should ALWAYS be /* Return and re-entry for the co-routine iterators. This should ALWAYS be
skipping to change at line 1876 skipping to change at line 1878
FsmRes( const PriorInteraction &, long long guardId ) FsmRes( const PriorInteraction &, long long guardId )
: fsm(0), type(TypePriorInteraction), id(guardId) {} : fsm(0), type(TypePriorInteraction), id(guardId) {}
FsmRes( const CondCostTooHigh &, long long costId ) FsmRes( const CondCostTooHigh &, long long costId )
: fsm(0), type(TypeCondCostTooHigh), id(costId) {} : fsm(0), type(TypeCondCostTooHigh), id(costId) {}
FsmRes( const InternalError & ) FsmRes( const InternalError & )
: fsm(0), type(TypeInternalError) {} : fsm(0), type(TypeInternalError) {}
bool success() { return fsm != 0; } bool success()
{ return fsm != 0; }
operator FsmAp*()
{ return type == TypeFsm ? fsm : 0; }
FsmAp *operator->()
{ return type == TypeFsm ? fsm : 0; }
FsmAp *fsm; FsmAp *fsm;
Type type; Type type;
long long id; long long id;
}; };
/* Graph class that implements actions and priorities. */ /* Graph class that implements actions and priorities. */
struct FsmAp struct FsmAp
{ {
/* Constructors/Destructors. */ /* Constructors/Destructors. */
skipping to change at line 2246 skipping to change at line 2254
static FsmRes starOp( FsmAp *fsm ); static FsmRes starOp( FsmAp *fsm );
static FsmRes plusOp( FsmAp *fsm ); static FsmRes plusOp( FsmAp *fsm );
static FsmRes questionOp( FsmAp *fsm ); static FsmRes questionOp( FsmAp *fsm );
static FsmRes exactRepeatOp( FsmAp *fsm, int times ); static FsmRes exactRepeatOp( FsmAp *fsm, int times );
static FsmRes maxRepeatOp( FsmAp *fsm, int times ); static FsmRes maxRepeatOp( FsmAp *fsm, int times );
static FsmRes minRepeatOp( FsmAp *fsm, int times ); static FsmRes minRepeatOp( FsmAp *fsm, int times );
static FsmRes rangeRepeatOp( FsmAp *fsm, int lower, int upper ); static FsmRes rangeRepeatOp( FsmAp *fsm, int lower, int upper );
static FsmRes concatOp( FsmAp *fsm, FsmAp *other, bool lastInSeq = true, static FsmRes concatOp( FsmAp *fsm, FsmAp *other, bool lastInSeq = true,
StateSet *fromStates = 0, bool optional = false ); StateSet *fromStates = 0, bool optional = false );
static FsmRes unionOp( FsmAp *fsm, FsmAp *other, bool lastInSeq = true ); static FsmRes unionOp( FsmAp *fsm, FsmAp *other, bool lastInSeq = true );
static FsmRes intersectOp( FsmAp *fsm, FsmAp *other, bool lastInSeq = tru e ); static FsmRes intersectOp( FsmAp *fsm, FsmAp *other, bool lastInSeq = tru e );
static FsmRes subtractOp( FsmAp *fsm, FsmAp *other, bool lastInSeq = true ); static FsmRes subtractOp( FsmAp *fsm, FsmAp *other, bool lastInSeq = true );
static FsmRes epsilonOp( FsmAp *fsm ); static FsmRes epsilonOp( FsmAp *fsm );
static FsmRes joinOp( FsmAp *fsm, int startId, int finalId, FsmAp **other s, int numOthers ); static FsmRes joinOp( FsmAp *fsm, int startId, int finalId, FsmAp **other s, int numOthers );
static FsmRes rightStartConcatOp( FsmAp *fsm, FsmAp *other, bool lastInSe q = true ); static FsmRes rightStartConcatOp( FsmAp *fsm, FsmAp *other, bool lastInSe q = true );
void transferOutToNfaTrans( NfaTrans *trans, StateAp *state ); void transferOutToNfaTrans( NfaTrans *trans, StateAp *state );
enum NfaRepeatMode {
NfaLegacy = 1,
NfaGreedy,
NfaLazy
};
static FsmRes applyNfaTrans( FsmAp *fsm, StateAp *fromState, StateAp *toS
tate, NfaTrans *nfaTrans );
/* Results in an NFA. */ /* Results in an NFA. */
static FsmRes nfaUnionOp( FsmAp *fsm, FsmAp **others, int n, int depth, s td::ostream &stats ); static FsmRes nfaUnionOp( FsmAp *fsm, FsmAp **others, int n, int depth, s td::ostream &stats );
static FsmRes nfaRepeatOp( FsmAp *fsm, Action *push, Action *pop, Action *init, static FsmRes nfaRepeatOp( FsmAp *fsm, Action *push, Action *pop, Action *init,
Action *stay, Action *repeat, Action *exit ); Action *stay, Action *repeat, Action *exit );
static FsmRes nfaRepeatOp2( FsmAp *fsm, Action *push, Action *pop, Action
*init,
Action *stay, Action *repeat, Action *exit, NfaRepeatMode
mode = NfaGreedy );
static FsmRes nfaWrap( FsmAp *fsm, Action *push, Action *pop, Action *ini
t,
Action *stay, Action *exit, NfaRepeatMode mode = NfaGreed
y );
static FsmRes nfaUnion( const NfaRoundVect &roundsList, FsmAp **machines, static FsmRes nfaUnion( const NfaRoundVect &roundsList, FsmAp **machines,
int numMachines, std::ostream &stats, bool printStatistic s ); int numMachines, std::ostream &stats, bool printStatistic s );
static FsmRes condPlus( FsmAp *fsm, long repId, Action *ini, Action *inc, Action *min, Action *max ); static FsmRes condPlus( FsmAp *fsm, long repId, Action *ini, Action *inc, Action *min, Action *max );
static FsmRes condStar( FsmAp *fsm, long repId, Action *ini, Action *inc, Action *min, Action *max ); static FsmRes condStar( FsmAp *fsm, long repId, Action *ini, Action *inc, Action *min, Action *max );
/* Make a new start state that has no entry points. Will not change the /* Make a new start state that has no entry points. Will not change the
* meaning of the fsm. */ * meaning of the fsm. */
static FsmRes isolateStartState( FsmAp *fsm ); static FsmRes isolateStartState( FsmAp *fsm );
skipping to change at line 2362 skipping to change at line 2384
* Path pruning * Path pruning
*/ */
/* Mark all states reachable from state. */ /* Mark all states reachable from state. */
void markReachableFromHereReverse( StateAp *state ); void markReachableFromHereReverse( StateAp *state );
/* Mark all states reachable from state. */ /* Mark all states reachable from state. */
void markReachableFromHere( StateAp *state ); void markReachableFromHere( StateAp *state );
void markReachableFromHereStopFinal( StateAp *state ); void markReachableFromHereStopFinal( StateAp *state );
/* Any transitions to another state? */
bool anyRegularTransitions( StateAp *state );
/* Removes states that cannot be reached by any path in the fsm and are /* Removes states that cannot be reached by any path in the fsm and are
* thus wasted silicon. */ * thus wasted silicon. */
void removeDeadEndStates(); void removeDeadEndStates();
/* Removes states that cannot be reached by any path in the fsm and are /* Removes states that cannot be reached by any path in the fsm and are
* thus wasted silicon. */ * thus wasted silicon. */
long removeUnreachableStates(); long removeUnreachableStates();
/* Remove error actions from states on which the error transition will /* Remove error actions from states on which the error transition will
* never be taken. */ * never be taken. */
 End of changes. 15 change blocks. 
9 lines changed or deleted 39 lines changed or added

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