"\n";
}
- out <<
- "static const int " << START() << " = " << START_STATE_ID() << ";\n"
- "\n";
-
- if ( writeFirstFinal ) {
- out <<
- "static const int " << FIRST_FINAL() << " = " << FIRST_FINAL_STATE() << ";\n"
- "\n";
- }
-
- if ( writeErr ) {
- out <<
- "static const int " << ERROR() << " = " << ERROR_STATE() << ";\n"
- "\n";
- }
+ STATE_IDS();
}
void FFlatCodeGen::writeExec()
void FGotoCodeGen::writeData()
{
- out <<
- "static const int " << START() << " = " << START_STATE_ID() << ";\n"
- "\n";
-
- if ( writeFirstFinal ) {
- out <<
- "static const int " << FIRST_FINAL() << " = " << FIRST_FINAL_STATE() << ";\n"
- "\n";
- }
-
- if ( writeErr ) {
- out <<
- "static const int " << ERROR() << " = " << ERROR_STATE() << ";\n"
- "\n";
- }
-
if ( redFsm->anyToStateActions() ) {
OPEN_ARRAY( ARRAY_TYPE(redFsm->maxActionLoc), TSA() );
TO_STATE_ACTIONS();
CLOSE_ARRAY() <<
"\n";
}
+
+ STATE_IDS();
}
void FGotoCodeGen::writeExec()
"\n";
}
- out <<
- "static const int " << START() << " = " << START_STATE_ID() << ";\n"
- "\n";
-
- if ( writeFirstFinal ) {
- out <<
- "static const int " << FIRST_FINAL() << " = " << FIRST_FINAL_STATE() << ";\n"
- "\n";
- }
-
- if ( writeErr ) {
- out <<
- "static const int " << ERROR() << " = " << ERROR_STATE() << ";\n"
- "\n";
- }
+ STATE_IDS();
}
void FlatCodeGen::COND_TRANSLATE()
return ret;
}
-void FsmCodeGen::ENTRY_POINTS()
+void FsmCodeGen::STATE_IDS()
{
- for ( EntryNameVect::Iter en = entryPointNames; en.lte(); en++ ) {
- STATIC_VAR( "int", DATA_PREFIX() + "en_" + *en ) <<
- " = " << entryPointIds[en.pos()] << ";\n";
- }
+ STATIC_VAR( "int", START() ) << " = " << START_STATE_ID() << ";\n";
+
+ if ( writeFirstFinal )
+ STATIC_VAR( "int" , FIRST_FINAL() ) << " = " << FIRST_FINAL_STATE() << ";\n";
+
+ if ( writeErr )
+ STATIC_VAR( "int", ERROR() ) << " = " << ERROR_STATE() << ";\n";
+
out << "\n";
+
+ if ( entryPointNames.length() > 0 ) {
+ for ( EntryNameVect::Iter en = entryPointNames; en.lte(); en++ ) {
+ STATIC_VAR( "int", DATA_PREFIX() + "en_" + *en ) <<
+ " = " << entryPointIds[en.pos()] << ";\n";
+ }
+ out << "\n";
+ }
}
void FsmCodeGen::writeExports()
void GET_TOKEND( ostream &ret, InlineItem *item );
void SUB_ACTION( ostream &ret, InlineItem *item,
int targState, bool inFinish );
- void ENTRY_POINTS();
+ void STATE_IDS();
string ERROR_STATE();
string FIRST_FINAL_STATE();
"\n";
}
- out <<
- "static const int " << START() << " = " << START_STATE_ID() << ";\n"
- "\n";
-
- if ( writeFirstFinal ) {
- out <<
- "static const int " << FIRST_FINAL() << " = " << FIRST_FINAL_STATE() << ";\n"
- "\n";
- }
-
- if ( writeErr ) {
- out <<
- "static const int " << ERROR() << " = " << ERROR_STATE() << ";\n"
- "\n";
- }
+ STATE_IDS();
}
void FTabCodeGen::writeExec()
void GotoCodeGen::writeData()
{
- out <<
- "static const int " << START() << " = " << START_STATE_ID() << ";\n"
- "\n";
-
- if ( writeFirstFinal ) {
- out <<
- "static const int " << FIRST_FINAL() << " = " << FIRST_FINAL_STATE() << ";\n"
- "\n";
- }
-
- if ( writeErr ) {
- out <<
- "static const int " << ERROR() << " = " << ERROR_STATE() << ";\n"
- "\n";
- }
-
if ( redFsm->anyActions() ) {
OPEN_ARRAY( ARRAY_TYPE(redFsm->maxActArrItem), A() );
ACTIONS_ARRAY();
CLOSE_ARRAY() <<
"\n";
}
+
+ STATE_IDS();
}
void GotoCodeGen::writeExec()
void IpGotoCodeGen::writeData()
{
- out <<
- "static const int " << START() << " = " << START_STATE_ID() << ";\n"
- "\n";
-
- if ( writeFirstFinal ) {
- out <<
- "static const int " << FIRST_FINAL() << " = " << FIRST_FINAL_STATE() << ";\n"
- "\n";
- }
-
- if ( writeErr ) {
- out <<
- "static const int " << ERROR() << " = " << ERROR_STATE() << ";\n"
- "\n";
- }
+ STATE_IDS();
}
void IpGotoCodeGen::writeExec()
"\n";
}
- STATIC_VAR( "int", START() ) << " = " << START_STATE_ID() << ";\n"
- "\n";
-
- if ( writeFirstFinal ) {
- STATIC_VAR( "int" , FIRST_FINAL() ) << " = " << FIRST_FINAL_STATE() << ";\n"
- "\n";
- }
-
- if ( writeErr ) {
- STATIC_VAR( "int", ERROR() ) << " = " << ERROR_STATE() << ";\n"
- "\n";
- }
-
- ENTRY_POINTS();
+ STATE_IDS();
}
void TabCodeGen::COND_TRANSLATE()