# along with Ragel; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-INCS +=
+INCS += -I../aapl
DEFS +=
CFLAGS += -g -Wall
#include <fstream>
#include <climits>
+#include "dlist.h"
typedef unsigned long long Size;
char *findFileExtension( char *stemFile );
char *fileNameFromStem( char *stemFile, char *suffix );
+struct Export
+{
+ Export( char *name, Key key )
+ : name(name), key(key) {}
+
+ char *name;
+ Key key;
+
+ Export *prev, *next;
+};
+
+typedef DList<Export> ExportList;
+
#endif /* _COMMON_H */
" Keywords
" FIXME: Enable the range keyword post 5.17.
" syntax keyword rlKeywords machine action context include range contained
-syntax keyword rlKeywords machine action context include contained
+syntax keyword rlKeywords machine action context include export entry contained
syntax keyword rlExprKeywords when err lerr eof from to contained
" Case Labels
syntax region rlWrite matchgroup=Type start="\<write\>" matchgroup=NONE end=";" contained contains=rlWriteKeywords,rlWriteOptions
-syntax keyword rlWriteKeywords init data exec eof contained
+syntax keyword rlWriteKeywords init data exec eof exports contained
syntax keyword rlWriteOptions noerror nofinal noprefix noend contained
"
kelbt -o $@ $<
rlscan.cpp: rlscan.rl
- ragel $< | rlcodegen -G2 -o $@
+ ragel $< | rlgen-cd -G2 -o $@
endif
doRemove( md, state, expList );
expList.empty();
}
+
+/* Check if a machine defines a single character. This is useful in validating
+ * ranges and machines to export. */
+bool FsmAp::checkSingleCharMachine()
+{
+ /* Must have two states. */
+ if ( stateList.length() != 2 )
+ return false;
+ /* The start state cannot be final. */
+ if ( startState->isFinState() )
+ return false;
+ /* There should be only one final state. */
+ if ( finStateSet.length() != 1 )
+ return false;
+ /* The final state cannot have any transitions out. */
+ if ( finStateSet[0]->outList.length() != 0 )
+ return false;
+ /* The start state should have only one transition out. */
+ if ( startState->outList.length() != 1 )
+ return false;
+ /* The singe transition out of the start state should not be a range. */
+ TransAp *startTrans = startState->outList.head;
+ if ( startTrans->lowKey != startTrans->highKey )
+ return false;
+ return true;
+}
+
bool checkErrTrans( StateAp *state, TransAp *trans );
bool checkErrTransFinish( StateAp *state );
bool hasErrorTrans();
+
+ /* Check if a machine defines a single character. This is useful in
+ * validating ranges and machines to export. */
+ bool checkSingleCharMachine( );
};
curActionOrd(0),
curPriorOrd(0),
rootName(0),
+ exportsRootName(0),
nextEpsilonResolvedLink(0),
nextLongestMatchId(1),
lmRequiresErrorState(false)
curNameChild = 0;
}
+void ParseData::initExportsNameWalk()
+{
+ curNameInst = exportsRootName;
+ curNameChild = 0;
+}
+
/* Goes into the next child scope. The number of the child is already set up.
* We need this for the syncronous name tree and parse tree walk to work
* properly. It is reset on entry into a scope and advanced on poping of a
fillNameIndex( *name );
}
-void ParseData::makeRootName()
+void ParseData::makeRootNames()
{
/* Create the root name. */
rootName = new NameInst( InputLoc(), 0, 0, nextNameId++, false );
+ exportsRootName = new NameInst( InputLoc(), 0, 0, nextNameId++, false );
}
/* Build the name tree and supporting data structures. */
void ParseData::makeNameTree( GraphDictEl *dictEl )
{
/* Set up curNameInst for the walk. */
- curNameInst = rootName;
- curNameChild = 0;
+ initNameWalk();
if ( dictEl != 0 ) {
/* A start location has been specified. */
fillNameIndex( rootName );
}
+
void ParseData::createBuiltin( char *name, BuiltinMachine builtin )
{
Expression *expression = new Expression( builtin );
checkAction( act );
}
+void ParseData::makeExportsNameTree()
+{
+ /* Make a name tree for the exports. */
+ initExportsNameWalk();
+
+ /* First make the name tree. */
+ for ( GraphDict::Iter gdel = graphDict; gdel.lte(); gdel++ ) {
+ if ( gdel->value->isExport ) {
+ /* Recurse on the instance. */
+ gdel->value->makeNameTree( gdel->loc, this );
+ }
+ }
+}
+
+void ParseData::makeExports()
+{
+ makeExportsNameTree();
+
+ /* Resove name references in the tree. */
+ initExportsNameWalk();
+ for ( GraphDict::Iter gdel = graphDict; gdel.lte(); gdel++ ) {
+ if ( gdel->value->isExport )
+ gdel->value->resolveNameRefs( this );
+ }
+
+ /* Make all the instantiations, we know that main exists in this list. */
+ initExportsNameWalk();
+ for ( GraphDict::Iter gdel = graphDict; gdel.lte(); gdel++ ) {
+ /* Check if this var def is an export. */
+ if ( gdel->value->isExport ) {
+ /* Build the graph from a walk of the parse tree. */
+ FsmAp *graph = gdel->value->walk( this );
+
+ /* Build the graph from a walk of the parse tree. */
+ if ( !graph->checkSingleCharMachine() ) {
+ error(gdel->loc) << "bad export machine, must define "
+ "a single character" << endl;
+ }
+ else {
+ /* Safe to extract the key and declare the export. */
+ Key exportKey = graph->startState->outList.head->lowKey;
+ exportList.append( new Export( gdel->value->name, exportKey ) );
+ }
+ }
+ }
+
+}
+
void ParseData::prepareMachineGen( GraphDictEl *graphDictEl )
{
beginProcessing();
initKeyOps();
- makeRootName();
+ makeRootNames();
initLongestMatchData();
/* Make the graph, do minimization. */
sectionGraph = makeAll();
else
sectionGraph = makeSpecific( graphDictEl );
+
+ /* Compute exports from the export definitions. */
+ makeExports();
/* If any errors have occured in the input file then don't write anything. */
if ( gblErrorCount > 0 )
/* Make a name id in the current name instantiation scope if it is not
* already there. */
NameInst *addNameInst( const InputLoc &loc, char *data, bool isLabel );
- void makeRootName();
+ void makeRootNames();
void makeNameTree( GraphDictEl *gdNode );
+ void makeExportsNameTree();
void fillNameIndex( NameInst *from );
void printNameTree();
void analyzeAction( Action *action, InlineList *inlineList );
void analyzeGraph( FsmAp *graph );
+ void makeExports();
void prepareMachineGen( GraphDictEl *graphDictEl );
void generateXML( ostream &out );
int curActionOrd;
int curPriorOrd;
- /* Root of the name tree. */
+ /* Root of the name tree. One root is for the instantiated machines. The
+ * other root is for exported definitions. */
NameInst *rootName;
+ NameInst *exportsRootName;
+
+ /* Name tree walking. */
NameInst *curNameInst;
int curNameChild;
void initLongestMatchData();
void setLongestMatchData( FsmAp *graph );
void initNameWalk();
+ void initExportsNameWalk();
NameInst *nextNameScope() { return curNameInst->childVect[curNameChild]; }
NameFrame enterNameScope( bool isLocal, int numScopes );
void popNameScope( const NameFrame &frame );
CondData thisCondData;
KeyOps thisKeyOps;
+
+ ExportList exportList;
};
void afterOpMinimize( FsmAp *fsm, bool lastInSeq = true );
* the graph. */
if ( pd->curNameInst->numRefs > 0 )
rtnVal->setEntry( pd->curNameInst->id, rtnVal->startState );
-
+
/* Pop the name scope. */
pd->popNameScope( nameFrame );
return rtnVal;
delete upperLit;
}
-bool Range::verifyRangeFsm( FsmAp *rangeEnd )
-{
- /* Must have two states. */
- if ( rangeEnd->stateList.length() != 2 )
- return false;
- /* The start state cannot be final. */
- if ( rangeEnd->startState->isFinState() )
- return false;
- /* There should be only one final state. */
- if ( rangeEnd->finStateSet.length() != 1 )
- return false;
- /* The final state cannot have any transitions out. */
- if ( rangeEnd->finStateSet[0]->outList.length() != 0 )
- return false;
- /* The start state should have only one transition out. */
- if ( rangeEnd->startState->outList.length() != 1 )
- return false;
- /* The singe transition out of the start state should not be a range. */
- TransAp *startTrans = rangeEnd->startState->outList.head;
- if ( startTrans->lowKey != startTrans->highKey )
- return false;
- return true;
-}
-
/* Evaluate a range. Gets the lower an upper key and makes an fsm range. */
FsmAp *Range::walk( ParseData *pd )
{
/* Construct and verify the suitability of the lower end of the range. */
FsmAp *lowerFsm = lowerLit->walk( pd );
- if ( !verifyRangeFsm( lowerFsm ) ) {
+ if ( !lowerFsm->checkSingleCharMachine() ) {
error(lowerLit->token.loc) <<
"bad range lower end, must be a single character" << endl;
}
/* Construct and verify the upper end. */
FsmAp *upperFsm = upperLit->walk( pd );
- if ( !verifyRangeFsm( upperFsm ) ) {
+ if ( !upperFsm->checkSingleCharMachine() ) {
error(upperLit->token.loc) <<
"bad range upper end, must be a single character" << endl;
}
char *name;
JoinOrLm *joinOrLm;
+
+ bool isExport;
+ bool isEntry;
};
~Range();
FsmAp *walk( ParseData *pd );
- bool verifyRangeFsm( FsmAp *rangeEnd );
Literal *lowerLit;
Literal *upperLit;
# Keywords.
token KW_Action, KW_AlphType, KW_Range, KW_GetKey, KW_Include, KW_Write,
- KW_Machine, KW_When, KW_Eof, KW_Err, KW_Lerr, KW_To, KW_From;
+ KW_Machine, KW_When, KW_Eof, KW_Err, KW_Lerr, KW_To, KW_From,
+ KW_Export, KW_Entry;
# Specials in code blocks.
token KW_Break, KW_Exec, KW_Hold, KW_PChar, KW_Char, KW_Goto, KW_Call,
: sectionName(sectionName)
{
pd = new ParseData( fileName, sectionName, sectionLoc );
+ exportContext.append( false );
+ entryContext.append( false );
}
int token( InputLoc &loc, int tokId, char *tokstart, int toklen );
NameRef nameRef;
NameRefList nameRefList;
+
+ Vector<bool> exportContext;
+ Vector<bool> entryContext;
};
%% write token_defs;
statement: getkey_spec commit;
statement: access_spec commit;
statement: variable_spec commit;
+statement: export_block commit;
+statement: entry_block commit;
+
+export_open: KW_Export
+ final {
+ exportContext.append( true );
+ };
+
+nonterm opt_export
+{
+ bool isSet;
+};
+
+opt_export: export_open final { $$->isSet = true; };
+opt_export: final { $$->isSet = false; };
+
+export_block: export_open '{' statement_list '}'
+ final {
+ exportContext.remove( exportContext.length()-1 );
+ };
+
+nonterm opt_entry
+{
+ bool isSet;
+};
+
+entry_open: KW_Entry
+ final {
+ entryContext.append( true );
+ };
+
+opt_entry: entry_open final { $$->isSet = true; };
+opt_entry: final { $$->isSet = false; };
+
+entry_block: entry_open '{' statement_list '}'
+ final {
+ entryContext.remove( entryContext.length()-1 );
+ };
assignment:
- machine_name '=' join ';' final {
+ opt_export opt_entry machine_name '=' join ';' final {
/* Main machine must be an instance. */
bool isInstance = false;
- if ( strcmp($1->token.data, machineMain) == 0 ) {
- warning($1->token.loc) <<
+ if ( strcmp($3->token.data, machineMain) == 0 ) {
+ warning($3->token.loc) <<
"main machine will be implicitly instantiated" << endl;
isInstance = true;
}
/* Generic creation of machine for instantiation and assignment. */
- JoinOrLm *joinOrLm = new JoinOrLm( $3->join );
- tryMachineDef( $1->token.loc, $1->token.data, joinOrLm, isInstance );
+ JoinOrLm *joinOrLm = new JoinOrLm( $5->join );
+ tryMachineDef( $3->token.loc, $3->token.data, joinOrLm, isInstance );
+
+ if ( $1->isSet )
+ exportContext.remove( exportContext.length()-1 );
+ if ( $2->isSet )
+ entryContext.remove( entryContext.length()-1 );
};
instantiation:
- machine_name TK_ColonEquals join_or_lm ';' final {
+ opt_export opt_entry machine_name TK_ColonEquals join_or_lm ';' final {
/* Generic creation of machine for instantiation and assignment. */
- tryMachineDef( $1->token.loc, $1->token.data, $3->joinOrLm, true );
+ tryMachineDef( $3->token.loc, $3->token.data, $5->joinOrLm, true );
+
+ if ( $1->isSet )
+ exportContext.remove( exportContext.length()-1 );
+ if ( $2->isSet )
+ entryContext.remove( entryContext.length()-1 );
};
type token_type
newEl->value = new VarDef( name, joinOrLm );
newEl->isInstance = isInstance;
newEl->loc = loc;
+ newEl->value->isExport = exportContext[exportContext.length()-1];
+ newEl->value->isEntry = entryContext[entryContext.length()-1];
/* It it is an instance, put on the instance list. */
if ( isInstance )
line(1), column(1), lastnl(0),
parser(0), ignoreSection(false),
parserExistsError(false),
- whitespaceOn(true)
+ whitespaceOn(true),
+ lastToken(0)
{}
bool recursiveInclude( char *inclFileName, char *inclSectionName );
/* This is for inline code. By default it is on. It goes off for
* statements and values in inline blocks which are parsed. */
bool whitespaceOn;
+
+ /* Keeps a record of the previous token sent to the section parser. */
+ int lastToken;
};
%%{
}%%
updateCol();
+
+ /* Record the last token for use in controlling the scan of subsequent
+ * tokens. */
+ lastToken = type;
}
void Scanner::startSection( )
'lerr' => { token( KW_Lerr ); };
'to' => { token( KW_To ); };
'from' => { token( KW_From ); };
+ 'export' => { token( KW_Export ); };
+ 'entry' => { token( KW_Entry ); };
# Identifiers.
ident => { token( TK_Word, tokstart, tokend ); } ;
};
'{' => {
- token( '{' );
- curly_count = 1;
- inlineBlockType = CurlyDelimited;
- fgoto inline_code;
+ if ( lastToken == KW_Export || lastToken == KW_Entry )
+ token( '{' );
+ else {
+ token( '{' );
+ curly_count = 1;
+ inlineBlockType = CurlyDelimited;
+ fgoto inline_code;
+ }
};
EOF => {
}
}
+void XMLCodeGen::writeExports()
+{
+ if ( pd->exportList.length() > 0 ) {
+ out << " <exports>\n";
+ for ( ExportList::Iter exp = pd->exportList; exp.lte(); exp++ ) {
+ out << " <ex name=\"" << exp->name << "\">";
+ writeKey( exp->key );
+ out << "</ex>\n";
+ }
+ out << " </exports>\n";
+ }
+}
+
void XMLCodeGen::writeXML()
{
/* Open the definition. */
if ( pd->curStateExpr != 0 )
writeCurStateExpr();
+ writeExports();
+
writeMachine();
out <<
void writeLmOnNext( InlineItem *item );
void writeLmOnLagBehind( InlineItem *item );
+ void writeExports();
void writeEntryPoints();
void writeGetKeyExpr();
void writeAccessExpr();
kelbt -o $@ $<
xmlscan.cpp: xmlscan.rl
- ragel xmlscan.rl | rlcodegen -G2 -o xmlscan.cpp
+ ragel xmlscan.rl | rlgen-cd -G2 -o xmlscan.cpp
xmltags.cpp: xmltags.gperf
gperf -L C++ -t $< > $@
endif
clean:
- rm -f tags .*.d *.o rlcodegen $(EXTRA_CLEAN)
+ rm -f tags .*.d *.o rlgen-cd $(EXTRA_CLEAN)
install:
@true
args[i] << "\"" << endl;
}
}
- writeOutData();
+ writeData();
}
else if ( strcmp( args[0], "init" ) == 0 ) {
for ( int i = 1; i < nargs; i++ ) {
source_warning(loc) << "unrecognized write option \"" <<
args[i] << "\"" << endl;
}
- writeOutInit();
+ writeInit();
}
else if ( strcmp( args[0], "exec" ) == 0 ) {
for ( int i = 1; i < nargs; i++ ) {
args[i] << "\"" << endl;
}
}
- writeOutExec();
+ writeExec();
}
else if ( strcmp( args[0], "eof" ) == 0 ) {
for ( int i = 1; i < nargs; i++ ) {
source_warning(loc) << "unrecognized write option \"" <<
args[i] << "\"" << endl;
}
- writeOutEOF();
+ writeEOF();
+ }
+ else if ( strcmp( args[0], "exports" ) == 0 ) {
+ for ( int i = 1; i < nargs; i++ ) {
+ source_warning(loc) << "unrecognized write option \"" <<
+ args[i] << "\"" << endl;
+ }
+ writeExports();
}
else {
/* EMIT An error here. */
virtual void finishRagelDef() {}
/* These are invoked by the corresponding write statements. */
- virtual void writeOutData() {};
- virtual void writeOutInit() {};
- virtual void writeOutExec() {};
- virtual void writeOutEOF() {};
+ virtual void writeData() {};
+ virtual void writeInit() {};
+ virtual void writeExec() {};
+ virtual void writeEOF() {};
+ virtual void writeExports() {};
/* This can also be overwridden to modify the processing of write
* statements. */
EntryNameVect entryPointNames;
bool hasLongestMatch;
int codeGenErrCount;
+ ExportList exportList;
/* Write options. */
bool hasEnd;
TAG_error_state, TAG_action_list, TAG_action_table_list,
TAG_action, TAG_action_table, TAG_alphtype, TAG_element,
TAG_getkey, TAG_state_actions, TAG_entry_points, TAG_sub_action,
- TAG_cond_space_list, TAG_cond_space, TAG_cond_list, TAG_c;
+ TAG_cond_space_list, TAG_cond_space, TAG_cond_list, TAG_c,
+ TAG_exports, TAG_ex;
# Inline block tokens.
token TAG_text, TAG_goto, TAG_call, TAG_next, TAG_goto_expr,
ragel_def_item: tag_getkey_expr;
ragel_def_item: tag_access_expr;
ragel_def_item: tag_curstate_expr;
+ragel_def_item: tag_export_list;
ragel_def_item: tag_machine;
+tag_export_list: TAG_exports export_list '/' TAG_exports;
+
+export_list: export_list tag_export;
+export_list: ;
+
+tag_export: TAG_ex '/' TAG_ex
+ final {
+ Attribute *nameAttr = $1->tag->findAttr( "name" );
+ if ( nameAttr == 0 )
+ error($1->loc) << "tag <ex> requires a name attribute" << endl;
+ else {
+ char *td = $3->tag->content;
+ Key exportKey = readKey( td, &td );
+ cgd->exportList.append( new Export( nameAttr->value, exportKey ) );
+ }
+ };
+
tag_alph_type: TAG_alphtype '/' TAG_alphtype
final {
if ( ! cgd->setAlphType( $3->tag->content ) )
case TAG_set_act: case TAG_start_state:
case TAG_error_state: case TAG_state_actions:
case TAG_action_table: case TAG_cond_space:
- case TAG_c:
+ case TAG_c: case TAG_ex:
tag->content = new char[scanner.buffer.length+1];
memcpy( tag->content, scanner.buffer.data,
scanner.buffer.length );
cond_space, TAG_cond_space
cond_list, TAG_cond_list
c, TAG_c
+exports, TAG_exports
+ex, TAG_ex
return out;
}
-void FFlatCodeGen::writeOutData()
+void FFlatCodeGen::writeData()
{
if ( redFsm->anyConditions() ) {
OPEN_ARRAY( WIDE_ALPH_TYPE(), CK() );
}
}
-void FFlatCodeGen::writeOutExec()
+void FFlatCodeGen::writeExec()
{
outLabelUsed = false;
out << " }\n";
}
-void FFlatCodeGen::writeOutEOF()
+void FFlatCodeGen::writeEOF()
{
if ( redFsm->anyEofActions() ) {
out <<
virtual std::ostream &EOF_ACTION( RedStateAp *state );
virtual std::ostream &TRANS_ACTION( RedTransAp *trans );
- virtual void writeOutData();
- virtual void writeOutEOF();
- virtual void writeOutExec();
+ virtual void writeData();
+ virtual void writeEOF();
+ virtual void writeExec();
};
/*
return act;
}
-void FGotoCodeGen::writeOutData()
+void FGotoCodeGen::writeData()
{
out <<
"static const int " << START() << " = " << START_STATE_ID() << ";\n"
}
}
-void FGotoCodeGen::writeOutExec()
+void FGotoCodeGen::writeExec()
{
outLabelUsed = false;
out << " }\n";
}
-void FGotoCodeGen::writeOutEOF()
+void FGotoCodeGen::writeEOF()
{
if ( redFsm->anyEofActions() ) {
out <<
unsigned int FROM_STATE_ACTION( RedStateAp *state );
unsigned int EOF_ACTION( RedStateAp *state );
- virtual void writeOutData();
- virtual void writeOutEOF();
- virtual void writeOutExec();
+ virtual void writeData();
+ virtual void writeEOF();
+ virtual void writeExec();
};
/*
ret << CTRL_FLOW() << "goto _out;";
}
-void FlatCodeGen::writeOutData()
+void FlatCodeGen::writeData()
{
/* If there are any transtion functions then output the array. If there
* are none, don't bother emitting an empty array that won't be used. */
" }\n";
}
-void FlatCodeGen::writeOutExec()
+void FlatCodeGen::writeExec()
{
outLabelUsed = false;
out << " }\n";
}
-void FlatCodeGen::writeOutEOF()
+void FlatCodeGen::writeEOF()
{
if ( redFsm->anyEofActions() ) {
out <<
virtual std::ostream &EOF_ACTION( RedStateAp *state );
virtual std::ostream &TRANS_ACTION( RedTransAp *trans );
- virtual void writeOutData();
- virtual void writeOutEOF();
- virtual void writeOutExec();
+ virtual void writeData();
+ virtual void writeEOF();
+ virtual void writeExec();
};
/*
return ret.str();
}
-void FsmCodeGen::writeOutInit()
+void FsmCodeGen::writeInit()
{
out << " {\n";
out << "\t" << CS() << " = " << START() << ";\n";
return ret;
}
+void FsmCodeGen::writeExports()
+{
+ if ( exportList.length() > 0 ) {
+ for ( ExportList::Iter ex = exportList; ex.lte(); ex++ ) {
+ out << "#define " << DATA_PREFIX() << ex->name << " " <<
+ KEY(ex->key) << "\n";
+ }
+ out << "\n";
+ }
+}
+
/*
* Language specific, but style independent code generators functions.
virtual ~FsmCodeGen() {}
virtual void finishRagelDef();
- virtual void writeOutInit();
+ virtual void writeInit();
+ virtual void writeExports();
protected:
string FSM_NAME();
return out;
}
-void FTabCodeGen::writeOutData()
+void FTabCodeGen::writeData()
{
if ( redFsm->anyConditions() ) {
OPEN_ARRAY( ARRAY_TYPE(redFsm->maxCondOffset), CO() );
}
}
-void FTabCodeGen::writeOutExec()
+void FTabCodeGen::writeExec()
{
outLabelUsed = false;
}
-void FTabCodeGen::writeOutEOF()
+void FTabCodeGen::writeEOF()
{
if ( redFsm->anyEofActions() ) {
out <<
virtual std::ostream &FROM_STATE_ACTION( RedStateAp *state );
virtual std::ostream &EOF_ACTION( RedStateAp *state );
virtual std::ostream &TRANS_ACTION( RedTransAp *trans );
- virtual void writeOutData();
- virtual void writeOutEOF();
- virtual void writeOutExec();
+ virtual void writeData();
+ virtual void writeEOF();
+ virtual void writeExec();
virtual void calcIndexSize();
};
ret << CTRL_FLOW() << "goto _out;";
}
-void GotoCodeGen::writeOutData()
+void GotoCodeGen::writeData()
{
out <<
"static const int " << START() << " = " << START_STATE_ID() << ";\n"
}
}
-void GotoCodeGen::writeOutExec()
+void GotoCodeGen::writeExec()
{
outLabelUsed = false;
out << " }\n";
}
-void GotoCodeGen::writeOutEOF()
+void GotoCodeGen::writeEOF()
{
if ( redFsm->anyEofActions() ) {
out <<
virtual void GOTO_HEADER( RedStateAp *state );
virtual void STATE_GOTO_ERROR();
- virtual void writeOutData();
- virtual void writeOutEOF();
- virtual void writeOutExec();
+ virtual void writeData();
+ virtual void writeEOF();
+ virtual void writeExec();
};
/*
}
}
-void IpGotoCodeGen::writeOutData()
+void IpGotoCodeGen::writeData()
{
out <<
"static const int " << START() << " = " << START_STATE_ID() << ";\n"
}
}
-void IpGotoCodeGen::writeOutExec()
+void IpGotoCodeGen::writeExec()
{
/* Must set labels immediately before writing because we may depend on the
* noend write option. */
" }\n";
}
-void IpGotoCodeGen::writeOutEOF()
+void IpGotoCodeGen::writeEOF()
{
if ( redFsm->anyEofActions() ) {
out <<
void TARGS( ostream &ret, bool inFinish, int targState );
void BREAK( ostream &ret, int targState );
- virtual void writeOutData();
- virtual void writeOutEOF();
- virtual void writeOutExec();
+ virtual void writeData();
+ virtual void writeEOF();
+ virtual void writeExec();
protected:
bool useAgainLabel();
/*
- * Copyright 2001-2005 Adrian Thurston <thurston@cs.queensu.ca>
+ * Copyright 2001-2007 Adrian Thurston <thurston@cs.queensu.ca>
*/
/* This file is part of Ragel.
return out;
}
-void SplitCodeGen::writeOutData()
+void SplitCodeGen::writeData()
{
out <<
"static const int " << START() << " = " << START_STATE_ID() << ";\n"
}
-void SplitCodeGen::writeOutExec()
+void SplitCodeGen::writeExec()
{
/* Must set labels immediately before writing because we may depend on the
* noend write option. */
std::ostream &STATE_GOTOS( int partition );
std::ostream &PARTITION( int partition );
std::ostream &ALL_PARTITIONS();
- void writeOutData();
- void writeOutExec();
- void writeOutParts();
+ void writeData();
+ void writeExec();
+ void writeParts();
void setLabelsNeeded( RedStateAp *fromState, InlineList *inlineList );
void setLabelsNeeded( RedStateAp *fromState, RedTransAp *trans );
ret << CTRL_FLOW() << "goto _out;";
}
-void TabCodeGen::writeOutData()
+void TabCodeGen::writeData()
{
/* If there are any transtion functions then output the array. If there
* are none, don't bother emitting an empty array that won't be used. */
"\n";
}
-void TabCodeGen::writeOutExec()
+void TabCodeGen::writeExec()
{
outLabelUsed = false;
}
-void TabCodeGen::writeOutEOF()
+void TabCodeGen::writeEOF()
{
if ( redFsm->anyEofActions() ) {
out <<
public:
TabCodeGen( ostream &out ) : FsmCodeGen(out) {}
virtual ~TabCodeGen() { }
- virtual void writeOutData();
- virtual void writeOutExec();
+ virtual void writeData();
+ virtual void writeExec();
protected:
std::ostream &TO_STATE_ACTION_SWITCH();
virtual std::ostream &EOF_ACTION( RedStateAp *state );
virtual std::ostream &TRANS_ACTION( RedTransAp *trans );
virtual void calcIndexSize();
- virtual void writeOutEOF();
+ virtual void writeEOF();
};