fsmcond.cc (ragel-7.0.0.9) | : | fsmcond.cc (ragel-7.0.0.10) | ||
---|---|---|---|---|
/* | /* | |||
* Copyright 2001, 2002, 2006, 2011 Adrian Thurston <thurston@complang.org> | * Copyright 2001, 2002, 2006, 2011 Adrian Thurston <thurston@colm.net> | |||
*/ | ||||
/* This file is part of Ragel. | ||||
* | * | |||
* Ragel is free software; you can redistribute it and/or modify | * Permission is hereby granted, free of charge, to any person obtaining a copy | |||
* it under the terms of the GNU General Public License as published by | * of this software and associated documentation files (the "Software"), to | |||
* the Free Software Foundation; either version 2 of the License, or | * deal in the Software without restriction, including without limitation the | |||
* (at your option) any later version. | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | |||
* sell copies of the Software, and to permit persons to whom the Software is | ||||
* furnished to do so, subject to the following conditions: | ||||
* | * | |||
* Ragel is distributed in the hope that it will be useful, | * The above copyright notice and this permission notice shall be included in al | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | l | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | * copies or substantial portions of the Software. | |||
* GNU General Public License for more details. | ||||
* | * | |||
* You should have received a copy of the GNU General Public License | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |||
* along with Ragel; if not, write to the Free Software | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||||
* SOFTWARE. | ||||
*/ | */ | |||
/* | /* | |||
* Setting conditions and merging states with conditions are similar activities | * Setting conditions and merging states with conditions are similar activities | |||
* when expressed in code. The critical difference is that a merge is a union | * when expressed in code. The critical difference is that a merge is a union | |||
* of multiple paths. We have to take both paths. Setting a condition, however, | * of multiple paths. We have to take both paths. Setting a condition, however, | |||
* is a restriction. We have to expand the transition to follow both values of | * is a restriction. We have to expand the transition to follow both values of | |||
* the condition, then remove the one that is not set. | * the condition, then remove the one that is not set. | |||
*/ | */ | |||
skipping to change at line 262 | skipping to change at line 263 | |||
CondSpace *FsmAp::addCondSpace( const CondSet &condSet ) | CondSpace *FsmAp::addCondSpace( const CondSet &condSet ) | |||
{ | { | |||
CondSpace *condSpace = ctx->condData->condSpaceMap.find( condSet ); | CondSpace *condSpace = ctx->condData->condSpaceMap.find( condSet ); | |||
if ( condSpace == 0 ) { | if ( condSpace == 0 ) { | |||
condSpace = new CondSpace( condSet ); | condSpace = new CondSpace( condSet ); | |||
ctx->condData->condSpaceMap.insert( condSpace ); | ctx->condData->condSpaceMap.insert( condSpace ); | |||
} | } | |||
return condSpace; | return condSpace; | |||
} | } | |||
TransDataAp *FsmAp::convertToTransAp( StateAp *from, CondAp *cond ) | ||||
{ | ||||
TransDataAp *newTrans = new TransDataAp(); | ||||
newTrans->lowKey = cond->transAp->lowKey; | ||||
newTrans->highKey = cond->transAp->highKey; | ||||
newTrans->lmActionTable.setActions( cond->lmActionTable ); | ||||
newTrans->actionTable.setActions( cond->actionTable ); | ||||
newTrans->priorTable.setPriors( cond->priorTable ); | ||||
attachTrans( from, cond->toState, newTrans ); | ||||
/* Detach in list. */ | ||||
detachTrans( from, cond->toState, cond ); | ||||
delete cond->transAp; | ||||
delete cond; | ||||
return newTrans; | ||||
} | ||||
TransCondAp *FsmAp::convertToCondAp( StateAp *from, TransDataAp *trans ) | TransCondAp *FsmAp::convertToCondAp( StateAp *from, TransDataAp *trans ) | |||
{ | { | |||
TransCondAp *newTrans = new TransCondAp(); | TransCondAp *newTrans = new TransCondAp(); | |||
newTrans->lowKey = trans->lowKey; | newTrans->lowKey = trans->lowKey; | |||
newTrans->highKey = trans->highKey; | newTrans->highKey = trans->highKey; | |||
newTrans->condSpace = trans->condSpace; | newTrans->condSpace = trans->condSpace; | |||
CondAp *newCond = new CondAp( newTrans ); | CondAp *newCond = new CondAp( newTrans ); | |||
newCond->key = 0; | newCond->key = 0; | |||
newTrans->condList.append( newCond ); | newTrans->condList.append( newCond ); | |||
End of changes. 5 change blocks. | ||||
15 lines changed or deleted | 37 lines changed or added |