"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/gendata.cc" between
ragel-7.0.0.9.tar.gz and ragel-7.0.0.10.tar.gz

About:

gendata.cc  (ragel-7.0.0.9):gendata.cc  (ragel-7.0.0.10)
/* /*
* Copyright 2005-2007 Adrian Thurston <thurston@complang.org> * Copyright 2005-2007 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.
*/ */
#include "gendata.h" #include "gendata.h"
#include "ragel.h" #include "ragel.h"
#include "parsedata.h" #include "parsedata.h"
#include "fsmgraph.h" #include "fsmgraph.h"
#include "inputdata.h" #include "inputdata.h"
#include "version.h" #include "version.h"
#include <string.h> #include <string.h>
skipping to change at line 1104 skipping to change at line 1105
if ( item->children != 0 ) if ( item->children != 0 )
resolveTargetStates( item->children ); resolveTargetStates( item->children );
} }
} }
void Reducer::resolveTargetStates() void Reducer::resolveTargetStates()
{ {
for ( GenActionList::Iter a = actionList; a.lte(); a++ ) for ( GenActionList::Iter a = actionList; a.lte(); a++ )
resolveTargetStates( a->inlineList ); resolveTargetStates( a->inlineList );
#if 0
for ( RedStateList::Iter st = redFsm->stateList; st.lte(); st++ )
{
if ( st->eofAction != 0 ) {
for ( GenActionTable::Iter item = st->eofAction->
key; item.lte(); item++ )
setLabelsNeeded( item->value->inlineList
);
}
if ( st->eofTrans != 0 ) {
long condsFullSize = st->eofTrans->condFullSize()
;
for ( int c = 0; c < condsFullSize; c++ ) {
RedCondPair *pair = st->eofTrans->outCond
( c );
setLabelsNeeded( pair );
}
}
#endif
} }
bool Reducer::setAlphType( const HostLang *hostLang, const char *data ) bool Reducer::setAlphType( const HostLang *hostLang, const char *data )
{ {
HostType *alphType = findAlphTypeInternal( hostLang, data ); HostType *alphType = findAlphTypeInternal( hostLang, data );
if ( alphType == 0 ) if ( alphType == 0 )
return false; return false;
return true; return true;
} }
skipping to change at line 1254 skipping to change at line 1271
else if ( item->type == GenInlineItem::Ret ) else if ( item->type == GenInlineItem::Ret )
redFsm->bAnyActionRets = true; redFsm->bAnyActionRets = true;
else if ( item->type == GenInlineItem::Nret ) else if ( item->type == GenInlineItem::Nret )
redFsm->bAnyActionNrets = true; redFsm->bAnyActionNrets = true;
else if ( item->type == GenInlineItem::LmInitAct || else if ( item->type == GenInlineItem::LmInitAct ||
item->type == GenInlineItem::LmSetActId | | item->type == GenInlineItem::LmSetActId | |
item->type == GenInlineItem::LmSwitch ) item->type == GenInlineItem::LmSwitch )
{ {
redFsm->bUsingAct = true; redFsm->bUsingAct = true;
} }
/* Any by value control in all actions? */
if ( item->type == GenInlineItem::CallExpr || item->type
== GenInlineItem::GotoExpr )
redFsm->bAnyActionByValControl = true;
} }
/* Check for various things in regular actions. */ /* Check for various things in regular actions. */
if ( act->numTransRefs > 0 || act->numToStateRefs > 0 || act->num FromStateRefs > 0 ) { if ( act->numTransRefs > 0 || act->numToStateRefs > 0 || act->num FromStateRefs > 0 ) {
/* Any returns in regular actions? */ /* Any returns in regular actions? */
if ( item->type == GenInlineItem::Ret || item->type == Ge nInlineItem::Nret ) if ( item->type == GenInlineItem::Ret || item->type == Ge nInlineItem::Nret )
redFsm->bAnyRegActionRets = true; redFsm->bAnyRegActionRets = true;
/* Any next statements in the regular actions? */ /* Any next statements in the regular actions? */
if ( item->type == GenInlineItem::Next || item->type == G enInlineItem::NextExpr || if ( item->type == GenInlineItem::Next || item->type == G enInlineItem::NextExpr ||
skipping to change at line 1506 skipping to change at line 1527
/* Set the maximums of various values used for deciding types. */ /* Set the maximums of various values used for deciding types. */
setValueLimits(); setValueLimits();
} }
void CodeGenData::write_option_error( InputLoc &loc, std::string arg ) void CodeGenData::write_option_error( InputLoc &loc, std::string arg )
{ {
red->id->warning(loc) << "unrecognized write option \"" << arg << "\"" << std::endl; red->id->warning(loc) << "unrecognized write option \"" << arg << "\"" << std::endl;
} }
void CodeGenData::writeClear()
{
clear();
/* Delete all the nodes in the action list. Will cause all the
* string data that represents the actions to be deallocated. */
red->fsm->ctx->actionList.empty();
delete red->fsm;
red->fsm = 0;
// red->pd->graphDict.empty();
cleared = true;
}
void CodeGenData::writeStatement( InputLoc &loc, int nargs, void CodeGenData::writeStatement( InputLoc &loc, int nargs,
std::vector<std::string> &args, bool generateDot, const HostLang *hostLang ) std::vector<std::string> &args, bool generateDot, const HostLang *hostLang )
{ {
/* Start write generation on a fresh line. */ /* Start write generation on a fresh line. */
out << '\n'; out << '\n';
if ( cleared ) {
red->id->error(loc) << "write statement following a clear is inva
lid" << std::endl;
return;
}
if ( args[0] == "data" ) { if ( args[0] == "data" ) {
for ( int i = 1; i < nargs; i++ ) { for ( int i = 1; i < nargs; i++ ) {
if ( args[i] == "noerror" ) if ( args[i] == "noerror" )
noError = true; noError = true;
else if ( args[i] == "noprefix" ) else if ( args[i] == "noprefix" )
noPrefix = true; noPrefix = true;
else if ( args[i] == "nofinal" ) else if ( args[i] == "nofinal" )
noFinal = true; noFinal = true;
else else
write_option_error( loc, args[i] ); write_option_error( loc, args[i] );
skipping to change at line 1570 skipping to change at line 1612
else if ( args[0] == "first_final" ) { else if ( args[0] == "first_final" ) {
for ( int i = 1; i < nargs; i++ ) for ( int i = 1; i < nargs; i++ )
write_option_error( loc, args[i] ); write_option_error( loc, args[i] );
writeFirstFinal(); writeFirstFinal();
} }
else if ( args[0] == "error" ) { else if ( args[0] == "error" ) {
for ( int i = 1; i < nargs; i++ ) for ( int i = 1; i < nargs; i++ )
write_option_error( loc, args[i] ); write_option_error( loc, args[i] );
writeError(); writeError();
} }
else if ( args[0] == "clear" ) {
for ( int i = 1; i < nargs; i++ )
write_option_error( loc, args[i] );
writeClear();
}
else { else {
/* EMIT An error here. */ /* EMIT An error here. */
red->id->error(loc) << "unrecognized write command \"" << red->id->error(loc) << "unrecognized write command \"" <<
args[0] << "\"" << std::endl; args[0] << "\"" << std::endl;
} }
} }
 End of changes. 9 change blocks. 
15 lines changed or deleted 70 lines changed or added

Home  |  About  |  All  |  Newest  |  Fossies Dox  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTPS